From 31a636e735a0addc56e4f4527f500b7aa0874eb5 Mon Sep 17 00:00:00 2001 From: chr <chr@mailcom> Date: 星期五, 03 一月 2025 11:21:46 +0800 Subject: [PATCH] 改了一大堆; --- PdmAlert/LoginWindow.xaml.cs | 44 +++++++++++++++++++++++++++++++++++++++----- 1 files changed, 39 insertions(+), 5 deletions(-) diff --git a/PdmAlert/LoginWindow.xaml.cs b/PdmAlert/LoginWindow.xaml.cs index 6db9861..0dde24c 100644 --- a/PdmAlert/LoginWindow.xaml.cs +++ b/PdmAlert/LoginWindow.xaml.cs @@ -1,4 +1,7 @@ -锘縰sing System.Windows; +锘縰sing PdmAlert.Util; +using System; +using System.Threading.Tasks; +using System.Windows; namespace PdmAlert { @@ -9,16 +12,47 @@ { 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); + } + }); } } -- Gitblit v1.9.1