]> granicus.if.org Git - handbrake/commitdiff
WinGui: Handle FileNotFound Exceptions with a nicer error message.
authorsr55 <sr55.hb@outlook.com>
Sun, 18 Nov 2012 14:47:09 +0000 (14:47 +0000)
committersr55 <sr55.hb@outlook.com>
Sun, 18 Nov 2012 14:47:09 +0000 (14:47 +0000)
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5069 b64f7644-9d1e-0410-96f1-a4d463321fa5

win/CS/HandBrakeWPF/App.xaml.cs

index ec7bda6b0af5a0cc36f05a8823da8fc30fabdfdc..b674aa7b678b17a187e2b6e98ef60bb29b826d02 100644 (file)
@@ -33,7 +33,7 @@ namespace HandBrakeWPF
         {\r
             Application.Current.Dispatcher.UnhandledException += this.Dispatcher_UnhandledException;\r
             AppDomain.CurrentDomain.UnhandledException +=\r
-                new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);\r
+                this.CurrentDomain_UnhandledException;\r
         }\r
 \r
         /// <summary>\r
@@ -66,7 +66,15 @@ namespace HandBrakeWPF
         /// </param>\r
         private void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)\r
         {\r
-            this.ShowError(e.ExceptionObject);\r
+            if (e.ExceptionObject.GetType() == typeof(FileNotFoundException))\r
+            {\r
+                GeneralApplicationException exception = new GeneralApplicationException("A file appears to be missing.", "Try re-installing Microsoft .NET Framework 4.0", (Exception)e.ExceptionObject);\r
+                this.ShowError(exception);\r
+            }\r
+            else\r
+            {\r
+                this.ShowError(e.ExceptionObject);\r
+            }\r
         }\r
 \r
         /// <summary>\r
@@ -81,7 +89,12 @@ namespace HandBrakeWPF
         private void Dispatcher_UnhandledException(\r
             object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)\r
         {\r
-            if (e.Exception.GetType() == typeof(GeneralApplicationException))\r
+            if (e.Exception.GetType() == typeof(FileNotFoundException))\r
+            {\r
+                GeneralApplicationException exception = new GeneralApplicationException("A file appears to be missing.", "Try re-installing Microsoft .NET Framework 4.0", e.Exception);\r
+                this.ShowError(exception);\r
+            }\r
+            else if (e.Exception.GetType() == typeof(GeneralApplicationException))\r
             {\r
                 this.ShowError(e.Exception);\r
             }\r