コード例 #1
0
ファイル: WpfApp.cs プロジェクト: MechanicalMen/Mechanical4
 private void Window_Closing(object sender, CancelEventArgs e)
 {
     // don't close the window, unless the event queue has already shut down
     if (!this.canCloseWindow)
     {
         e.Cancel = true;
         MainEventQueue.RequestShutdown(); // implicitly enqueues ShuttingDownEvent, if not cancelled
     }
 }
コード例 #2
0
 /// <summary>
 /// Adds a list of <see cref="SystemHealthExternalInterface.SystemEvent"/>s to main queue of the engine.
 /// </summary>
 /// <param name="results">The results.</param>
 public async Task AddToMainQueue(List <SystemEvent> results)
 {
     if (!EngineIsRunning)
     {
         throw new Exception("Engine is not running. Cannot add events to it.");
     }
     await Task.Run(() =>
     {
         foreach (var operationResult in results)
         {
             MainEventQueue.Enqueue(operationResult);
         }
     });
 }