/// <summary>
 /// A notification that an API call has been intercepted.
 /// This is called in the UI thread.
 /// </summary>
 /// <param name="symbol">The symbol of the intercepted API call</param>
 private void InterceptAPICallInUIThread(IMonitorAPISession symbol)
 {
     this.ApiCallCount++;
     if (this.TestPassing)
     {
         this.TestPassing = false;
         SystemSounds.Beep.Play(); // Play system beep sound on bad output encountered.
     }
 }
 /// <summary>
 /// A notification that an API call has been intercepted.
 /// This is NOT called in the UI thread.
 /// </summary>
 /// <param name="symbol">The symbol of the intercepted API call</param>
 private void InterceptAPICall(IMonitorAPISession symbol)
 {
     try
     {
         Dispatcher dispatcher = this.debugOutputWindow.Dispatcher;
         if (dispatcher != null)
         {
             dispatcher.BeginInvoke(new Action(() => { this.InterceptAPICallInUIThread(symbol); }), DispatcherPriority.ApplicationIdle);
         }
     }
     catch (TaskCanceledException)
     {
         // Don't complain about late arrival if UI has already gone away
     }
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="DebugOutputMonitorAPISession" /> class.
 /// </summary>
 /// <param name="viewModel">A reference to our view model</param>
 /// <param name="monitorAPISession">The symbol monitoring session</param>
 /// <param name="canRemove">Whether or not this symbol can be removed from monitoring</param>
 public DebugOutputMonitorAPISession(DebugOutputViewModel viewModel, IMonitorAPISession monitorAPISession, bool canRemove)
 {
     this.ViewModel         = viewModel;
     this.MonitorAPISession = monitorAPISession;
     this.CanRemove         = canRemove;
 }