예제 #1
0
 public void PauseAll()
 {
     //ToList cast is a precaution for a situation where the list of machines changes
     //during pausing. It might happen on rare occasions. E.g. when a script loads them, and user
     //hits the pause button.
     //Otherwise it would crash.
     foreach (var machine in Machines.ToList())
     {
         machine.Pause();
     }
     ExternalsManager.Pause();
 }
예제 #2
0
 public void Dispose()
 {
     FileFetcher.CancelDownload();
     lock (machLock)
     {
         var toDispose = machs.Rights.ToArray();
         //Although a single machine does not have to be paused before its disposal,
         //disposing multiple entities has to ensure that all are stopped.
         ExternalsManager.Pause();
         Array.ForEach(toDispose, x => x.Pause());
         Array.ForEach(toDispose, x => x.Dispose());
         machs.Clear();
         ExternalsManager.Clear();
         HostMachine.Dispose();
         CurrentLogger.Dispose();
     }
 }