LogoutView.xaml.cs 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. using System;
  2. using System.Drawing;
  3. using System.IO;
  4. using System.Windows;
  5. using System.Windows.Controls;
  6. using System.Windows.Input;
  7. using System.Windows.Media;
  8. using System.Windows.Media.Imaging;
  9. using Venus_MainPages.Roles;
  10. using Venus_MainPages.Unity;
  11. using WPF.Themes.UserControls;
  12. namespace Venus_MainPages.Views
  13. {
  14. /// <summary>
  15. /// LoginView.xaml 的交互逻辑
  16. /// </summary>
  17. public partial class LogoutView : Window
  18. {
  19. public LogoutView()
  20. {
  21. InitializeComponent();
  22. userTextBlock.Text = GlobalUser.Instance.User.Name;
  23. passwordTextBlock.Text = "******";
  24. roleTextBlock.Text= GlobalUser.Instance.User.Role.ToString();
  25. }
  26. private void Close_Click(object sender, RoutedEventArgs e)
  27. {
  28. this.Close();
  29. }
  30. private void Login_Click(object sender, RoutedEventArgs e)
  31. {
  32. Logout();
  33. }
  34. private void PassWordTextBox_KeyDown(object sender, KeyEventArgs e)
  35. {
  36. if (e.Key == Key.Return)
  37. {
  38. Logout();
  39. }
  40. }
  41. private void Logout()
  42. {
  43. //if (UserTextBox.Text != "admin")
  44. //{
  45. // IsLoginSuccess = false;
  46. // WPFMessageBox.ShowError("用户名错误");
  47. // return;
  48. //}
  49. //if (PassWordTextBox.Password != "admin")
  50. //{
  51. // IsLoginSuccess = false;
  52. // WPFMessageBox.ShowError("密码错误");
  53. // return;
  54. //}
  55. Environment.Exit(0); // 0 表示正常退出
  56. }
  57. private void Window_Closed(object sender, EventArgs e)
  58. {
  59. this.Closed -= Window_Closed;
  60. this.logButton.Click -= Login_Click;
  61. this.closeButton.Click -= Close_Click;
  62. }
  63. }
  64. }