void midiDeviceCtrl1_OnDeviceSelected(DmxFramework.Midi.Device pDev) { if (mDevice != null) { mDevice.Stop(); mDevice.OnMidiValueChanged -= this.mDevice_OnMidiValueChanged; } mDevice = pDev; mDevice.Subscribe(); mDevice.Start(); mDevice.OnMidiValueChanged += new OnMidiValueChangedDelegate(mDevice_OnMidiValueChanged); }