/// <summary> /// Opens a new settings window or destroys and recreates one if it is already open. /// Additionally we initiallise some of the data required for the bindings in the settings (Populate the midi devices). /// </summary> public void OpenSettingsWindow() { if (settingsWindow?.IsVisible ?? false)//if a settings window is already visible close it and make a new one { settingsWindow.Close(); } settingsWindow = new SettingsWindow(); settingsWindow.DataContext = this; settingsWindow.Show(); //Get available midi devices MidiInputDevices.Clear(); foreach (IMidiPortDetails device in MidiManager.GetMidiInputDevices()) { MidiInputDevices.Add(device); } MidiOutputDevices.Clear(); foreach (IMidiPortDetails device in MidiManager.GetMidiOutputDevices()) { MidiOutputDevices.Add(device); } }