Fix 'classicalsharp has crashed' dialog being shown multiple times in the launcher.

This commit is contained in:
UnknownShadow200 2016-01-27 12:44:23 +11:00
parent a362366ef4
commit 819dfc434f
2 changed files with 8 additions and 0 deletions

View File

@ -70,6 +70,7 @@ namespace Launcher2 {
}
void FocusedChanged( object sender, EventArgs e ) {
if( Program.ShowingErrorDialog ) return;
MakeBackground();
Screen.Resize();
}

View File

@ -10,13 +10,20 @@ namespace Launcher2 {
public static string AppDirectory;
public static bool ShowingErrorDialog = false;
[STAThread]
static void Main( string[] args ) {
AppDirectory = AppDomain.CurrentDomain.BaseDirectory;
string logPath = Path.Combine( AppDirectory, "launcher.log" );
AppDomain.CurrentDomain.UnhandledException += UnhandledExceptionHandler;
ErrorHandler.InstallHandler( logPath );
LauncherWindow window = new LauncherWindow();
window.Run();
}
static void UnhandledExceptionHandler( object sender, UnhandledExceptionEventArgs e ) {
ShowingErrorDialog = true;
}
}
}