/// <summary> /// Import a Preset /// </summary> public void PresetImport() { VistaOpenFileDialog dialog = new VistaOpenFileDialog { Filter = "Plist (*.plist)|*.plist", CheckFileExists = true }; dialog.ShowDialog(); string filename = dialog.FileName; if (!string.IsNullOrEmpty(filename)) { EncodeTask parsed = PlistPresetHandler.Import(filename); if (this.presetService.CheckIfPresetExists(parsed.PresetName)) { if (!presetService.CanUpdatePreset(parsed.PresetName)) { MessageBox.Show( "You can not import a preset with the same name as a built-in preset.", "Error", MessageBoxButton.OK, MessageBoxImage.Error); return; } MessageBoxResult result = MessageBox.Show( "This preset appears to already exist. Would you like to overwrite it?", "Overwrite preset?", MessageBoxButton.YesNo, MessageBoxImage.Warning); if (result == MessageBoxResult.Yes) { Preset preset = new Preset { Name = parsed.PresetName, CropSettings = parsed.UsesPictureSettings, Task = parsed }; presetService.Update(preset); } } else { Preset preset = new Preset { Name = parsed.PresetName, Task = parsed, CropSettings = parsed.UsesPictureSettings, }; presetService.Add(preset); } this.NotifyOfPropertyChange("Presets"); } }
/// <summary> /// Export a Preset /// </summary> public void PresetExport() { VistaSaveFileDialog savefiledialog = new VistaSaveFileDialog { Filter = "plist|*.plist", CheckPathExists = true }; if (this.selectedPreset != null) { savefiledialog.ShowDialog(); string filename = savefiledialog.FileName; if (filename != null) { PlistPresetHandler.Export(savefiledialog.FileName, this.selectedPreset); } } else { MessageBox.Show("Please select a preset.", "Presets", MessageBoxButton.OK, MessageBoxImage.Warning); } }