close #47 Add log level config

This commit is contained in:
qianlifeng
2014-03-23 17:43:46 +08:00
parent 3dbef1400c
commit 61c1232690
6 changed files with 40 additions and 9 deletions

View File

@@ -73,7 +73,7 @@ namespace Wox
globalHotkey.hookedKeyboardCallback += KListener_hookedKeyboardCallback;
this.Closing += new System.ComponentModel.CancelEventHandler(MainWindow_Closing);
this.Closing += MainWindow_Closing;
}
void MainWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
@@ -93,6 +93,8 @@ namespace Wox
//DwmDropShadow.DropShadowToWindow(this);
WindowIntelopHelper.DisableControlBox(this);
throw new Exception();
}
private void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
@@ -100,11 +102,15 @@ namespace Wox
if (!System.Diagnostics.Debugger.IsAttached)
{
string error = "Wox has an error that can't be handled. " + e.ExceptionObject;
Log.Error(error);
if (e.IsTerminating)
{
notifyIcon.Visible = false;
MessageBox.Show(error);
Log.Fatal(error);
}
else
{
Log.Error(error);
}
}
}