Esempio n. 1
0
 /// <summary>
 /// Creates a new model for the BA.
 /// </summary>
 /// <param name="bootstrapper">The BA.</param>
 public Model(WixBA bootstrapper)
 {
     this.BAManifest   = bootstrapper.BAManifest;
     this.Bootstrapper = bootstrapper;
     this.Command      = bootstrapper.Command;
     this.Engine       = bootstrapper.Engine;
     this.Telemetry    = new List <KeyValuePair <string, string> >();
     this.Version      = this.Engine.VersionVariables[BurnBundleVersionVariable];
 }
Esempio n. 2
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 &&
                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));
        }
Esempio n. 3
0
        public static void PlanLayout()
        {
            // Either default or set the layout directory
            if (String.IsNullOrEmpty(WixBA.Model.Command.LayoutDirectory))
            {
                WixBA.Model.LayoutDirectory = Directory.GetCurrentDirectory();

                // Ask the user for layout folder if one wasn't provided and we're in full UI mode
                if (WixBA.Model.Command.Display == Display.Full)
                {
                    WixBA.Dispatcher.Invoke((Action) delegate()
                    {
                        WinForms.FolderBrowserDialog browserDialog = new WinForms.FolderBrowserDialog();
                        browserDialog.RootFolder = Environment.SpecialFolder.MyComputer;

                        // Default to the current directory.
                        browserDialog.SelectedPath   = WixBA.Model.LayoutDirectory;
                        WinForms.DialogResult result = browserDialog.ShowDialog();

                        if (WinForms.DialogResult.OK == result)
                        {
                            WixBA.Model.LayoutDirectory = browserDialog.SelectedPath;
                            WixBA.Plan(WixBA.Model.Command.Action);
                        }
                        else
                        {
                            WixBA.View.Close();
                        }
                    }
                                            );
                }
            }
            else
            {
                WixBA.Model.LayoutDirectory = WixBA.Model.Command.LayoutDirectory;
                WixBA.Plan(WixBA.Model.Command.Action);
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Launches the license in the default viewer.
        /// </summary>
        private void LaunchLicense()
        {
            string folder = IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

            WixBA.LaunchUrl(IO.Path.Combine(folder, "License.txt"));
        }
Esempio n. 5
0
 /// <summary>
 /// Open a log folder.
 /// </summary>
 /// <param name="string">path to a log folder.</param>
 internal static void OpenLogFolder(string logFolder)
 {
     WixBA.UseShellExecute(logFolder);
 }
Esempio n. 6
0
 /// <summary>
 /// Open a log file.
 /// </summary>
 /// <param name="uri">URI to a log file.</param>
 internal static void OpenLog(Uri uri)
 {
     WixBA.UseShellExecute(uri.ToString());
 }
Esempio n. 7
0
 /// <summary>
 /// Launches the default web browser to the provided URI.
 /// </summary>
 /// <param name="uri">URI to open the web browser.</param>
 public static void LaunchUrl(string uri)
 {
     WixBA.UseShellExecute(uri);
 }