mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 19:57:57 +01:00
Add global unhandled exception check.
This commit is contained in:
@@ -45,6 +45,9 @@ namespace Wox
|
|||||||
public MainWindow()
|
public MainWindow()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
|
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
|
||||||
|
|
||||||
progressBar.ToolTip = toolTip;
|
progressBar.ToolTip = toolTip;
|
||||||
InitialTray();
|
InitialTray();
|
||||||
resultCtrl.OnMouseClickItem += AcceptSelect;
|
resultCtrl.OnMouseClickItem += AcceptSelect;
|
||||||
@@ -64,6 +67,19 @@ namespace Wox
|
|||||||
SetCustomPluginHotkey();
|
SetCustomPluginHotkey();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
|
||||||
|
{
|
||||||
|
if (!System.Diagnostics.Debugger.IsAttached)
|
||||||
|
{
|
||||||
|
string error = "Wox has an error that can't be handled. " + e.ExceptionObject;
|
||||||
|
Log.Error(error);
|
||||||
|
if (e.IsTerminating)
|
||||||
|
{
|
||||||
|
MessageBox.Show(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void SetHotkey(string hotkeyStr, EventHandler<HotkeyEventArgs> action)
|
public void SetHotkey(string hotkeyStr, EventHandler<HotkeyEventArgs> action)
|
||||||
{
|
{
|
||||||
var hotkey = new HotkeyModel(hotkeyStr);
|
var hotkey = new HotkeyModel(hotkeyStr);
|
||||||
|
|||||||
Reference in New Issue
Block a user