Exemple #1
0
        private void CheckFirstUse()
        {
            var settingsService        = _container.Resolve <ISettingsService>();
            var profileSettingsService = _container.Resolve <IProfileSettingsService>();

            if (profileSettingsService.SelectedProfile == null)
            {
                using (var container = _container.GetChildContainer())
                {
                    container.Register <WizardController>().AsSingleton();

                    var wizard = new Wizard();

                    var steps = new WizardStepBase[]
                    {
                        new FirstUseWelcomeStepViewModel(container),
                        new InstallationsWizardStepViewModel(container),
                        new CreateProfileWizardStepViewModel(container),
                    };

                    var viewModel = new WizardViewModel(container, steps);

                    Current.MainWindow = wizard;

                    _splashScreen.Hide();

                    wizard.DataContext = viewModel;
                    wizard.ShowDialog();

                    _splashScreen.Show();
                }

                settingsService.SetValue(SettingsCategories.Launcher, SettingsKeys.IsFirstUseComplete, true);
            }
        }
Exemple #2
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.");
        }
Exemple #3
0
        private async Task CheckFirstUseAsync()
        {
            var settingsService        = _container.Resolve <ILauncherSettingsService>();
            var profileSettingsService = _container.Resolve <IProfileService>();
            var eventRegistry          = _container.Resolve <ApplicationEventRegistry>();

            if (!File.Exists(Path.Combine(ApplicationPaths.StoragePath, "settings.json")) ||
                string.IsNullOrEmpty(profileSettingsService.SelectedProfileName))
            {
                using (var container = _container.GetChildContainer())
                {
                    container.Register <WizardController>().AsSingleton();

                    var wizard = new Wizard();
                    var steps  = new List <WizardStepBase>
                    {
                        new FirstUseWelcomeStepViewModel(container),
                        new CreateProfileWizardStepViewModel(container),
                        new InstallationsWizardStepViewModel(container),
                    };

                    var eventArgs = new AppendFirstUseWizardStepsEventArgs();

                    await eventRegistry.InvokeAppendFirstUseWizardStepsAsync(this, eventArgs);

                    steps.AddRange(eventArgs.Steps);

                    var viewModel = new WizardViewModel(container, steps.ToArray());

                    Current.MainWindow = wizard;

                    _splashScreen.Hide();

                    wizard.DataContext = viewModel;
                    wizard.ShowDialog();

                    _splashScreen.Show();
                }

                settingsService.SetValue(LauncherCategories.Launcher, LauncherSettingKeys.IsFirstUseComplete, true);
            }
        }
Exemple #4
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());
        }