public void ExecuteFunctions() { paddingleft = StringFormat.FormatDoubleToIntString(RangeY.To.DoubleValue).Length * 10; this.ClearPaintArea(); RefreshCoordinateAxis(); ClearThreads(); //LineParameters lp = new LineParameters(2, 3, 1, 2, Brushes.Red, new FunctionLiN()); //DrawLine(lp); foreach (FunctionExecute fe in this.m_FunctionExecutes) { fe.Function.Reset(); //FunctionThread t = new FunctionThread(fe, dl, GetXStart(double.Parse(fe.Range.From.ToString())), this.Dispatcher); FunctionThread t = new FunctionThread(fe, dl, fe.Range.From.DoubleValue, this.Dispatcher); if (this.OnFunctionStart != null) { t.OnFunctionStart += this.OnFunctionStart; } if (this.OnFunctionStop != null) { t.OnFunctionStop += this.OnFunctionStop; } t.Start(); m_Threads.Add(fe.Function, t); } }
private void GameExpedition_Team4Checked_checkBox_CheckedChanged(object sender, EventArgs e) { if (GameExpedition_Team4Checked_checkBox.Checked) { LockControls(4, true); new Utility.Process.ExpeditionTimer(4); } else { LockControls(4, false); FunctionThread.CloseThread("远征计时器_4"); IfNoTimer(); } }
/// <summary> /// 开启线程 /// </summary> public virtual void StartThread() { lock (_startThreadLocked)// 使用lock语句确保异步线程不会创建同一个线程 { if (!IsThreadAlive) { Thread = new Thread(this.Entrance); } if (FunctionThread.Contains(this.Name))//若线程池有同名线程则不允许开启线程 { return; } if (this.Thread != null) { Function.FunctionThread.AddThread(this); this.Thread.Start(); } } }
/// <summary> /// 结束出击 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void GameAttack_Stop_button_Click(object sender, EventArgs e) { FunctionThread.CloseThread("自动出击"); }
private void GameEventAttack_Stop_button_Click(object sender, EventArgs e) { FunctionThread.CloseThread(nameof(Utility.Process.EventAttack)); }