Beispiel #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);
            }
        }
Beispiel #2
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);
            }
        }