From 981923c2a2cff6d61cd5a474d2ba398ba48f1fd5 Mon Sep 17 00:00:00 2001 From: chr <chr@chr.com> Date: 星期一, 02 九月 2024 17:40:17 +0800 Subject: [PATCH] 更新代码; --- PdmAlert/LoginWindow.xaml.cs | 54 +++++++++++++++++++++++++++++++++++++++++++----------- 1 files changed, 43 insertions(+), 11 deletions(-) diff --git a/PdmAlert/LoginWindow.xaml.cs b/PdmAlert/LoginWindow.xaml.cs index 99cd421..0dde24c 100644 --- a/PdmAlert/LoginWindow.xaml.cs +++ b/PdmAlert/LoginWindow.xaml.cs @@ -1,16 +1,7 @@ -锘縰sing System; -using System.Collections.Generic; -using System.Linq; -using System.Text; +锘縰sing PdmAlert.Util; +using System; 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 PdmAlert { @@ -21,7 +12,48 @@ { 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) + { + 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); + } + }); + + } } } -- Gitblit v1.9.1