private void CreateViewModels()
        {
            this.viewModels = new Dictionary <Type, DlgBaseVM>();

            this.progressDlgVM   = new ProgressDlgVM(this.bootstrapper, this.guiService);
            this.userCancelDlgVM = new UserCancelDlgVM(this.bootstrapper, this.guiService);
            this.errorDlgVM      = new ErrorDlgVM(this.bootstrapper, this.guiService);
            this.finishedDlgVM   = new FinishedDlgVM(this.bootstrapper, this.guiService);

            if (!this.bootstrapper.OSAndBundleBitMatch)
            {
                BitErrorDlgVM bitErrorDlgVM = new BitErrorDlgVM(this.bootstrapper, this.guiService);
                this.viewModels.Add(typeof(BitErrorDlgVM), bitErrorDlgVM);
                this.CurrentViewModel = bitErrorDlgVM;
            }
            else if (this.bootstrapper.IsUpgrade)
            {
                UpgradeDlgVM upgradeDlgVM = new UpgradeDlgVM(this.bootstrapper, this.guiService, this.uacService);
                this.viewModels.Add(typeof(UpgradeDlgVM), upgradeDlgVM);
                this.CurrentViewModel = upgradeDlgVM;
            }
            else if (this.bootstrapper.HasRelatedBundle)
            {
                DowngradeDlgVM downgradeDlgVM = new DowngradeDlgVM(this.bootstrapper, this.guiService);
                this.viewModels.Add(typeof(DowngradeDlgVM), downgradeDlgVM);
                this.CurrentViewModel = downgradeDlgVM;
            }
            else
            {
                LaunchAction launchAction = this.bootstrapper.LaunchAction;

                switch (launchAction)
                {
                case LaunchAction.Install:
                    this.viewModels.Add(typeof(WelcomeDlgVM), new WelcomeDlgVM(this.bootstrapper, this.guiService));
                    this.viewModels.Add(typeof(LicenseDlgVM), new LicenseDlgVM(this.bootstrapper, this.guiService));
                    this.viewModels.Add(typeof(CustomizeDlgVM), new CustomizeDlgVM(this.bootstrapper, this.guiService));
                    this.viewModels.Add(typeof(ReadyDlgVM), new ReadyDlgVM(this.bootstrapper, this.guiService, this.uacService));
                    this.CurrentViewModel = this.viewModels[typeof(WelcomeDlgVM)];
                    break;

                case LaunchAction.Uninstall:
                    UninstallDlgVM uninstallDlgVM = new UninstallDlgVM(this.bootstrapper, this.guiService, this.uacService);
                    this.viewModels.Add(typeof(UninstallDlgVM), uninstallDlgVM);
                    this.CurrentViewModel = uninstallDlgVM;
                    break;

                default:
                    throw new ApplicationException("Unsupported LaunchAction '" + this.bootstrapper.LaunchAction.ToString() + "'!");
                }
            }
        }
Exemplo n.º 2
0
        private void CreateViewModels()
        {
            _viewModels = new Dictionary <Type, DlgBaseVM>();

            _progressDlgVM   = new ProgressDlgVM(_bootstrapper, _guiService);
            _userCancelDlgVM = new UserCancelDlgVM(_bootstrapper, _guiService);
            _errorDlgVM      = new ErrorDlgVM(_bootstrapper, _guiService);
            _finishedDlgVM   = new FinishedDlgVM(_bootstrapper, _guiService);

            if (!Environment.Is64BitOperatingSystem)
            {
                BitErrorDlgVM bitErrorDlgVM = new BitErrorDlgVM(_bootstrapper, _guiService);
                _viewModels.Add(typeof(BitErrorDlgVM), bitErrorDlgVM);
                _currentViewModel = bitErrorDlgVM;
            }
            else if (_bootstrapper.IsUpgrade)
            {
                UpgradeDlgVM upgradeDlgVM = new UpgradeDlgVM(_bootstrapper, _guiService, _uacService);
                _viewModels.Add(typeof(UpgradeDlgVM), upgradeDlgVM);
                _currentViewModel = upgradeDlgVM;
            }
            else if (_bootstrapper.HasRelatedBundle)
            {
                DowngradeDlgVM downgradeDlgVM = new DowngradeDlgVM(_bootstrapper, _guiService);
                _viewModels.Add(typeof(DowngradeDlgVM), downgradeDlgVM);
                _currentViewModel = downgradeDlgVM;
            }
            else
            {
                LaunchAction launchAction = _bootstrapper.LaunchAction;

                switch (launchAction)
                {
                case LaunchAction.Install:
                    _viewModels.Add(typeof(WelcomeDlgVM), new WelcomeDlgVM(_bootstrapper, _guiService));
                    _viewModels.Add(typeof(LicenseDlgVM), new LicenseDlgVM(_bootstrapper, _guiService));
                    _viewModels.Add(typeof(CustomizeDlgVM), new CustomizeDlgVM(_bootstrapper, _guiService));
                    _viewModels.Add(typeof(ReadyDlgVM), new ReadyDlgVM(_bootstrapper, _guiService, _uacService));
                    _currentViewModel = _viewModels[typeof(WelcomeDlgVM)];
                    break;

                case LaunchAction.Uninstall:
                    UninstallDlgVM uninstallDlgVM = new UninstallDlgVM(_bootstrapper, _guiService, _uacService);
                    _viewModels.Add(typeof(UninstallDlgVM), uninstallDlgVM);
                    _currentViewModel = uninstallDlgVM;
                    break;

                default:
                    throw new ApplicationException("Unsupported LaunchAction '" + _bootstrapper.LaunchAction.ToString() + "'!");
                }
            }
        }