|
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Data;
- using System.Windows.Documents;
- using System.Windows.Input;
- using System.Windows.Media;
- using System.Windows.Media.Imaging;
- using System.Windows.Navigation;
- using System.Windows.Shapes;
- using static BPASmartClient.CustomResource.UserControls.UserKeyBoard;
-
- namespace FryPot_DosingSystem.View
- {
- /// <summary>
- /// AdministratorPasswordChangeView.xaml 的交互逻辑
- /// </summary>
- public partial class AdministratorPasswordChangeView : UserControl
- {
- public AdministratorPasswordChangeView()
- {
- InitializeComponent();
- }
-
- private void tbx_admin_GotFocus(object sender, RoutedEventArgs e)
- {
- myKeyboard.MyKeyDown = MyKeyDown_Admin;
- }
-
- private void password_GotFocus(object sender, RoutedEventArgs e)
- {
- myKeyboard.MyKeyDown = MyKeyDown_Password;
- }
- private void MyKeyDown_Password(object _key)
- {
- EKeyitem key = EKeyitem.A;
- if (_key.GetType() == typeof(EKeyitem)) key = (EKeyitem)_key;
- switch (key)
- {
- case EKeyitem.DEL:
- if (password.Password.Length > 0)
- {
- password.Password = password.Password.Substring(0, password.Password.Length - 1);
- }
- break;
- case EKeyitem.AC:
- password.Password = string.Empty;
- break;
- case EKeyitem.OK:
- break;
- default:
- password.Password += _key.ToString();
- break;
- }
-
- }
- private void MyKeyDown_Admin(object _key)
- {
- EKeyitem key = EKeyitem.A;
- if (_key.GetType() == typeof(EKeyitem)) key = (EKeyitem)_key;
- switch (key)
- {
- case EKeyitem.DEL:
- if (tbx_admin.Text.Length > 0)
- {
- tbx_admin.Text = tbx_admin.Text.Substring(0, tbx_admin.Text.Length - 1);
- }
- break;
- case EKeyitem.AC:
- tbx_admin.Text = string.Empty;
- break;
- case EKeyitem.OK:
- break;
- default:
- tbx_admin.Text += _key.ToString();
- break;
- }
- this.tbx_admin.Focus();
- }
- }
- }
|