private void DetectComplete(object sender, DetectCompleteEventArgs e) { // Parse the command line string before any planning. this.ParseCommandLine(); if (LaunchAction.Uninstall == PanelSwWixBA.Model.Command.Action) { PanelSwWixBA.Model.Engine.Log(LogLevel.Verbose, "Invoking automatic plan for uninstall"); PanelSwWixBA.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 (PanelSwWixBA.Model.Engine.EvaluateCondition("NETFRAMEWORK35_SP_LEVEL < 1")) { string message = "WiX Toolset requires the .NET Framework 3.5.1 Windows feature to be enabled."; PanelSwWixBA.Model.Engine.Log(LogLevel.Verbose, message); if (Display.Full == PanelSwWixBA.Model.Command.Display) { PanelSwWixBA.Dispatcher.Invoke((Action) delegate() { MessageBox.Show(message, "WiX Toolset", MessageBoxButton.OK, MessageBoxImage.Error); if (null != PanelSwWixBA.View) { PanelSwWixBA.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 == PanelSwWixBA.Model.Command.Action) { PanelSwWixBA.PlanLayout(); } else if (PanelSwWixBA.Model.Command.Display != Display.Full) { // If we're not waiting for the user to click install, dispatch plan with the default action. PanelSwWixBA.Model.Engine.Log(LogLevel.Verbose, "Invoking automatic plan for non-interactive mode."); PanelSwWixBA.Plan(PanelSwWixBA.Model.Command.Action); } } else { this.root.State = InstallationState.Failed; } }
public static void PlanLayout() { // Either default or set the layout directory if (String.IsNullOrEmpty(PanelSwWixBA.Model.Command.LayoutDirectory)) { PanelSwWixBA.Model.LayoutDirectory = Directory.GetCurrentDirectory(); // Ask the user for layout folder if one wasn't provided and we're in full UI mode if (PanelSwWixBA.Model.Command.Display == Display.Full) { PanelSwWixBA.Dispatcher.Invoke((Action) delegate() { WinForms.FolderBrowserDialog browserDialog = new WinForms.FolderBrowserDialog(); browserDialog.RootFolder = Environment.SpecialFolder.MyComputer; // Default to the current directory. browserDialog.SelectedPath = PanelSwWixBA.Model.LayoutDirectory; WinForms.DialogResult result = browserDialog.ShowDialog(); if (WinForms.DialogResult.OK == result) { PanelSwWixBA.Model.LayoutDirectory = browserDialog.SelectedPath; PanelSwWixBA.Plan(PanelSwWixBA.Model.Command.Action); } else { PanelSwWixBA.View.Close(); } } ); } } else { PanelSwWixBA.Model.LayoutDirectory = PanelSwWixBA.Model.Command.LayoutDirectory; PanelSwWixBA.Plan(PanelSwWixBA.Model.Command.Action); } }