终端一体化运控平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

96 lines
2.7 KiB

  1. using BPASmartClient.Helper;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using System.Windows;
  8. using System.Windows.Controls;
  9. using System.Windows.Data;
  10. using System.Windows.Documents;
  11. using System.Windows.Input;
  12. using System.Windows.Media;
  13. using System.Windows.Media.Imaging;
  14. using System.Windows.Shapes;
  15. using static BPASmartClient.CustomResource.UserControls.UserKeyBoard;
  16. namespace FryPot_DosingSystem.View
  17. {
  18. /// <summary>
  19. /// AdministratorLoginView.xaml 的交互逻辑
  20. /// </summary>
  21. public partial class AdministratorLoginView : UserControl
  22. {
  23. public AdministratorLoginView()
  24. {
  25. InitializeComponent();
  26. }
  27. private void MyKeyDown_Password(object _key)
  28. {
  29. EKeyitem key = EKeyitem.A;
  30. if (_key.GetType() == typeof(EKeyitem)) key = (EKeyitem)_key;
  31. switch (key)
  32. {
  33. case EKeyitem.DEL:
  34. if (password.Password.Length > 0)
  35. {
  36. password.Password = password.Password.Substring(0, password.Password.Length - 1);
  37. }
  38. break;
  39. case EKeyitem.AC:
  40. password.Password = string.Empty;
  41. break;
  42. case EKeyitem.OK:
  43. break;
  44. default:
  45. password.Password += _key.ToString();
  46. break;
  47. }
  48. }
  49. private void tbx_admin_GotFocus(object sender, RoutedEventArgs e)
  50. {
  51. myKeyboard.MyKeyDown = MyKeyDown_Admin;
  52. }
  53. private void password_GotFocus(object sender, RoutedEventArgs e)
  54. {
  55. myKeyboard.MyKeyDown = MyKeyDown_Password;
  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. private void UserControl_Loaded(object sender, RoutedEventArgs e)
  81. {
  82. this.tbx_admin.Focus();
  83. }
  84. }
  85. }