CodeRegion.xaml.cs 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Windows;
  7. using System.Windows.Controls;
  8. using System.Windows.Data;
  9. using System.Windows.Documents;
  10. using System.Windows.Input;
  11. using System.Windows.Media;
  12. using System.Windows.Media.Imaging;
  13. using System.Windows.Navigation;
  14. using System.Windows.Shapes;
  15. using Prism.Ioc;
  16. using Prism.Regions;
  17. namespace PDF_Office.Views.Dialog.ServiceDialog
  18. {
  19. /// <summary>
  20. /// CodeRegion.xaml 的交互逻辑
  21. /// </summary>
  22. public partial class CodeRegion : UserControl
  23. {
  24. public CodeRegion()
  25. {
  26. InitializeComponent();
  27. text_Code1.Focus();
  28. }
  29. private void Code_TextChanged(object sender, TextChangedEventArgs e)
  30. {
  31. if (text_Code1.Text.Length >= 1)
  32. {
  33. text_Code2.Focus();
  34. }
  35. else if(text_Code1.Text.Length == 0)
  36. {
  37. text_Code1.Focus();
  38. }
  39. else if (text_Code1.Text.Length > 1)
  40. {
  41. text_Code1.Text = text_Code1.Text.Substring(0, 1);
  42. text_Code1.Focus();
  43. }
  44. }
  45. private void text_Code2_TextChanged(object sender, TextChangedEventArgs e)
  46. {
  47. if (text_Code2.Text.Length >= 1)
  48. {
  49. text_Code3.Focus();
  50. }
  51. else if (text_Code2.Text.Length == 0)
  52. {
  53. text_Code1.Focus();
  54. }
  55. else if (text_Code2.Text.Length > 1)
  56. {
  57. text_Code2.Text = text_Code2.Text.Substring(0, 1);
  58. text_Code2.Focus();
  59. }
  60. }
  61. private void text_Code3_TextChanged(object sender, TextChangedEventArgs e)
  62. {
  63. if (text_Code3.Text.Length >= 1)
  64. {
  65. text_Code4.Focus();
  66. }
  67. else if (text_Code3.Text.Length == 0)
  68. {
  69. text_Code2.Focus();
  70. }
  71. else if (text_Code3.Text.Length > 1)
  72. {
  73. text_Code3.Text = text_Code3.Text.Substring(0, 1);
  74. text_Code3.Focus();
  75. }
  76. }
  77. private void text_Code4_TextChanged(object sender, TextChangedEventArgs e)
  78. {
  79. if (this.text_Code4.Text.Length >= 1)
  80. {
  81. this.text_Code5.Focus();
  82. }
  83. else if (text_Code4.Text.Length == 0)
  84. {
  85. text_Code3.Focus();
  86. }
  87. else if (text_Code4.Text.Length > 1)
  88. {
  89. text_Code4.Text = text_Code4.Text.Substring(0, 1);
  90. text_Code4.Focus();
  91. }
  92. }
  93. private void text_Code5_TextChanged(object sender, TextChangedEventArgs e)
  94. {
  95. if (this.text_Code5.Text.Length == 1)
  96. {
  97. this.text_Code6.Focus();
  98. }
  99. else if (text_Code5.Text.Length == 0)
  100. {
  101. text_Code4.Focus();
  102. }
  103. else if (text_Code5.Text.Length > 1)
  104. {
  105. text_Code5.Text = text_Code5.Text.Substring(0, 1);
  106. text_Code5.Focus();
  107. }
  108. }
  109. private void text_Code6_TextChanged(object sender, TextChangedEventArgs e)
  110. {
  111. if (this.text_Code6.Text.Length == 1)
  112. {
  113. text_Code6.Focus();
  114. }
  115. else if (text_Code6.Text.Length == 0)
  116. {
  117. text_Code5.Focus();
  118. }
  119. else if(text_Code6.Text.Length >1)
  120. {
  121. text_Code6.Text = text_Code6.Text.Substring(0,1);
  122. text_Code6.Focus();
  123. }
  124. }
  125. }
  126. }