| | |
| | | using System.Windows; |
| | | using PdmAlert.Util; |
| | | using System; |
| | | using System.Threading.Tasks; |
| | | using System.Windows; |
| | | |
| | | namespace PdmAlert |
| | | { |
| | |
| | | { |
| | | public LoginWindow() |
| | | { |
| | | _windowTitle = $"V{App.Version}"; |
| | | DataContext = this; |
| | | InitializeComponent(); |
| | | } |
| | | |
| | | private string _windowTitle; |
| | | |
| | | public string windowTitle |
| | | { |
| | | get => _windowTitle; |
| | | } |
| | | |
| | | |
| | | public void Button_Click(object sender, RoutedEventArgs e) |
| | | { |
| | | if (LoginUser.Login(usernameTextBlock.Text, passwordTextBlock.Password, rememberMeInput.IsChecked == true)) |
| | | MaskAdorner.ShowMask(mainBorder); |
| | | string username = usernameTextBlock.Text; |
| | | string password = passwordTextBlock.Password; |
| | | bool rememberMe = rememberMeInput.IsChecked == true; |
| | | Task.Run(() => |
| | | { |
| | | |
| | | |
| | | } |
| | | try |
| | | { |
| | | if (LoginUser.Login(username, password, rememberMe)) |
| | | { |
| | | Dispatcher.Invoke(() => |
| | | { |
| | | ((App)Application.Current).InitDockApp(); |
| | | this.Close(); |
| | | }); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MessageBox.Show(ex.Message, "登录异常", MessageBoxButton.OK, MessageBoxImage.Error); |
| | | } |
| | | finally |
| | | { |
| | | MaskAdorner.HideMask(mainBorder); |
| | | } |
| | | }); |
| | | |
| | | } |
| | | } |