private void CleanUp() { // <SnippetCleanUp> inputDeviceWatcher.StopWatcher(); inputDeviceWatcher = null; outputDeviceWatcher.StopWatcher(); outputDeviceWatcher = null; midiInPort.MessageReceived -= MidiInPort_MessageReceived; midiInPort.Dispose(); midiInPort = null; midiOutPort.Dispose(); midiOutPort = null; // </SnippetCleanUp> }
// </SnippetEnumerateMidiOutputDevices> private void startButton_Click(object sender, RoutedEventArgs e) { //EnumerateMidiInputDevices(); //EnumerateMidiOutputDevices(); // <SnippetStartWatchers> inputDeviceWatcher = new MyMidiDeviceWatcher(MidiInPort.GetDeviceSelector(), midiInPortListBox, Dispatcher); inputDeviceWatcher.StartWatcher(); outputDeviceWatcher = new MyMidiDeviceWatcher(MidiOutPort.GetDeviceSelector(), midiOutPortListBox, Dispatcher); outputDeviceWatcher.StartWatcher(); // </SnippetStartWatchers> }