예제 #1
0
 /// <summary>
 /// 停止所有任务
 /// </summary>
 public void StopAllJobs()
 {
     JobAgents.ForEach(j => { j.Stop(); });
     while (!IsAllJobsStoped)
     {
         Thread.Sleep(1000);
     }
 }
예제 #2
0
 /// <summary>
 /// 启动所有任务
 /// </summary>
 public void StartAllJobs()
 {
     JobAgents.ForEach(j =>
     {
         Task.Factory.StartNew(() =>
         {
             var random = new Random(DateTime.Now.Millisecond);
             Thread.Sleep(random.Next(1000, 6000));
             j.Start(true);
         });
         Thread.Sleep(100);
     });
 }