MainWindow.xaml.cs 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  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.Text;
  11. using System.Threading.Tasks;
  12. using System.Windows;
  13. using System.Windows.Controls;
  14. using System.Windows.Data;
  15. using System.Windows.Documents;
  16. using System.Windows.Input;
  17. using System.Windows.Media;
  18. using System.Windows.Media.Imaging;
  19. using System.Windows.Navigation;
  20. using System.Windows.Shapes;
  21. namespace CollaborativePlatformMain
  22. {
  23. /// <summary>
  24. /// MainWindow.xaml 的交互逻辑
  25. /// </summary>
  26. public partial class MainWindow : Window
  27. {
  28. public MainWindow()
  29. {
  30. InitializeComponent();
  31. this.WindowStartupLocation = WindowStartupLocation.CenterScreen;
  32. }
  33. /// <summary>
  34. /// 登陆
  35. /// </summary>
  36. /// <param name="sender"></param>
  37. /// <param name="e"></param>
  38. private void LoginLayButton_Click(object sender, RoutedEventArgs e)
  39. {
  40. //获取用户名和密码
  41. string userName = tb_userName.Text;
  42. string userPwd = tb_userPwd.Text;
  43. //验证登陆
  44. if (LoginUtil.VerifyLoginMethod(userName, userPwd))
  45. {
  46. HomepageForm homepageForm = new HomepageForm();
  47. homepageForm.Show();
  48. this.Close();
  49. }
  50. else
  51. {
  52. //登陆事变
  53. MessageBox.Show("用户名或密码错误!", "提示", MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.None);
  54. }
  55. }
  56. /// <summary>
  57. /// 注册
  58. /// </summary>
  59. /// <param name="sender"></param>
  60. /// <param name="e"></param>
  61. private void RegisterLayButton_Click(object sender, RoutedEventArgs e)
  62. {
  63. sp_Login.Visibility = Visibility.Collapsed;
  64. sp_Register.Visibility = Visibility.Visible;
  65. sp_temporaryLogin.Visibility = Visibility.Collapsed;
  66. }
  67. /// <summary>
  68. /// 临时登陆按下
  69. /// </summary>
  70. /// <param name="sender"></param>
  71. /// <param name="e"></param>
  72. private void TemporaryLogin_Click(object sender, RoutedEventArgs e)
  73. {
  74. sp_Login.Visibility = Visibility.Collapsed;
  75. sp_Register.Visibility = Visibility.Collapsed;
  76. sp_temporaryLogin.Visibility = Visibility.Visible;
  77. }
  78. /// <summary>
  79. /// 临时登陆-确定
  80. /// </summary>
  81. /// <param name="sender"></param>
  82. /// <param name="e"></param>
  83. private void TemporaryLogin2_Click(object sender, RoutedEventArgs e)
  84. {
  85. List<string> temporaryLogins = new List<string>() { "123456" };
  86. if (!string.IsNullOrEmpty(tb_InvitationCode.Text) && temporaryLogins.Contains(tb_InvitationCode.Text))
  87. {
  88. HomepageForm homepageForm = new HomepageForm();
  89. homepageForm.Show();
  90. this.Close();
  91. }
  92. else
  93. {
  94. //登陆事变
  95. MessageBox.Show("邀请码错误!", "提示", MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.None);
  96. }
  97. }
  98. /// <summary>
  99. /// 注册事件
  100. /// </summary>
  101. /// <param name="sender"></param>
  102. /// <param name="e"></param>
  103. private void LayButton_Click(object sender, RoutedEventArgs e)
  104. {
  105. //账号
  106. string name = tb_rguserName.Text.ToString();
  107. //密码
  108. string pwd1 = tb_rguserPwd.Text.ToString();
  109. //确认密码
  110. string pwd2 = tb_rgconuserPwd.Text.ToString();
  111. if (name == string.Empty)
  112. {
  113. MessageBox.Show("账号不允许为空!", "提示", MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.None);
  114. }
  115. if (pwd1 == string.Empty || pwd2 == string.Empty)
  116. {
  117. MessageBox.Show("密码不允许为空!", "提示", MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.None);
  118. }
  119. if (pwd1 != pwd2)
  120. {
  121. MessageBox.Show("两次密码不一致,请检查!", "提示", MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.None);
  122. }
  123. HomepageForm homepageForm = new HomepageForm();
  124. homepageForm.Show();
  125. this.Close();
  126. }
  127. /// <summary>
  128. /// 启动CAD测试
  129. /// </summary>
  130. /// <param name="sender"></param>
  131. /// <param name="e"></param>
  132. private void Button_Click(object sender, RoutedEventArgs e)
  133. {
  134. StartCADUtil.StartCADMath(true);
  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. }
  141. }