终端一体化运控平台
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 

86 行
2.6 KiB

  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 static BPASmartClient.CustomResource.UserControls.UserKeyBoard;
  16. namespace FryPot_DosingSystem.View
  17. {
  18. /// <summary>
  19. /// AdministratorPasswordChangeView.xaml 的交互逻辑
  20. /// </summary>
  21. public partial class AdministratorPasswordChangeView : UserControl
  22. {
  23. public AdministratorPasswordChangeView()
  24. {
  25. InitializeComponent();
  26. }
  27. private void tbx_admin_GotFocus(object sender, RoutedEventArgs e)
  28. {
  29. myKeyboard.MyKeyDown = MyKeyDown_Admin;
  30. }
  31. private void password_GotFocus(object sender, RoutedEventArgs e)
  32. {
  33. myKeyboard.MyKeyDown = MyKeyDown_Password;
  34. }
  35. private void MyKeyDown_Password(object _key)
  36. {
  37. EKeyitem key = EKeyitem.A;
  38. if (_key.GetType() == typeof(EKeyitem)) key = (EKeyitem)_key;
  39. switch (key)
  40. {
  41. case EKeyitem.DEL:
  42. if (password.Password.Length > 0)
  43. {
  44. password.Password = password.Password.Substring(0, password.Password.Length - 1);
  45. }
  46. break;
  47. case EKeyitem.AC:
  48. password.Password = string.Empty;
  49. break;
  50. case EKeyitem.OK:
  51. break;
  52. default:
  53. password.Password += _key.ToString();
  54. break;
  55. }
  56. }
  57. private void MyKeyDown_Admin(object _key)
  58. {
  59. EKeyitem key = EKeyitem.A;
  60. if (_key.GetType() == typeof(EKeyitem)) key = (EKeyitem)_key;
  61. switch (key)
  62. {
  63. case EKeyitem.DEL:
  64. if (tbx_admin.Text.Length > 0)
  65. {
  66. tbx_admin.Text = tbx_admin.Text.Substring(0, tbx_admin.Text.Length - 1);
  67. }
  68. break;
  69. case EKeyitem.AC:
  70. tbx_admin.Text = string.Empty;
  71. break;
  72. case EKeyitem.OK:
  73. break;
  74. default:
  75. tbx_admin.Text += _key.ToString();
  76. break;
  77. }
  78. this.tbx_admin.Focus();
  79. }
  80. }
  81. }