using Autodesk.AutoCAD.EditorInput;
using CollaborativePlatformMain.CADStartUtil;
using CollaborativePlatformMain.Form;
using CollaborativePlatformMain.Util;
using DFBIM.CADNETCommon.ExtensionMethod;
using DFBIM.CADNETCommon.ReconStruct;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace CollaborativePlatformMain
{
///
/// MainWindow.xaml 的交互逻辑
///
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
this.WindowStartupLocation = WindowStartupLocation.CenterScreen;
}
///
/// 登陆
///
///
///
private void LoginLayButton_Click(object sender, RoutedEventArgs e)
{
//获取用户名和密码
string userName = tb_userName.Text;
string userPwd = tb_userPwd.Text;
//验证登陆
if (LoginUtil.VerifyLoginMethod(userName, userPwd))
{
HomepageForm homepageForm = new HomepageForm();
homepageForm.Show();
this.Close();
}
else
{
//登陆事变
MessageBox.Show("用户名或密码错误!", "提示", MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.None);
}
}
///
/// 注册
///
///
///
private void RegisterLayButton_Click(object sender, RoutedEventArgs e)
{
sp_Login.Visibility = Visibility.Collapsed;
sp_Register.Visibility = Visibility.Visible;
sp_temporaryLogin.Visibility = Visibility.Collapsed;
}
///
/// 临时登陆按下
///
///
///
private void TemporaryLogin_Click(object sender, RoutedEventArgs e)
{
sp_Login.Visibility = Visibility.Collapsed;
sp_Register.Visibility = Visibility.Collapsed;
sp_temporaryLogin.Visibility = Visibility.Visible;
}
///
/// 临时登陆-确定
///
///
///
private void TemporaryLogin2_Click(object sender, RoutedEventArgs e)
{
List temporaryLogins = new List() { "123456" };
if (!string.IsNullOrEmpty(tb_InvitationCode.Text) && temporaryLogins.Contains(tb_InvitationCode.Text))
{
HomepageForm homepageForm = new HomepageForm();
homepageForm.Show();
this.Close();
}
else
{
//登陆事变
MessageBox.Show("邀请码错误!", "提示", MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.None);
}
}
///
/// 注册事件
///
///
///
private void LayButton_Click(object sender, RoutedEventArgs e)
{
//账号
string name = tb_rguserName.Text.ToString();
//密码
string pwd1 = tb_rguserPwd.Text.ToString();
//确认密码
string pwd2 = tb_rgconuserPwd.Text.ToString();
if (name == string.Empty)
{
MessageBox.Show("账号不允许为空!", "提示", MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.None);
}
if (pwd1 == string.Empty || pwd2 == string.Empty)
{
MessageBox.Show("密码不允许为空!", "提示", MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.None);
}
if (pwd1 != pwd2)
{
MessageBox.Show("两次密码不一致,请检查!", "提示", MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.None);
}
HomepageForm homepageForm = new HomepageForm();
homepageForm.Show();
this.Close();
}
///
/// 启动CAD测试
///
///
///
private void Button_Click(object sender, RoutedEventArgs e)
{
}
private void Button_Click_1(object sender, RoutedEventArgs e)
{
StartCADUtil.StartCADMath(false, new OpenDrawPathData(true, @"C:\Users\jiantu\Desktop\Drawing2.dwg"));
}
///
/// 邀请码返回
///
///
///
private void Button_Click_2(object sender, RoutedEventArgs e)
{
sp_Login.Visibility = Visibility.Visible;
sp_Register.Visibility = Visibility.Collapsed;
sp_temporaryLogin.Visibility = Visibility.Collapsed;
}
///
/// 临时登录返回
///
///
///
private void Button_Click_3(object sender, RoutedEventArgs e)
{
sp_Login.Visibility = Visibility.Visible;
sp_Register.Visibility = Visibility.Collapsed;
sp_temporaryLogin.Visibility = Visibility.Collapsed;
}
}
}