summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsr55 <[email protected]>2014-11-15 17:57:45 +0000
committersr55 <[email protected]>2014-11-15 17:57:45 +0000
commit38ec1ddd1774cd30c94e8894def48334db9c088e (patch)
tree6a03bc6690e08e744d3d0d6360c5024c14dd21a3
parent178055daedba376d07f8bf83046aa5dac4ed9e36 (diff)
WinGui: Improve the error message when importing a preset fails.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6521 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r--win/CS/HandBrakeWPF/Properties/Resources.Designer.cs19
-rw-r--r--win/CS/HandBrakeWPF/Properties/Resources.resx7
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs38
-rw-r--r--win/CS/HandBrakeWPF/Views/ErrorView.xaml10
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"