Exemple #1
0
        private void DetectComplete(object sender, DetectCompleteEventArgs e)
        {
            // Parse the command line string before any planning.
            BaseModel.ParseCommandLine();

            if (LaunchAction.Uninstall == BaseModel.Command.Action)
            {
                ConfigureUninstall();
            }
            else if (Hresult.Succeeded(e.Status))
            {

                if (_downgrade)
                {
                    Logger.Standard("downgrade detected");
                    InstallationState = InstallationState.DetectedNewer;
                }

                if (_upgrade)
                {
                    Logger.Standard("upgrade detected");
                    InstallationState = InstallationState.DetectedOlder;
                }

                if (InstallationState == InstallationState.DetectedPresent)
                {
                    ExternalEngine = new ExternalUtilityEngine(
                        this,
                        Path.Combine(BaseModel.InstallFolder, "engine.exe"))
                        {
                            AllowBack = true
                        };
                    Dispatcher.Invoke(new Action(() => ExternalEngine.Initialize(BaseModel.InstallFolder)));

                }

                if (LaunchAction.Layout == BaseModel.Command.Action)
                {
                    BaseModel.PlanLayout();
                }
                else if (BaseModel.Command.Display != Display.Full)
                {
                    // If we're not waiting for the user to click install, dispatch plan with the default action.
                    Logger.Verbose("Invoking automatic plan for non-interactive mode.");
                    BaseModel.Plan(BaseModel.Command.Action.ToInstallAction());
                }
            }
            else
            {
                InstallationState = InstallationState.Failed;
            }
        }
Exemple #2
0
        private void ConfigureUninstall()
        {
            if (BaseModel.Command.Display != Display.Full)
            {
                Logger.Standard("Uninstall invoked in {0} mode; suppressing options mode (if available)", BaseModel.Command.Display);
                BaseModel.Plan(InstallActions.Remove);
                return;
            }

            ExternalEngine = new ExternalUtilityEngine(this, Path.Combine(BaseModel.InstallFolder, "engine.exe")) {AllowBack = false};
            Dispatcher.Invoke(new Action(() => ExternalEngine.Initialize(BaseModel.InstallFolder)));
            if (ExternalEngine == null || !ExternalEngine.IsValid)
            {
                Logger.Standard("No uninstall options available; proceeding with uninstall");
                BaseModel.Plan(InstallActions.Remove);
                return;
            }

            InstallationState = InstallationState.ShowingRemoveOptions;
        }