protected override void OnFormClosed(FormClosedEventArgs formClosedEventArgs_0) { base.OnFormClosed(formClosedEventArgs_0); if (threadLogin != null) { MethodManager.InvokeNoneException(() => this.threadLogin.Abort()); } }
protected override void Dispose(bool disposing) { MethodManager.InvokeNoneException(() => this.threadLogin.Abort()); if (disposing && (this.components != null)) { this.components.Dispose(); } base.Dispose(disposing); }
private void AppendLog(DataRow row, string message) { MethodManager.ControlInvoke(this.listBoxControl1, delegate { while (this.listBoxControl1.ItemCount > 500) { this.listBoxControl1.Items.RemoveAt(0); } this.listBoxControl1.Items.Add(message); this.listBoxControl1.SelectedIndex = this.listBoxControl1.Items.Count - 1; }); }
public static void CreateLinkManFile() { MethodManager.InvokeNoneException(delegate { if (!File.Exists(AppDomain.CurrentDomain.BaseDirectory + @"Data\LinkMan.txt")) { using (StreamWriter writer = new StreamWriter(AppDomain.CurrentDomain.BaseDirectory + @"Data\LinkMan.txt", true, Encoding.UTF8)) { writer.WriteLine("您可以通过修改本文件临时添加乘车人信息,每一行为一条记录。格式为:姓名(空格)身份证号(空格)电话号码。第一条为样本。"); writer.WriteLine("阿里巴巴 622101195001016626 13800138000"); writer.Flush(); writer.Close(); } } }); }
private void AbortFullTicketCondition(DataRow row) { MethodInvoker invoker2 = null; try { if (invoker2 == null) { invoker2 = delegate { //this.isRunning = false; this.AbortThread(); this.SetFormEnable(true); this.btnStartInTime.Enabled = true; this.timeEdit1.Enabled = true; this.btnCancel.Enabled = true; this.btnOK.Enabled = true; this.lblMessage.Text = "休息时间,自动停止购票!"; this.btnOK.Text = "自动购票"; Thread.Sleep(1000); this.btnStartInTime.Text = "停止启动"; this.SetFormEnable(false); this.timeEdit1.Time = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 6, 59, 50).AddDays(1); this.timeEdit1.Enabled = false; this.btnCancel.Enabled = false; this.btnOK.Enabled = false; this.timerStart.Start(); }; } MethodManager.ControlInvoke(this, invoker2); } catch { Thread.Sleep(1000); this.btnStartInTime.Text = "停止启动"; this.SetFormEnable(false); this.timeEdit1.Time = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 6, 59, 50).AddDays(1); this.timeEdit1.Enabled = false; this.btnCancel.Enabled = false; this.btnOK.Enabled = false; this.timerStart.Start(); } }