#pragma warning restore IDE0044 #region 登录窗口载入 /// <summary> /// 登录窗口载入 /// </summary> public LoginForm() { InitializeComponent(); //允许线程操作窗口控件 Control.CheckForIllegalCrossThreadCalls = false; //设置窗口的拖动 InitFormMove(this); InitFormMove(pictureBox); string cloudRoot = GetData.Get("https://download.3tme.cn/Ares/RootData.json", true);//获取WeiApi地址原始数据 //判断取回数据是否有错,有错则报错然后结束进程 if (cloudRoot == "Error" || cloudRoot == null) { this.Visible = false; this.Enabled = false; if (FrmDialog.ShowDialog(this, "Ares当前无法获取系统重要云端数据\n\n点击\"确定\"按钮为您打开相关解决方法的网页链接\n\n点击\"取消\"按钮退出Ares软件", "Ares - 致命错误", true) == DialogResult.OK) { System.Diagnostics.Process.Start("https://tz.3tme.cn/error-information/server-connection-failed.html"); } Environment.Exit(0); } Root = JsonConvert.DeserializeObject <RootData>(cloudRoot); //解析Json数据 webApiUrlData = Root.WebApiUrlData; //提取Root中的WebApi部分 Verify = new VerifyFunction(webApiUrlData); //实例化网络验证对象 //读取已保存卡密 var uKey = OperateIniFile.ReadIniData("Ares", "Key", "", "logindata.ini"); if (uKey.Length > 0) { ucTextBoxEx_Key.InputText = Decrypt.DES(uKey, "areskeys"); } //通过Lambda表达式创建线程获取云通知 Thread cloudNotificationThread = new Thread(() => { cloudNotificationData = Root.CloudNotificationData;//提取Root中的cloudNotificationData //判断信息框的操作 if (cloudNotificationData.MsgBox.Switch == "1") { switch (cloudNotificationData.MsgBox.Type) { case "1": { //仅弹窗提示 FrmDialog.ShowDialog(this, cloudNotificationData.MsgBox.Content.Replace("*", "\n"), cloudNotificationData.MsgBox.Title); break; } case "2": { //弹窗提示+是否打开链接 if (FrmDialog.ShowDialog(this, cloudNotificationData.MsgBox.Content.Replace("*", "\n"), cloudNotificationData.MsgBox.Title, true) == DialogResult.OK) { System.Diagnostics.Process.Start(cloudNotificationData.MsgBox.Link); } break; } case "3": { //直接打开链接 System.Diagnostics.Process.Start(cloudNotificationData.MsgBox.Link); break; } } } //判断按钮的操作,接下来的操作要写在按钮被点击的方法里 if (cloudNotificationData.Button.Switch == "1") { ucBtnExt_CloudNotification.Location = new Point(224, 485); //设置按钮位置正常 ucBtnExt_CloudNotification.BtnText = cloudNotificationData.Button.Text; } //判断标签的操作,接下来的操作要写在按钮被点击的方法里 if (cloudNotificationData.Label.Switch == "1") { label_CloudNotification.Location = new Point(-10, 494); //设置标签可视 label_CloudNotification.Text = cloudNotificationData.Label.Text; label_CloudNotification.ForeColor = Color.FromArgb(cloudNotificationData.Label.Color.R, cloudNotificationData.Label.Color.G, cloudNotificationData.Label.Color.B); } }); cloudNotificationThread.Start(); //通过Lambda表达式创建线程检测版本更新 Thread checkVersionThread = new Thread(() => { string result = Verify.VersionCheck(localVersion); //1为最新版,0为不是最新版,-1为出错 //1就直接跳出循环,0载入更新窗口,-1报错然后退出程序 //后期预想:0载入更新窗口,窗口中显示新版本更新内容,目前只要弹窗告诉不是最新版然后弹下载地址就好 switch (result) { case "1": { break; } case "0": { this.Visible = false; if (FrmDialog.ShowDialog(this, "检测到当前Ares版本不是最新版\n\n点击\"确定\"按钮为您打开最新版下载链接\n\n点击\"取消\"按钮退出Ares软件", "Ares - 版本更新", true) == DialogResult.OK) { System.Diagnostics.Process.Start("https://wp.3tme.cn/"); } Environment.Exit(0); break; } case "-1": { this.Visible = false; if (FrmDialog.ShowDialog(this, "Ares当前无法连接至验证服务器\n\n点击\"确定\"按钮为您打开相关解决方法的网页链接\n\n点击\"取消\"按钮退出Ares软件", "Ares - 致命错误", true) == DialogResult.OK) { System.Diagnostics.Process.Start("https://tz.3tme.cn/error-information/verify-server-connection-failed.html"); } Environment.Exit(0); break; } } }); checkVersionThread.Start(); }
public VerifyFunction(WebApiUrlData data) { webApiUrl = data; }