Пример #1
0
        public WizardWindowVM(SetupApplication bootstrapper, IGuiService guiService, IUacService uacService)
        {
            if (bootstrapper == null)
            {
                throw new ArgumentNullException("bootstrapper");
            }

            if (guiService == null)
            {
                throw new ArgumentNullException("guiService");
            }

            if (uacService == null)
            {
                throw new ArgumentNullException("uacService");
            }

            this.bootstrapper = bootstrapper;
            this.guiService   = guiService;
            this.uacService   = uacService;

            this.bootstrapper.CancelProgressRequestedChanged += bootstrapper_CancelProgressRequestedChanged;

            this.CreateViewModels();
        }
Пример #2
0
        public UpgradeDlgVM(SetupApplication bootstrapper, IGuiService guiService, IUacService uacService)
            : base(bootstrapper, guiService)
        {
            _uacService = uacService;

            _productName = _bootstrapper.ProductName;
            _oldVersion  = _bootstrapper.RelatedBundleVersion.ToString();
            _newVersion  = _bootstrapper.ProductVersionTrimmed.ToString();
        }
Пример #3
0
        public WizardWindowVM(SetupApplication bootstrapper, IGuiService guiService, IUacService uacService)
        {
            _bootstrapper = bootstrapper ?? throw new ArgumentNullException("bootstrapper");
            _guiService   = guiService ?? throw new ArgumentNullException("guiService");
            _uacService   = uacService ?? throw new ArgumentNullException("uacService");

            _bootstrapper.CancelProgressRequestedChanged += Bootstrapper_CancelProgressRequestedChanged;

            CreateViewModels();
        }
Пример #4
0
 public ReadyDlgVM(SetupApplication bootstrapper, IGuiService guiService, IUacService uacService)
     : base(bootstrapper, guiService)
 {
     this.uacService = uacService;
 }
        protected override void Run()
        {
            try
            {
                this.launchAction = this.Command.Action;

                if (this.launchAction != LaunchAction.Install &&
                    this.launchAction != LaunchAction.Uninstall)
                {
                    this.Log("This installer can only run in install or uninstall mode!");
                    this.Engine.Quit((int)ActionResult.NotExecuted);
                    return;
                }

                if (!this.IsFullUiMode && !this.IsQuietUninstall)
                {
                    this.Log("This installer can only run in full UI mode!");
                    this.Engine.Quit((int)ActionResult.NotExecuted);
                    return;
                }

                this.Initialize();

                this.detectCompleteHandle = new AutoResetEvent(false);
                this.applyCompleteHandle  = new AutoResetEvent(false);

                this.InvokeDetect();

                if (this.IsQuietUninstall)
                {
                    this.Log("Installer is running in quiet uninstall mode");

                    this.Log("Waiting for detection to complete");
                    detectCompleteHandle.WaitOne();

                    this.InvokePlan();

                    this.Log("Waiting for execution to complete");
                    applyCompleteHandle.WaitOne();
                }
                else
                {
                    this.Log("Installer is running in full UI mode");

                    this.Log("Waiting for detection to complete");
                    detectCompleteHandle.WaitOne();
                    this.Log("Detection complete, ready to start UI");

                    this.uiThreadDispatcher = Dispatcher.CurrentDispatcher;

                    this.Log("Setting SynchronizationContext");
                    SynchronizationContext.SetSynchronizationContext(new DispatcherSynchronizationContext(this.uiThreadDispatcher));

                    this.guiService = new GuiService(this, this.uiThreadDispatcher);
                    this.uacService = new UacService();

                    this.Log("Initializing view model for main application window");
                    this.wizardWindowVM = new WizardWindowVM(this, this.guiService, this.uacService);

                    this.Log("Initializing main application window");
                    this.wizardWindow = new WizardWindow()
                    {
                        DataContext = this.wizardWindowVM
                    };

                    this.wizardWindow.Closed += (a, b) => this.uiThreadDispatcher.InvokeShutdown();

                    this.Log("Showing main application window");
                    this.wizardWindow.Show();

                    this.Log("Running Dispatcher");
                    Dispatcher.Run();
                }

                this.Engine.Quit((int)this.ExitAction);
            }
            catch (Exception ex)
            {
                this.Log("An error occured while executing the Bootstrapper Application!" + Environment.NewLine + ex.ToString());
                this.Engine.Quit((int)ActionResult.Failure);
            }
        }
Пример #6
0
 public UninstallDlgVM(SetupApplication bootstrapper, IGuiService guiService, IUacService uacService)
     : base(bootstrapper, guiService)
 {
     _uacService = uacService;
 }