| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- using System;
- using System.Windows;
- using System.Windows.Automation.Peers;
- using System.Windows.Automation.Provider;
- using System.Windows.Controls;
- using System.Windows.Input;
- using InABox.Clients;
- using InABox.Wpf;
- using InABox.WPF;
- using ValidationResult = InABox.Clients.ValidationResult;
- namespace PRSDesktop
- {
- /// <summary>
- /// Interaction logic for LoginScreen.xaml
- /// </summary>
- public partial class LoginScreen : ThemableWindow
- {
- public LoginScreen()
- {
- InitializeComponent();
- }
- public string UserID
- {
- get => editUser.Text;
- set => editUser.Text = value;
- }
- public string Password
- {
- get => editPassword.Password;
- set => editPassword.Password = value;
- }
- private void editUser_TextChanged(object sender, TextChangedEventArgs e)
- {
- }
- private void btnOK_Click(object sender, RoutedEventArgs e)
- {
- Progress.Show("Logging In");
- try
- {
- var valid = ClientFactory.Validate(editUser.Text, editPassword.Password);
- Progress.Close();
- if (valid == ValidationResult.VALID)
- {
- DialogResult = true;
- Close();
- }
- }
- catch (Exception err)
- {
- Progress.Close();
- MessageBox.Show(err.Message);
- }
- }
- private void btnCancel_Click(object sender, RoutedEventArgs e)
- {
- DialogResult = false;
- Close();
- }
- private void EditPassword_KeyUp(object sender, KeyEventArgs e)
- {
- e.Handled = true;
- if (e.Key == Key.Enter || e.Key == Key.Return)
- {
- var peer = new ButtonAutomationPeer(btnOK);
- var invokeProv = peer.GetPattern(PatternInterface.Invoke) as IInvokeProvider;
- invokeProv.Invoke();
- }
- }
- }
- }
|