private void DetectComplete(object sender, DetectCompleteEventArgs e) { // Parse the command line string before any planning. this.ParseCommandLine(); 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.State = InstallationState.Failed; return; } if (this.Downgrade) { // TODO: What behavior do we want for downgrade? this.root.State = InstallationState.DetectedNewer; } 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.State = InstallationState.Failed; } }
private void PlanComplete(object sender, PlanCompleteEventArgs e) { if (Hresult.Succeeded(e.Status)) { this.root.PreApplyState = this.root.State; this.root.State = InstallationState.Applying; WixBA.Model.Engine.Apply(this.root.ViewWindowHandle); } else { this.root.State = InstallationState.Failed; } }
private void DetectUpdateComplete(object sender, Bootstrapper.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 (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(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)); }
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)) { // TODO: remove this when v4 really doesn't depend on .NET 3.5. // block if CLR v2 isn't available; sorry, it's needed for the MSBuild tasks if (WixBA.Model.Engine.EvaluateCondition("NOT NETFRAMEWORK35_SP_LEVEL")) { 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) { this.root.DetectState = DetectionState.Newer; IEnumerable <PackageInfo> relatedPackages = WixBA.Model.Bootstrapper.BAManifest.Bundle.Packages.Values.Where(p => p.Type == PackageType.UpgradeBundle); Version 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)); }