예제 #1
0
        private async void App_Startup(object sender, StartupEventArgs e)
        {
            MainWindow = _splashScreen = new SplashScreen();

            _splashScreen.Show();

            UiDispatcher.Initialize();
            GeneralExceptionHandler.Instance = new UserFriendlyExceptionHandler();

#if DEBUG
            Tracer.RegisterListener(new ConsoleOutputEventListener());
#endif
            Tracer.RegisterListener(new FileLogEventListener(Path.Combine(ApplicationPaths.StoragePath, "debug.log")));

            _eventRegistry = new ApplicationEventRegistry();
            _container     = new Container();

            _mainWindow         = new MainWindow();
            _mainWindow.Loaded += OnMainWindowLoaded;

            await Task.WhenAll(RegisterServicesAsync());

            await Task.WhenAll(CheckForUpdatesAsync());

            await Task.WhenAll(UpdateDefinitionFilesAsync());

            _mainWindow.DataContext = _container.Resolve <MainWindowViewModel>();

            await Task.WhenAll(InitializePluginsAsync());

            await Task.WhenAll(FinalizeAppStartupAsync());

            await CheckFirstUseAsync();

            _splashScreen.Close();

            var settingsService = _container.Resolve <ILauncherSettingsService>();

            if (!settingsService.GetValue(LauncherCategories.Launcher, LauncherSettingKeys.AcknowledgedDisclaimer, false))
            {
                MessageBoxEx.Show($"DCS Alternative Launcher modifies files that exist in the DCS World game installation folder as well as your Saved Games folder.{Environment.NewLine}Please make sure you have backed up your data before using this software.{Environment.NewLine}{Environment.NewLine}You've been warned :).", "DISCLAIMER");
                settingsService.SetValue(LauncherCategories.Launcher, LauncherSettingKeys.AcknowledgedDisclaimer, true);
            }

            (MainWindow = _mainWindow).Show();

            await _eventRegistry.InvokeApplicationStartupCompleteAsync(this, DeferredEventArgs.CreateEmpty());

            Tracer.Info("Startup Complete.");
        }
예제 #2
0
        private async void App_Startup(object sender, StartupEventArgs e)
        {
            _splashScreen = new SplashScreen();
            MainWindow    = _splashScreen;
            _splashScreen.Show();

            UiDispatcher.Initialize();
            GeneralExceptionHandler.Instance = new UserFriendlyExceptionHandler();

#if DEBUG
            Tracer.RegisterListener(new ConsoleOutputEventListener());
#endif
            Tracer.RegisterListener(new FileLogEventListener(Path.Combine(ApplicationPaths.StoragePath, "debug.log")));

            _container  = new Container();
            _mainWindow = new MainWindow();

            await Task.WhenAll(UpdateDefinitionFilesAsync());

            await Task.WhenAll(RegisterServicesAsync(), Task.Delay(1000));

            await Task.WhenAll(CheckSettingsExistAsync(), Task.Delay(1000));

            CheckFirstUse();

            _mainWindow.DataContext = new MainWindowViewModel(_container);
            _mainWindow.Loaded     += _mainWindow_Loaded;

            await Task.WhenAll(InitializePluginsAsync(), Task.Delay(1000));

            _splashScreen.Close();
            MainWindow = _mainWindow;
            _mainWindow.Show();

            Tracer.Info("Startup Complete.");
            Tracker.Instance.SendEvent(AnalyticsCategories.AppLifecycle, AnalyticsEvents.StartupComplete, Version.ToString());
        }