public static void SaveSettings(SettingsModel settings)
        {
            var settingsDocument = CreateBlankXDocument();

            settingsDocument.Root.SetElementValue(Xml_MidiInputDeviceNameElement, settings.MidiInputDeviceName);
            settingsDocument.Root.Element(Xml_ProfileElement).Add(ConvertMappingsToXElements(settings.MidiMappingProfile));

            settingsDocument.Save(GetSettingsFileName());
        }
        public static SettingsModel LoadSettings()
        {
            string fileContents = File.ReadAllText(GetSettingsFileName());
            var settingsDocument = XDocument.Parse(fileContents);

            var settings = new SettingsModel();
            settings.MidiInputDeviceName = settingsDocument.Root.Element(Xml_MidiInputDeviceNameElement).Value;
            settings.MidiMappingProfile = LoadProfileFromXElement(settingsDocument.Root.Element(Xml_ProfileElement));

            return settings;
        }
Пример #3
0
        private void BindData(SettingsModel newSettings)
        {
            cmbMidiInputDevice.DataSource = InputDevice.InstalledDevices;
            settings = newSettings;

            foreach (var midiDevice in InputDevice.InstalledDevices.Where(dev => dev.Name == settings.MidiInputDeviceName))
            {
                cmbMidiInputDevice.SelectedItem = midiDevice;
                break;
            }
            LoadMappings();
        }
Пример #4
0
 public void ApplySettingsToUI(SettingsModel newSettings)
 {
     BindData(newSettings);
 }
 public void ApplySettingsToUI(SettingsModel newSettings)
 {
     BindData(newSettings);
 }
Пример #6
0
 private void LoadSettings()
 {
     settings       = SettingsPersistenceManager.LoadSettings();
     mappingMatcher = new MidiMappingMatcher(settings.MidiMappingProfile);
 }
Пример #7
0
 private void LoadSettings()
 {
     settings = SettingsPersistenceManager.LoadSettings();
     mappingMatcher = new MidiMappingMatcher(settings.MidiMappingProfile);
 }