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; } }
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 && ResumeType.Arp != WixBA.Model.Command.Resume) // MSI and WixStdBA require some kind of confirmation before proceeding so WixBA should, too. { WixBA.Model.Engine.Log(LogLevel.Verbose, "Invoking automatic plan for uninstall"); WixBA.Plan(LaunchAction.Uninstall); } else if (Hresult.Succeeded(e.Status)) { if (this.Downgrade) { this.root.DetectState = DetectionState.Newer; var relatedPackages = WixBA.Model.BAManifest.Bundle.Packages.Values.Where(p => p.Type == PackageType.UpgradeBundle); var installedVersion = relatedPackages.Any() ? new Version(relatedPackages.Max(p => p.Version)) : null; if (installedVersion != null && installedVersion < new Version(4, 1) && installedVersion.Build > 10) { this.DowngradeMessage = "You must uninstall WiX v" + installedVersion + " before you can install this."; } else { this.DowngradeMessage = "There is already a newer version of WiX installed on this machine."; } } 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; } // Force all commands to reevaluate CanExecute. // InvalidateRequerySuggested must be run on the UI thread. root.Dispatcher.Invoke(new Action(CommandManager.InvalidateRequerySuggested)); }
private void DetectUpdateComplete(object sender, DetectUpdateCompleteEventArgs e) { // Failed to process an update, 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}, updates disabled.", e.Status)); e.IgnoreError = true; } // 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; } }
private void ApplyComplete(object sender, ApplyCompleteEventArgs e) { WixBA.Model.Result = e.Status; // remember the final result of the apply. // 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; } // If we're not in Full UI mode, we need to alert the dispatcher to stop and close the window for passive. if (Display.Full != WixBA.Model.Command.Display) { // If its passive, send a message to the window to close. if (Display.Passive == WixBA.Model.Command.Display) { WixBA.Model.Engine.Log(LogLevel.Verbose, "Automatically closing the window for non-interactive install"); WixBA.Dispatcher.BeginInvoke(new Action(WixBA.View.Close)); } else { WixBA.Dispatcher.InvokeShutdown(); } return; } 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(new Action(WixBA.View.Close)); return; } else if (root.AutoClose) { // Automatically closing since the user clicked the X button. WixBA.Dispatcher.BeginInvoke(new Action(WixBA.View.Close)); return; } // Force all commands to reevaluate CanExecute. // InvalidateRequerySuggested must be run on the UI thread. root.Dispatcher.Invoke(new Action(CommandManager.InvalidateRequerySuggested)); }