private void StartTimerTask(YZXTask task) { TimerCallback scannerupdatetimercallback = new TimerCallback(task.RunOneTimeInTimer); Timers[task.Name] = new Timer(scannerupdatetimercallback, task, 0, task.Tick); }
private void StartWaitForFinishTask(YZXTask task) { while (!task.RequestStop) { task.RunOneTimeInTimer(); Thread.Sleep(50); } }
/// <summary> /// 配置任务 /// </summary> public void ConfigTasks(YZXCPUProject Project) { AddGCTask(); foreach (System.Tuple <YZXTaskTypes, YZXTask> tt in Project.Tasks) { YZXTask task = tt.Item2; if (tt.Item1 == YZXTaskTypes.IronPython) { IronPythonTask ipytask = task as IronPythonTask; ipytask.InitR(); ConfigIronPythonTask(ipytask); } Tasks[task.Name] = task; } }
public void StartTask(YZXTask task) { switch (task.RunType) { case YZXTaskRunType.TIMER: StartTimerTask(task); break; case YZXTaskRunType.WaitForFinish: task.InitTask(); StartWaitForFinishTask(task); break; case YZXTaskRunType.CONTINUE: task.InitTask(); task.StartThread(); break; } }
public void StartTask(object obj) { YZXTask task = (YZXTask)obj; StartTask(task); }
public void AddTask(YZXTask task) { Tasks[task.Name] = task; task.Id = Tasks.Count; }