private void Form1_Load(object sender, EventArgs e) { var setting = new Reg().In("Setting"); var rkSetting = setting.In("rk"); ipVerifyUsername.Text = rkSetting.GetInfo("username"); ipVerifyPassword.Text = rkSetting.GetInfo("password"); ipVerifyUsername.TextChanged += (x, xx) => { rkSetting.SetInfo("username", ipVerifyUsername.Text); SynVerifier(); }; ipVerifyPassword.TextChanged += (x, xx) => { rkSetting.SetInfo("password", ipVerifyPassword.Text); SynVerifier(); }; var formSetting = setting.In("Main"); BtnTestStampInfo.Enabled = Convert.ToBoolean(formSetting.GetInfo("BtnTestStampInfo.Enabled", "false")); lstUser.Columns.Add(new ColumnHeader("userAccess") { Text = "状态" }); lstUser.HoverSelection = true; lstUser.FullRowSelect = true; for (int i = 0; i < UserList.Count; i++) { var user = UserList.GetUser(i); var item = lstUser.Items.Add(user.Username, user.Username, 0); item.SubItems.Add(user.Password); item.SubItems.Add(user.Status.ToString()); } lstUser.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent); var updateLst = new Action <int>((num) => { for (int i = 0; i < num; i++) { //Thread.Sleep(1500); new TestMethod(UserList.GetUser(i)).Login((user) => { lstUser.BeginInvoke(new Action(() => { lstUser.Items[user.Username].SubItems[2].Text = user.Status.ToString(); })); }); } }); btnTestLogin.Click += (x, xx) => { var i = Convert.ToInt32(InputBox.ShowInputBox("用户序号", "")); new TestMethod(UserList.GetUser(i)).Login((user) => { lstUser.BeginInvoke(new Action(() => { lstUser.Items[user.Username].SubItems[2].Text = user.Status.ToString(); })); }); }; btnTestLoginMuti.Click += (x, xx) => { var num = InputBox.ShowInputBox("用户数量", "", UserList.Count.ToString()); updateLst.BeginInvoke(Convert.ToInt32(num), (obj) => { }, null); }; btnTestModifyPhone.Click += (x, xx) => TestModule.ModifyPhone(); BtnTestStampInfo.Click += (x, xx) => { if (((Button)x).Enabled) { TestModule.SynStampInfo(); } }; btnTestSynBillInfo.Click += (x, xx) => TestModule.SynBillInfo(); btnTestGetPhoneVerifyCode.Click += (x, xx) => TestModule.GetPhoneVerifyCode(); btnTestGetImgVerifyCode.Click += (x, xx) => TestModule.GetImgVerifyCode(); btnTestSubmitBill.Click += (x, xx) => TestModule.TestSubmitBill(); Logger.OnLog += (logSender, logInfo) => { OpLog.Invoke(new Action(() => { OpLog.AppendText(logInfo.LogBase); OpLog.AppendText("."); OpLog.AppendText(logInfo.LogInfo); OpLog.AppendText("\n"); OpLog.ScrollToCaret(); })); }; SynVerifier(); }
public void AppendLog(string info) { OpLog.AppendText("\n"); OpLog.AppendText(string.Format("{0}>>{1}", DateTime.Now, info)); }