private void DispatcherThread() { // infinite loop until the thread is aborted while (true) { // blocking Dequeue with inifinite wait NativeEventData data = this.EventQueue.Dequeue(); if (this.OnHalEvent != null) { try { OnHalEvent(data.data1, data.data2, data.TimeStamp); } catch (Exception ex) { System.Diagnostics.Debug.Print("Exception in OnHalEvent Handler: " + ex.ToString()); } } } }
/// <summary>Adds event data into the queue</summary> /// <param name="EventData">Data to add to the queue</param> /// <remarks> /// Normally event data is added to the queue internaly in response to /// a native code event callback. This method allows an application to /// "stuff" event data into a queue. This can be useful for unit testing /// and other such scenarios. /// </remarks> public void Enqueue( NativeEventData EventData ) { ThrowIfDisposed(); this.Q.Enqueue( EventData ); }
/// <summary>Adds event data into the queue</summary> /// <param name="EventData">Data to add to the queue</param> /// <remarks> /// Normally event data is added to the queue internaly in response to /// a native code event callback. This method allows an application to /// "stuff" event data into a queue. This can be useful for unit testing /// and other such scenarios. /// </remarks> public void Enqueue(NativeEventData EventData) { ThrowIfDisposed(); this.Q.Enqueue(EventData); }