using System; using System.Drawing; using System.IO; using System.Windows; using System.Windows.Controls; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using Venus_MainPages.Roles; using WPF.Themes.UserControls; namespace Venus_MainPages.Views { /// /// LoginView.xaml 的交互逻辑 /// public partial class LogoutView : Window { public bool IsLoginSuccess { get; set; } public User CurrentUser { get; set; } //private bool _isLogin; public LogoutView() { InitializeComponent(); PassWordTextBox.Password = "admin"; } private void Close_Click(object sender, RoutedEventArgs e) { IsLoginSuccess = false; this.Close(); } private void Login_Click(object sender, RoutedEventArgs e) { Logout(); } private void PassWordTextBox_KeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Return) { Logout(); } } private void UserTextBox_KeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Return) { PassWordTextBox.Focus(); } } private void Logout() { if (UserTextBox.Text != "admin") { IsLoginSuccess = false; WPFMessageBox.ShowError("用户名错误"); return; } if (PassWordTextBox.Password != "admin") { IsLoginSuccess = false; WPFMessageBox.ShowError("密码错误"); return; } Environment.Exit(0); // 0 表示正常退出 } } }