コード例 #1
0
 private void LoginBox_KeyDown(object sender, Windows.UI.Xaml.Input.KeyRoutedEventArgs e)
 {
     if (e.Key == VirtualKey.Enter)
     {
         if (!string.IsNullOrWhiteSpace(LoginBox.Text))
         {
             if (string.IsNullOrWhiteSpace(PasswordBox.Password))
             {
                 PasswordBox.Focus(FocusState.Keyboard);
             }
             else if (CaptchaForm.Visibility == Visibility.Visible && string.IsNullOrWhiteSpace(CaptchaBox.Text))
             {
                 CaptchaBox.Focus(FocusState.Keyboard);
             }
             else
             {
                 ViewModel.LoginCommand.Execute(null);
             }
         }
     }
 }
コード例 #2
0
ファイル: LoginView.xaml.cs プロジェクト: artemshuba/Colibri
 private void PasswordBox_OnKeyDown(object sender, KeyRoutedEventArgs e)
 {
     if (e.Key == VirtualKey.Enter)
     {
         if (!string.IsNullOrWhiteSpace(PasswordBox.Password))
         {
             if (string.IsNullOrWhiteSpace(LoginBox.Text))
             {
                 LoginBox.Focus(FocusState.Keyboard);
             }
             else if (CaptchaForm.Visibility == Visibility.Visible && string.IsNullOrWhiteSpace(CaptchaBox.Text))
             {
                 CaptchaBox.Focus(FocusState.Keyboard);
             }
             else
             {
                 ((LoginViewModel)DataContext).LoginCommand.Execute(null);
             }
         }
     }
 }