diff options
-rw-r--r-- | win/CS/HandBrakeWPF/Properties/Resources.Designer.cs | 19 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Properties/Resources.resx | 7 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs | 38 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Views/ErrorView.xaml | 10 |
4 files changed, 55 insertions, 19 deletions
diff --git a/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs b/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs index 3759f9eae..b452cf9f9 100644 --- a/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs +++ b/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs @@ -500,6 +500,25 @@ namespace HandBrakeWPF.Properties { }
/// <summary>
+ /// Looks up a localized string similar to Unable to import the selected preset..
+ /// </summary>
+ public static string Main_PresetImportFailed {
+ get {
+ return ResourceManager.GetString("Main_PresetImportFailed", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to The preset may be corrupted or from an older version of HandBrake which is not supported.
+ ///Presets from older versions must be re-created in the current version..
+ /// </summary>
+ public static string Main_PresetImportFailedSolution {
+ get {
+ return ResourceManager.GetString("Main_PresetImportFailedSolution", resourceCulture);
+ }
+ }
+
+ /// <summary>
/// Looks up a localized string similar to This preset appears to already exist. Would you like to overwrite it?.
/// </summary>
public static string Main_PresetOverwriteWarning {
diff --git a/win/CS/HandBrakeWPF/Properties/Resources.resx b/win/CS/HandBrakeWPF/Properties/Resources.resx index 8e4c82d29..c74324d6a 100644 --- a/win/CS/HandBrakeWPF/Properties/Resources.resx +++ b/win/CS/HandBrakeWPF/Properties/Resources.resx @@ -536,4 +536,11 @@ Not both at the same time!</value> <data name="Main_UnableToLoadHelpSolution" xml:space="preserve">
<value>You can still access the help pages by visiting the website directly at: https://handbrake.fr</value>
</data>
+ <data name="Main_PresetImportFailed" xml:space="preserve">
+ <value>Unable to import the selected preset.</value>
+ </data>
+ <data name="Main_PresetImportFailedSolution" xml:space="preserve">
+ <value>The preset may be corrupted or from an older version of HandBrake which is not supported.
+Presets from older versions must be re-created in the current version.</value>
+ </data>
</root>
\ No newline at end of file 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);
}
diff --git a/win/CS/HandBrakeWPF/Views/ErrorView.xaml b/win/CS/HandBrakeWPF/Views/ErrorView.xaml index 95b6e85cb..54cb7a2e6 100644 --- a/win/CS/HandBrakeWPF/Views/ErrorView.xaml +++ b/win/CS/HandBrakeWPF/Views/ErrorView.xaml @@ -10,10 +10,10 @@ Style="{StaticResource windowStyle}"
FontSize="11"
TextOptions.TextFormattingMode="Display"
- WindowStartupLocation="CenterScreen">
+ WindowStartupLocation="CenterOwner">
<Grid>
<Grid.RowDefinitions>
- <RowDefinition Height="70" />
+ <RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
@@ -35,9 +35,9 @@ <Image Width="64"
Height="64"
- Margin="10,0,0,0"
+ Margin="10,4,0,4"
Source="Images/ErrorX.png" />
- <Grid Height="64" Margin="10,0,0,0">
+ <Grid Margin="10,0,0,0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
@@ -49,7 +49,7 @@ Text="{Binding ErrorMessage}" />
<TextBlock Grid.Row="1"
Margin="0,5,0,0"
- Text="{Binding Solution}" />
+ Text="{Binding Solution}" TextWrapping="Wrap" />
<TextBlock Grid.Row="2"
Margin="0,0,0,2"
|