12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- 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;
- 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 == ValidationStatus.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();
- }
- }
- }
- }
|