LogoutView.xaml.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. using CyberX8_MainPages.Unity;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Diagnostics;
  5. using System.Linq;
  6. using System.Reflection;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows;
  10. using System.Windows.Controls;
  11. using System.Windows.Data;
  12. using System.Windows.Documents;
  13. using System.Windows.Input;
  14. using System.Windows.Media;
  15. using System.Windows.Media.Imaging;
  16. using System.Windows.Navigation;
  17. using System.Windows.Shapes;
  18. namespace CyberX8_MainPages.Views
  19. {
  20. /// <summary>
  21. /// LogoutView.xaml 的交互逻辑
  22. /// </summary>
  23. public partial class LogoutView : Window
  24. {
  25. public LogoutView()
  26. {
  27. InitializeComponent();
  28. userTextBlock.Text = GlobalUser.Instance.User.Name;
  29. passwordTextBlock.Text = "******";
  30. roleTextBlock.Text = GlobalUser.Instance.User.Role.ToString();
  31. }
  32. private void Close_Click(object sender, RoutedEventArgs e)
  33. {
  34. this.Close();
  35. }
  36. private void Login_Click(object sender, RoutedEventArgs e)
  37. {
  38. Logout();
  39. }
  40. private void PassWordTextBox_KeyDown(object sender, KeyEventArgs e)
  41. {
  42. if (e.Key == Key.Return)
  43. {
  44. Logout();
  45. }
  46. }
  47. private void Logout()
  48. {
  49. GlobalLogin.Instance.ReLogin = true;
  50. }
  51. private void Window_Closed(object sender, EventArgs e)
  52. {
  53. this.Closed -= Window_Closed;
  54. this.logButton.Click -= Login_Click;
  55. this.closeButton.Click -= Close_Click;
  56. }
  57. }
  58. }