private void HandleMessage(int handle, int msg, int instance, int param1, int param2) { if (msg == MIM_OPEN) { } else if (msg == MIM_CLOSE) { } else if (msg == MIM_DATA) { delegateQueue.Post(HandleShortMessage, param1); } else if (msg == MIM_MOREDATA) { delegateQueue.Post(HandleShortMessage, param1); } else if (msg == MIM_LONGDATA) { delegateQueue.Post(HandleSysExMessage, new IntPtr(param1)); } else if (msg == MIM_ERROR) { delegateQueue.Post(HandleInvalidShortMessage, param1); } else if (msg == MIM_LONGERROR) { delegateQueue.Post(HandleInvalidSysExMessage, new IntPtr(param1)); } }
// Handles Windows messages. protected virtual void HandleMessage(IntPtr handle, int msg, int instance, int param1, int param2) { if (msg == MOM_OPEN) { } else if (msg == MOM_CLOSE) { } else if (msg == MOM_DONE) { delegateQueue.Post(ReleaseBuffer, new IntPtr(param1)); } }
// Handles Windows messages. protected virtual void HandleMessage(IntPtr hnd, int msg, IntPtr instance, IntPtr param1, IntPtr param2) { if (msg == MOM_OPEN) { } else if (msg == MOM_CLOSE) { } else if (msg == MOM_DONE) { delegateQueue.Post(ReleaseBuffer, param1); } }
/// <summary> /// Sends an event to the StateMachine. /// </summary> /// <param name="eventID"> /// The event ID. /// </param> /// <param name="args"> /// The data accompanying the event. /// </param> public override void Send(int eventID, params object[] args) { #region Require if (!IsInitialized) { throw new InvalidOperationException(); } else if (IsDisposed) { throw new ObjectDisposedException("ActiveStateMachine"); } #endregion queue.Post(delegate(object state) { Dispatch(eventID, args); }, null); }