/// <summary> /// Initializes a new instance of the <see cref="ActiveStateMachine{TState,TEvent,TArgs}"/> class. /// </summary> /// <param name="syncContext">The synchronization context.</param> /// <param name="comparer"> </param> /// <param name="stateStorage"> </param> protected ActiveStateMachine(SynchronizationContext syncContext, IEqualityComparer <TEvent> comparer = null, IStateStorage <TState> stateStorage = null) : base(comparer, stateStorage) { SyncContext = syncContext; queue = new DelegateQueue(); queue.PostCompleted += raiseExceptionEventOnError; queue.InvokeCompleted += raiseExceptionEventOnError; }
/// <summary> /// Initializes a new instance of the InputDevice class with the /// specified device ID. /// </summary> public InputDevice(int deviceID) : base(deviceID) { midiInProc = HandleMessage; delegateQueue = new DelegateQueue(); int result = midiInOpen(out handle, deviceID, midiInProc, 0, CALLBACK_FUNCTION); System.Diagnostics.Debug.WriteLine("MidiIn handle:" + handle.ToInt64()); if (result != MidiDeviceException.MMSYSERR_NOERROR) { throw new InputDeviceException(result); } }
/// <summary> /// Initializes a new instance of the InputDevice class with the /// specified device ID. /// </summary> public InputDevice(int deviceID) : base(deviceID) { midiInProc = HandleMessage; int result = midiInOpen(ref handle, deviceID, midiInProc, 0, CALLBACK_FUNCTION); if (result == MidiDeviceException.MMSYSERR_NOERROR) { delegateQueue = new DelegateQueue(); } else { throw new InputDeviceException(result); } }
/// <summary> /// Initializes a new instance of the InputDevice class with the /// specified device ID. /// </summary> public InputDevice(int deviceID, SynchronizationContext context) : base(deviceID) { this.context = context; midiInProc = HandleMessage; int result = midiInOpen(out handle, deviceID, midiInProc, 0, CALLBACK_FUNCTION); if (result == MidiDeviceException.MMSYSERR_NOERROR) { delegateQueue = new DelegateQueue(); } else { throw new InputDeviceException(result); } }
/// <summary> /// Initializes a new instance of the InputDevice class with the /// specified device ID. /// </summary> public InputDevice(int deviceID, bool postEventsOnCreationContext = true, bool postDriverCallbackToDelegateQueue = true) : base(deviceID) { midiInProc = HandleMessage; delegateQueue = new DelegateQueue(); int result = midiInOpen(out handle, deviceID, midiInProc, IntPtr.Zero, CALLBACK_FUNCTION); System.Diagnostics.Debug.WriteLine("MidiIn handle:" + handle.ToInt64()); if (result != MidiDeviceException.MMSYSERR_NOERROR) { throw new InputDeviceException(result); } PostEventsOnCreationContext = postEventsOnCreationContext; PostDriverCallbackToDelegateQueue = postDriverCallbackToDelegateQueue; }