using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using UI.Framework.Forms; namespace Chat.Framework.WXSdk.UIForm { public partial class SetwxhForm : BaseForm { public SetwxhForm() { InitializeComponent(); } public string wxh { get; private set; } public string deviceid { get; private set; } private void SetwxhForm_Load(object sender, EventArgs e) { checkBox1_CheckedChanged(null, null); } private void simpleButton1_Click(object sender, EventArgs e) { try { var wxhTmp = textEdit1.Text.Trim(); if (string.IsNullOrWhiteSpace(wxhTmp)) throw new Exception("微信号不能为空"); if (wxhTmp.Length > 30) throw new Exception(@"对不起,输入的微信号长度过长. 请填写真实的微信号"); this.wxh = wxhTmp; if (this.checkBox1.Checked) { var text = this.textBox1.Text.Trim(); if (!text.StartsWith("62") || !text.EndsWith("7f")) throw new Exception("对不起,您输入的设备信息格式有误!"); var v = ChatClient.WXClient.FirstOrDefault(f => f.Key == wxhTmp).Value; if (v != null) { var q = MessageBox.Show("此账号并非首次登陆!!!\r\n请慎重!不懂请选【否】!!!\r\n此账号已有登陆记录,如果还要设置设备信息,可能导致账号异常!", "您是否还要继续?", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (q == DialogResult.Yes) this.deviceid = text; } else this.deviceid = text; } this.Close(); } catch (Exception ex) { BaseForm.ShowError(ex); } } private void checkBox1_CheckedChanged(object sender, EventArgs e) { if (this.checkBox1.Checked) { this.Size = new Size(407, 296); } else { this.Size = new Size(407, 142); } groupControl1.Visible = this.checkBox1.Checked; } } }