MainWindow.xaml.cs 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. using Autodesk.AutoCAD.EditorInput;
  2. using CollaborativePlatformMain.CADStartUtil;
  3. using CollaborativePlatformMain.Form;
  4. using CollaborativePlatformMain.Util;
  5. using DFBIM.CADNETCommon.ExtensionMethod;
  6. using DFBIM.CADNETCommon.ReconStruct;
  7. using System;
  8. using System.Collections.Generic;
  9. using System.Linq;
  10. using System.Runtime.InteropServices;
  11. using System.Text;
  12. using System.Threading.Tasks;
  13. using System.Windows;
  14. using System.Windows.Controls;
  15. using System.Windows.Data;
  16. using System.Windows.Documents;
  17. using System.Windows.Input;
  18. using System.Windows.Media;
  19. using System.Windows.Media.Imaging;
  20. using System.Windows.Navigation;
  21. using System.Windows.Shapes;
  22. namespace CollaborativePlatformMain
  23. {
  24. /// <summary>
  25. /// MainWindow.xaml 的交互逻辑
  26. /// </summary>
  27. public partial class MainWindow : Window
  28. {
  29. public MainWindow()
  30. {
  31. InitializeComponent();
  32. this.WindowStartupLocation = WindowStartupLocation.CenterScreen;
  33. }
  34. /// <summary>
  35. /// 登陆
  36. /// </summary>
  37. /// <param name="sender"></param>
  38. /// <param name="e"></param>
  39. private void LoginLayButton_Click(object sender, RoutedEventArgs e)
  40. {
  41. //获取用户名和密码
  42. string userName = tb_userName.Text;
  43. string userPwd = tb_userPwd.Text;
  44. //验证登陆
  45. if (LoginUtil.VerifyLoginMethod(userName, userPwd))
  46. {
  47. HomepageForm homepageForm = new HomepageForm();
  48. homepageForm.Show();
  49. this.Close();
  50. }
  51. else
  52. {
  53. //登陆事变
  54. MessageBox.Show("用户名或密码错误!", "提示", MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.None);
  55. }
  56. }
  57. /// <summary>
  58. /// 注册
  59. /// </summary>
  60. /// <param name="sender"></param>
  61. /// <param name="e"></param>
  62. private void RegisterLayButton_Click(object sender, RoutedEventArgs e)
  63. {
  64. sp_Login.Visibility = Visibility.Collapsed;
  65. sp_Register.Visibility = Visibility.Visible;
  66. sp_temporaryLogin.Visibility = Visibility.Collapsed;
  67. }
  68. /// <summary>
  69. /// 临时登陆按下
  70. /// </summary>
  71. /// <param name="sender"></param>
  72. /// <param name="e"></param>
  73. private void TemporaryLogin_Click(object sender, RoutedEventArgs e)
  74. {
  75. sp_Login.Visibility = Visibility.Collapsed;
  76. sp_Register.Visibility = Visibility.Collapsed;
  77. sp_temporaryLogin.Visibility = Visibility.Visible;
  78. }
  79. /// <summary>
  80. /// 临时登陆-确定
  81. /// </summary>
  82. /// <param name="sender"></param>
  83. /// <param name="e"></param>
  84. private void TemporaryLogin2_Click(object sender, RoutedEventArgs e)
  85. {
  86. List<string> temporaryLogins = new List<string>() { "123456" };
  87. if (!string.IsNullOrEmpty(tb_InvitationCode.Text) && temporaryLogins.Contains(tb_InvitationCode.Text))
  88. {
  89. HomepageForm homepageForm = new HomepageForm();
  90. homepageForm.Show();
  91. this.Close();
  92. }
  93. else
  94. {
  95. //登陆事变
  96. MessageBox.Show("邀请码错误!", "提示", MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.None);
  97. }
  98. }
  99. /// <summary>
  100. /// 注册事件
  101. /// </summary>
  102. /// <param name="sender"></param>
  103. /// <param name="e"></param>
  104. private void LayButton_Click(object sender, RoutedEventArgs e)
  105. {
  106. //账号
  107. string name = tb_rguserName.Text.ToString();
  108. //密码
  109. string pwd1 = tb_rguserPwd.Text.ToString();
  110. //确认密码
  111. string pwd2 = tb_rgconuserPwd.Text.ToString();
  112. if (name == string.Empty)
  113. {
  114. MessageBox.Show("账号不允许为空!", "提示", MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.None);
  115. }
  116. if (pwd1 == string.Empty || pwd2 == string.Empty)
  117. {
  118. MessageBox.Show("密码不允许为空!", "提示", MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.None);
  119. }
  120. if (pwd1 != pwd2)
  121. {
  122. MessageBox.Show("两次密码不一致,请检查!", "提示", MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.None);
  123. }
  124. HomepageForm homepageForm = new HomepageForm();
  125. homepageForm.Show();
  126. this.Close();
  127. }
  128. /// <summary>
  129. /// 启动CAD测试
  130. /// </summary>
  131. /// <param name="sender"></param>
  132. /// <param name="e"></param>
  133. private void Button_Click(object sender, RoutedEventArgs e)
  134. {
  135. }
  136. private void Button_Click_1(object sender, RoutedEventArgs e)
  137. {
  138. StartCADUtil.StartCADMath(false, new OpenDrawPathData(true, @"C:\Users\jiantu\Desktop\Drawing2.dwg"));
  139. }
  140. /// <summary>
  141. /// 邀请码返回
  142. /// </summary>
  143. /// <param name="sender"></param>
  144. /// <param name="e"></param>
  145. private void Button_Click_2(object sender, RoutedEventArgs e)
  146. {
  147. sp_Login.Visibility = Visibility.Visible;
  148. sp_Register.Visibility = Visibility.Collapsed;
  149. sp_temporaryLogin.Visibility = Visibility.Collapsed;
  150. }
  151. /// <summary>
  152. /// 临时登录返回
  153. /// </summary>
  154. /// <param name="sender"></param>
  155. /// <param name="e"></param>
  156. private void Button_Click_3(object sender, RoutedEventArgs e)
  157. {
  158. sp_Login.Visibility = Visibility.Visible;
  159. sp_Register.Visibility = Visibility.Collapsed;
  160. sp_temporaryLogin.Visibility = Visibility.Collapsed;
  161. }
  162. }
  163. }