diff options
Diffstat (limited to 'win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs')
-rw-r--r-- | win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs | 38 |
1 files changed, 24 insertions, 14 deletions
diff --git a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs index cf57289d2..3665c7acf 100644 --- a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs @@ -1685,27 +1685,37 @@ namespace HandBrakeWPF.ViewModels }
}
- Preset preset = PlistPresetFactory.CreatePreset(plist);
+ Preset preset = null;
+ try
+ {
+ preset = PlistPresetFactory.CreatePreset(plist);
+ }
+ catch (Exception exc)
+ {
+ this.errorService.ShowError(Resources.Main_PresetImportFailed, Resources.Main_PresetImportFailedSolution, exc);
+ }
- if (this.presetService.CheckIfPresetExists(preset.Name))
+ if (preset != null)
{
- if (!presetService.CanUpdatePreset(preset.Name))
+ if (this.presetService.CheckIfPresetExists(preset.Name))
{
- MessageBox.Show(Resources.Main_PresetErrorBuiltInName, Resources.Error, MessageBoxButton.OK, MessageBoxImage.Error);
- return;
- }
+ if (!presetService.CanUpdatePreset(preset.Name))
+ {
+ MessageBox.Show(Resources.Main_PresetErrorBuiltInName, Resources.Error, MessageBoxButton.OK, MessageBoxImage.Error);
+ return;
+ }
- MessageBoxResult result =
- MessageBox.Show(Resources.Main_PresetOverwriteWarning, Resources.Overwrite, MessageBoxButton.YesNo, MessageBoxImage.Warning);
- if (result == MessageBoxResult.Yes)
+ MessageBoxResult result = MessageBox.Show(Resources.Main_PresetOverwriteWarning, Resources.Overwrite, MessageBoxButton.YesNo, MessageBoxImage.Warning);
+ if (result == MessageBoxResult.Yes)
+ {
+ presetService.Update(preset);
+ }
+ }
+ else
{
- presetService.Update(preset);
+ presetService.Add(preset);
}
}
- else
- {
- presetService.Add(preset);
- }
this.NotifyOfPropertyChange(() => this.Presets);
}
|