using BPASmartClient.CustomResource.Pages.Model; using BPASmartClient.Helper; 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.Shapes; namespace BPASmartClient.CustomResource.Pages.View { /// /// SubPagLoginView.xaml 的交互逻辑 /// public partial class SubPagLoginView : Window { public SubPagLoginView() { InitializeComponent(); Username.Focus(); Username.SelectionStart = Username.Text.Trim().Length; ActionManage.GetInstance.Register(new Action(() => { if (this.IsVisible) { this.DialogResult = true; this.Close(); } }), "LoginOk", true); ActionManage.GetInstance.Register(new Action(() => { if (this.IsVisible) { this.DialogResult = false; this.Close(); } }), "ExitAction", true); NfcServer.GetInstance.EnableLogin = false; } private void PasswordBox_PasswordChanged(object sender, RoutedEventArgs e) { this.markText.Visibility = this.pb.Password.Length > 0 ? Visibility.Collapsed : Visibility.Visible; } private void TextBox_KeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Enter) pb.Focus(); } private void pb_KeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Enter) ActionManage.GetInstance.Send("EnterLogin"); } } }