123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- 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
- {
- /// <summary>
- /// LoginView.xaml 的交互逻辑
- /// </summary>
- 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 表示正常退出
- }
- }
- }
|