private void ApplicationStart(object sender, StartupEventArgs e) { // unhandled exception events AppDomain.CurrentDomain.UnhandledException += (s, exception) => LogUnhandledException((Exception)exception.ExceptionObject, "AppDomain.CurrentDomain.UnhandledException"); DispatcherUnhandledException += (s, exception) => LogUnhandledException(exception.Exception, "Application.Current.DispatcherUnhandledException"); TaskScheduler.UnobservedTaskException += (s, exception) => LogUnhandledException(exception.Exception, "TaskScheduler.UnobservedException"); var splashScreen = new SplashScreen(@"Data\Graphics\mediconsplash-new.png"); splashScreen.Show(false); Current.ShutdownMode = ShutdownMode.OnExplicitShutdown; // show the initialisation window and begin checks ShowInitWindow(); Thread.Sleep(1000); // init should have completed - run MainWindow // instantiate GamesList object GamesList = new GameListBuilder(); MainWindow mw = new MedLaunch.MainWindow(); Current.ShutdownMode = ShutdownMode.OnMainWindowClose; Application.Current.MainWindow = mw; mw.Show(); // instantiate GamesList object //GamesList = new GameListBuilder(); splashScreen.Close(TimeSpan.FromSeconds(1)); // instantiate ScrapedContent Object ScrapedData = new GamesLibraryScrapedContent(); // set color scheme from database Tuple <AppTheme, Accent> appStyle = ThemeManager.DetectAppStyle(Application.Current); if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + @"Data\Settings\MedLaunch.db")) { // database already exists var gs = GlobalSettings.GetGlobals(); ThemeManager.ChangeAppStyle(Application.Current, ThemeManager.GetAccent(gs.colorAccent), ThemeManager.GetAppTheme(gs.colorBackground)); } else { // database hasnt been generated yet - set default ThemeManager.ChangeAppStyle(Application.Current, ThemeManager.GetAccent("Emerald"), ThemeManager.GetAppTheme("BaseDark")); } }
private void ApplicationStart(object sender, StartupEventArgs e) { // unhandled exception events AppDomain.CurrentDomain.UnhandledException += (s, exception) => LogUnhandledException((Exception)exception.ExceptionObject, "AppDomain.CurrentDomain.UnhandledException"); DispatcherUnhandledException += (s, exception) => LogUnhandledException(exception.Exception, "Application.Current.DispatcherUnhandledException"); TaskScheduler.UnobservedTaskException += (s, exception) => LogUnhandledException(exception.Exception, "TaskScheduler.UnobservedException"); /* is the OS x64 or x86? */ // determine windows install drive letter string letter = Path.GetPathRoot(Environment.GetFolderPath(Environment.SpecialFolder.System)); // test for /Program Files (x86) if (Directory.Exists(letter + @"Program Files (x86)")) { // assume this is x64 IsX86 = false; } else { // assume x86 IsX86 = true; } IsX86 = false; var splashScreen = new SplashScreen(@"Data\Graphics\mediconsplash-new.png"); splashScreen.Show(false); Current.ShutdownMode = ShutdownMode.OnExplicitShutdown; // Init the logparser instance Classes.LogParser.Init(); // Init the versions instance Classes.VersionChecker.Init(); // show the initialisation window and begin checks ShowInitWindow(); Thread.Sleep(1000); // init should have completed - run MainWindow // instantiate GamesList object GamesLibrary = new GamesLibraryViewModel(); MainWindow mw = new MedLaunch.MainWindow(); Current.ShutdownMode = ShutdownMode.OnMainWindowClose; Application.Current.MainWindow = mw; // show the main window mw.Show(); splashScreen.Close(TimeSpan.FromSeconds(1)); // set color scheme from database Tuple <AppTheme, Accent> appStyle = ThemeManager.DetectAppStyle(Application.Current); if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + @"Data\Settings\MedLaunch.db")) { // database already exists var gs = GlobalSettings.GetGlobals(); ThemeManager.ChangeAppStyle(Application.Current, ThemeManager.GetAccent(gs.colorAccent), ThemeManager.GetAppTheme(gs.colorBackground)); } else { // database hasnt been generated yet - set default ThemeManager.ChangeAppStyle(Application.Current, ThemeManager.GetAccent("Emerald"), ThemeManager.GetAppTheme("BaseDark")); } }