diff options
author | sr55 <[email protected]> | 2012-11-18 14:47:09 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2012-11-18 14:47:09 +0000 |
commit | 3ac2e5d661c132980f526ba13772798e012ab155 (patch) | |
tree | 52b452e5addc901ca25fe90f22f76548f4be28d2 /win | |
parent | 45603634a4a50454a2fc15b9e0eed19469f58691 (diff) |
WinGui: Handle FileNotFound Exceptions with a nicer error message.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5069 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win')
-rw-r--r-- | win/CS/HandBrakeWPF/App.xaml.cs | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/win/CS/HandBrakeWPF/App.xaml.cs b/win/CS/HandBrakeWPF/App.xaml.cs index ec7bda6b0..b674aa7b6 100644 --- a/win/CS/HandBrakeWPF/App.xaml.cs +++ b/win/CS/HandBrakeWPF/App.xaml.cs @@ -33,7 +33,7 @@ namespace HandBrakeWPF {
Application.Current.Dispatcher.UnhandledException += this.Dispatcher_UnhandledException;
AppDomain.CurrentDomain.UnhandledException +=
- new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
+ this.CurrentDomain_UnhandledException;
}
/// <summary>
@@ -66,7 +66,15 @@ namespace HandBrakeWPF /// </param>
private void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
- this.ShowError(e.ExceptionObject);
+ if (e.ExceptionObject.GetType() == typeof(FileNotFoundException))
+ {
+ GeneralApplicationException exception = new GeneralApplicationException("A file appears to be missing.", "Try re-installing Microsoft .NET Framework 4.0", (Exception)e.ExceptionObject);
+ this.ShowError(exception);
+ }
+ else
+ {
+ this.ShowError(e.ExceptionObject);
+ }
}
/// <summary>
@@ -81,7 +89,12 @@ namespace HandBrakeWPF private void Dispatcher_UnhandledException(
object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
{
- if (e.Exception.GetType() == typeof(GeneralApplicationException))
+ if (e.Exception.GetType() == typeof(FileNotFoundException))
+ {
+ GeneralApplicationException exception = new GeneralApplicationException("A file appears to be missing.", "Try re-installing Microsoft .NET Framework 4.0", e.Exception);
+ this.ShowError(exception);
+ }
+ else if (e.Exception.GetType() == typeof(GeneralApplicationException))
{
this.ShowError(e.Exception);
}
|