fix Availability Statistics

This commit is contained in:
Gang Zhuo
2016-03-04 21:44:54 +08:00
parent b3ce1c698a
commit 8d863f1d5f
2 changed files with 98 additions and 27 deletions
+9
View File
@@ -21,6 +21,7 @@ namespace Shadowsocks
Utils.ReleaseMemory(true);
using (Mutex mutex = new Mutex(false, "Global\\Shadowsocks_" + Application.StartupPath.GetHashCode()))
{
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
@@ -53,5 +54,13 @@ namespace Shadowsocks
Application.Run();
}
}
private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
Logging.Error(e.ExceptionObject?.ToString());
MessageBox.Show($"Unexpect error, shadowsocks exited.{Environment.NewLine} {e.ExceptionObject?.ToString()}",
"Shadowsocks", MessageBoxButtons.OK, MessageBoxIcon.Error);
Application.Exit();
}
}
}