MainWindow.xaml.cs 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. using CollaborativePlatformMain.Form;
  2. using CollaborativePlatformMain.Util;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. using System.Windows;
  9. using System.Windows.Controls;
  10. using System.Windows.Data;
  11. using System.Windows.Documents;
  12. using System.Windows.Input;
  13. using System.Windows.Media;
  14. using System.Windows.Media.Imaging;
  15. using System.Windows.Navigation;
  16. using System.Windows.Shapes;
  17. namespace CollaborativePlatformMain
  18. {
  19. /// <summary>
  20. /// MainWindow.xaml 的交互逻辑
  21. /// </summary>
  22. public partial class MainWindow : Window
  23. {
  24. public MainWindow()
  25. {
  26. InitializeComponent();
  27. this.WindowStartupLocation = WindowStartupLocation.CenterScreen;
  28. }
  29. /// <summary>
  30. /// 登陆
  31. /// </summary>
  32. /// <param name="sender"></param>
  33. /// <param name="e"></param>
  34. private void LoginLayButton_Click(object sender, RoutedEventArgs e)
  35. {
  36. //获取用户名和密码
  37. string userName = tb_userName.Text;
  38. string userPwd = tb_userPwd.Text;
  39. //验证登陆
  40. if (LoginUtil.VerifyLoginMethod(userName, userPwd))
  41. {
  42. HomepageForm homepageForm = new HomepageForm();
  43. homepageForm.Show();
  44. this.Close();
  45. }
  46. else
  47. {
  48. //登陆事变
  49. MessageBox.Show("用户名或密码错误!", "提示", MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.None);
  50. }
  51. }
  52. /// <summary>
  53. /// 注册
  54. /// </summary>
  55. /// <param name="sender"></param>
  56. /// <param name="e"></param>
  57. private void RegisterLayButton_Click(object sender, RoutedEventArgs e)
  58. {
  59. }
  60. /// <summary>
  61. /// 临时登陆按下
  62. /// </summary>
  63. /// <param name="sender"></param>
  64. /// <param name="e"></param>
  65. private void TemporaryLogin_Click(object sender, RoutedEventArgs e)
  66. {
  67. sp_Login.Visibility = Visibility.Collapsed;
  68. sp_Register.Visibility = Visibility.Collapsed;
  69. sp_temporaryLogin.Visibility = Visibility.Visible;
  70. }
  71. /// <summary>
  72. /// 临时登陆-确定
  73. /// </summary>
  74. /// <param name="sender"></param>
  75. /// <param name="e"></param>
  76. private void TemporaryLogin2_Click(object sender, RoutedEventArgs e)
  77. {
  78. List<string> temporaryLogins = new List<string>() { "550632" };
  79. if (!string.IsNullOrEmpty(tb_InvitationCode.Text) && temporaryLogins.Contains(tb_InvitationCode.Text))
  80. {
  81. HomepageForm homepageForm = new HomepageForm();
  82. homepageForm.Show();
  83. this.Close();
  84. }
  85. else
  86. {
  87. //登陆事变
  88. MessageBox.Show("邀请码错误!", "提示", MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.None);
  89. }
  90. }
  91. }
  92. }