private void presetSelecter_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (windowIsLoaded) { presetcollection.ActiveIndex = presetSelecter.SelectedIndex; PresetCollection.Save(presetcollection, baseDir); } if (presetcollection.ActiveIndex >= 0 && presetcollection.ActiveIndex < presetcollection.Presets.Count) { ApplyPresetItem(presetcollection.Presets[presetcollection.ActiveIndex]); } }
private void addPreset_Click(object sender, RoutedEventArgs e) { var inputDialog = new InputDialog(); if (inputDialog.ShowDialog() == true) { var presetname = inputDialog.PresetName; if (presetname != "") { if (presetcollection.Presets.Any(s => s.Name == presetname)) { MessageBox.Show("无法建立具有相同的名称的预设: " + presetname); return; } presetcollection.Presets.Add(Preset.GetPresentPreset(this, presetname)); presetcollection.ActiveIndex = presetcollection.Presets.Count - 1; presetSelecter.SelectedIndex = presetcollection.ActiveIndex; PresetCollection.Save(presetcollection, baseDir); } } }