Пример #1
0
        private void DetectComplete(object sender, DetectCompleteEventArgs e)
        {
            // Parse the command line string before any planning.
            this.ParseCommandLine();
            this.root.InstallState = InstallationState.Waiting;

            if (LaunchAction.Uninstall == WixBA.Model.Command.Action)
            {
                WixBA.Model.Engine.Log(LogLevel.Verbose, "Invoking automatic plan for uninstall");
                WixBA.Plan(LaunchAction.Uninstall);
            }
            else if (Hresult.Succeeded(e.Status))
            {
                // block if CLR v2 isn't available; sorry, it's needed for the MSBuild tasks
                if (WixBA.Model.Engine.EvaluateCondition("NETFRAMEWORK35_SP_LEVEL < 1"))
                {
                    string message = "WiX Toolset requires the .NET Framework 3.5.1 Windows feature to be enabled.";
                    WixBA.Model.Engine.Log(LogLevel.Verbose, message);

                    if (Display.Full == WixBA.Model.Command.Display)
                    {
                        WixBA.Dispatcher.Invoke((Action) delegate()
                        {
                            MessageBox.Show(message, "WiX Toolset", MessageBoxButton.OK, MessageBoxImage.Error);
                            if (null != WixBA.View)
                            {
                                WixBA.View.Close();
                            }
                        }
                                                );
                    }

                    this.root.InstallState = InstallationState.Failed;
                    return;
                }

                if (this.Downgrade)
                {
                    // TODO: What behavior do we want for downgrade?
                    this.root.DetectState = DetectionState.Newer;
                }

                if (LaunchAction.Layout == WixBA.Model.Command.Action)
                {
                    WixBA.PlanLayout();
                }
                else if (WixBA.Model.Command.Display != Display.Full)
                {
                    // If we're not waiting for the user to click install, dispatch plan with the default action.
                    WixBA.Model.Engine.Log(LogLevel.Verbose, "Invoking automatic plan for non-interactive mode.");
                    WixBA.Plan(WixBA.Model.Command.Action);
                }
            }
            else
            {
                this.root.InstallState = InstallationState.Failed;
            }
        }
Пример #2
0
 private void PlanComplete(object sender, PlanCompleteEventArgs e)
 {
     if (Hresult.Succeeded(e.Status))
     {
         this.root.PreApplyState = this.root.InstallState;
         this.root.InstallState  = InstallationState.Applying;
         WixBA.Model.Engine.Apply(this.root.ViewWindowHandle);
     }
     else
     {
         this.root.InstallState = InstallationState.Failed;
     }
 }
Пример #3
0
 private void DetectUpdateComplete(object sender, Bootstrapper.DetectUpdateCompleteEventArgs e)
 {
     // Failed to process an update, re-queue a detect to allow the existing bundle to still install.
     if ((UpdateState.Failed != this.State) && !Hresult.Succeeded(e.Status))
     {
         this.State = UpdateState.Failed;
         WixBA.Model.Engine.Log(LogLevel.Verbose, String.Format("Failed to locate an update, status of 0x{0:X8}. Re-detecting with updates disabled.", e.Status));
         WixBA.Model.Engine.Detect();
     }
     // If we are uninstalling, we don't want to check or show an update
     // If we are checking, then the feed didn't find any valid enclosures
     // If we are initializing, we're either uninstalling or not a full UI
     else if ((LaunchAction.Uninstall == WixBA.Model.Command.Action) || (UpdateState.Initializing == this.State) || (UpdateState.Checking == this.State))
     {
         this.State = UpdateState.Unknown;
     }
 }
Пример #4
0
        private void ApplyComplete(object sender, ApplyCompleteEventArgs e)
        {
            WixBA.Model.Result = e.Status; // remember the final result of the apply.

            // If we're not in Full UI mode, we need to alert the dispatcher to stop and close the window for passive.
            if (Bootstrapper.Display.Full != WixBA.Model.Command.Display)
            {
                // If its passive, send a message to the window to close.
                if (Bootstrapper.Display.Passive == WixBA.Model.Command.Display)
                {
                    WixBA.Model.Engine.Log(LogLevel.Verbose, "Automatically closing the window for non-interactive install");
                    WixBA.Dispatcher.BeginInvoke((Action) delegate()
                    {
                        WixBA.View.Close();
                    }
                                                 );
                }
                else
                {
                    WixBA.Dispatcher.InvokeShutdown();
                }
            }
            else if (Hresult.Succeeded(e.Status) && LaunchAction.UpdateReplace == WixBA.Model.PlannedAction) // if we successfully applied an update close the window since the new Bundle should be running now.
            {
                WixBA.Model.Engine.Log(LogLevel.Verbose, "Automatically closing the window since update successful.");
                WixBA.Dispatcher.BeginInvoke((Action) delegate()
                {
                    WixBA.View.Close();
                }
                                             );
            }

            // Set the state to applied or failed unless the state has already been set back to the preapply state
            // which means we need to show the UI as it was before the apply started.
            if (this.root.InstallState != this.root.PreApplyState)
            {
                this.root.InstallState = Hresult.Succeeded(e.Status) ? InstallationState.Applied : InstallationState.Failed;
            }
        }
        private void DetectComplete(object sender, DetectCompleteEventArgs e)
        {
            if (LaunchAction.Uninstall == WixBA.Model.Command.Action)
            {
                WixBA.Model.Engine.Log(LogLevel.Verbose, "Invoking automatic plan for uninstall");
                WixBA.Dispatcher.Invoke((Action) delegate()
                {
                    this.Plan(LaunchAction.Uninstall);
                }
                                        );
            }
            else if (Hresult.Succeeded(e.Status))
            {
                if (this.Downgrade)
                {
                    // TODO: What behavior do we want for downgrade?
                    this.root.State = InstallationState.DetectedNewer;
                }

                if (LaunchAction.Layout == WixBA.Model.Command.Action)
                {
                    PlanLayout();
                }
                else if (WixBA.Model.Command.Display != Display.Full)
                {
                    // If we're not waiting for the user to click install, dispatch plan with the default action.
                    WixBA.Model.Engine.Log(LogLevel.Verbose, "Invoking automatic plan for non-interactive mode.");
                    WixBA.Dispatcher.Invoke((Action) delegate()
                    {
                        this.Plan(WixBA.Model.Command.Action);
                    }
                                            );
                }
            }
            else
            {
                this.root.State = InstallationState.Failed;
            }
        }