wpf error handling

This commit is contained in:
Frank Skare
2021-04-30 15:09:31 +02:00
parent 0343b32847
commit 642c36bacf
2 changed files with 5 additions and 2 deletions

View File

@@ -2,7 +2,7 @@
using System; using System;
using System.Windows; using System.Windows;
namespace WPF namespace mpvnet
{ {
public class WPF public class WPF
{ {
@@ -15,6 +15,8 @@ namespace WPF
Application.Current.Resources.MergedDictionaries.Add( Application.Current.Resources.MergedDictionaries.Add(
Application.LoadComponent(new Uri("mpvnet;component/WPF/Resources.xaml", Application.LoadComponent(new Uri("mpvnet;component/WPF/Resources.xaml",
UriKind.Relative)) as ResourceDictionary); UriKind.Relative)) as ResourceDictionary);
Application.Current.DispatcherUnhandledException += (sender, e) => App.ShowException(e.Exception);
} }
} }
} }

View File

@@ -86,6 +86,7 @@ namespace mpvnet
AppDomain.CurrentDomain.UnhandledException += (sender, e) => App.ShowException(e.ExceptionObject); AppDomain.CurrentDomain.UnhandledException += (sender, e) => App.ShowException(e.ExceptionObject);
Application.ThreadException += (sender, e) => App.ShowException(e.Exception); Application.ThreadException += (sender, e) => App.ShowException(e.Exception);
Msg.SupportURL = "https://github.com/stax76/mpv.net#support"; Msg.SupportURL = "https://github.com/stax76/mpv.net#support";
TaskbarButtonCreatedMessage = RegisterWindowMessage("TaskbarButtonCreated"); TaskbarButtonCreatedMessage = RegisterWindowMessage("TaskbarButtonCreated");
@@ -844,7 +845,7 @@ namespace mpvnet
BuildMenu(); BuildMenu();
ContextMenuStrip = ContextMenu; ContextMenuStrip = ContextMenu;
WPF.WPF.Init(); WPF.Init();
System.Windows.Application.Current.ShutdownMode = System.Windows.ShutdownMode.OnExplicitShutdown; System.Windows.Application.Current.ShutdownMode = System.Windows.ShutdownMode.OnExplicitShutdown;
Cursor.Position = new Point(Cursor.Position.X + 1, Cursor.Position.Y); Cursor.Position = new Point(Cursor.Position.X + 1, Cursor.Position.Y);
MinimumSize = new Size(FontHeight * 9, FontHeight * 9); MinimumSize = new Size(FontHeight * 9, FontHeight * 9);