public SelectApplicationsPageViewModel(WizardViewModel wizardViewModel)
            : base(wizardViewModel)
        {
            this.CanCancel           = true;
            this.CanGoToPreviousPage = false; // TODO Allow if doing modify.
            this.CanGoToNextPage     = true;

            // TODO: From WelcomePage in original, which Install button
            // clicked. Correct to do it this way?
            wizardViewModel.LaunchAction = LaunchAction.Install;
            // TODO Need this? Or put in ReadyToInstall? this.BeginNextPhase();

            this._selectAppsFolderHelper = new WixVariableHelper(wizardViewModel.Bootstrapper, "InstallDir");
            this._dialogTitle            = string.Format(Localisation.Wizard_WindowTitle,
                                                         Bootstrapper.Engine.StringVariables["WixBundleName"],
                                                         Bootstrapper.Engine.StringVariables["TitleBarRelease"]);

            this.SelectAppsFolderBrowseCommand = new SimpleCommand(_ =>
            {
                var folderBrowserDialog = new FolderBrowserDialog
                {
                    DialogTitle    = this._dialogTitle,
                    SelectedFolder = ApplicationsFolder
                };
                // If user clicks OK then Value is true, so we know to save the selected folder.
                if (folderBrowserDialog.ShowDialog().Value)
                {
                    this.ApplicationsFolder = folderBrowserDialog.SelectedFolder;
                }
            }, _ => true);
        }
 public PackageCombinationConfiguration(WixBootstrapper bootstrapper)
 {
     this._bootstrapper = bootstrapper;
     this._sqlServerInstanceNameHelper     = new WixVariableHelper(bootstrapper, "InstanceName");
     this._installationTypeHelper          = new WixVariableHelper(bootstrapper, "BundleInstallationType");
     this._sqlServerInstallationTypeHelper =
         new WixVariableHelper(bootstrapper, "BundleSqlServerInstallationType");
     this.UpdateSqlServerInstallationType();
 }
Ejemplo n.º 3
0
        public LayoutConfigurationViewModel(WizardViewModel wizardViewModel) : base(wizardViewModel)
        {
            this.CanCancel                 = true;
            this.CanGoToPreviousPage       = true;
            this.CanGoToNextPage           = true;
            this.LayoutFolderBrowseCommand = new SimpleCommand(_ =>
            {
                var folderBrowserDialog = new VistaFolderBrowserDialog
                {
                    SelectedPath = Directory.GetCurrentDirectory()
                };

                folderBrowserDialog.ShowDialog();
                this.LayoutFolder = folderBrowserDialog.SelectedPath;
            }, _ => true);
            this._layoutFolderHelper = new WixVariableHelper(wizardViewModel.Bootstrapper, "WixBundleLayoutDirectory");
            this._layoutFolderHelper.Set(Directory.GetCurrentDirectory());
        }
Ejemplo n.º 4
0
        public AdvancedConfigurationViewModel(WizardViewModel wizardViewModel) : base(wizardViewModel)
        {
            this.CanCancel           = true;
            this.CanGoToPreviousPage = true;
            this.CanGoToNextPage     = true;

            var defaultInstallDirectoryName = wizardViewModel.Bootstrapper.BundleName;
            var defaultSqlServerInstanceInstallFolderName = "Microsoft SQL Server";

            // Change this if your app can be 64 bit!
            var defaultInstallFolderParent = this.ProgramFiles32BitFolder;

            var defaultSqlServerInstanceInstallFolderParent = wizardViewModel.PackageCombinationConfiguration
                                                              .CheckSqlServer32BitInstanceInstanceExists()
                ? this.ProgramFiles32BitFolder
                : this.ProgramFilesNativeFolder;

            var defaultInstallFolder = Path.Combine(defaultInstallFolderParent, defaultInstallDirectoryName);

            var defaultSqlServerInstanceInstallFolder =
                Path.Combine(defaultSqlServerInstanceInstallFolderParent, defaultSqlServerInstanceInstallFolderName);

            this.InstallFolderBrowseCommand = new SimpleCommand(_ =>
            {
                var folderBrowserDialog = new VistaFolderBrowserDialog
                {
                    SelectedPath = this.GetBrowserDialogInitialPath(this.InstallFolder, defaultInstallFolderParent)
                };

                folderBrowserDialog.ShowDialog();
                var newPath = folderBrowserDialog.SelectedPath;
                if (!newPath.EndsWith(Path.DirectorySeparatorChar + defaultInstallDirectoryName))
                {
                    newPath = Path.Combine(newPath, defaultInstallDirectoryName);
                }
                this.InstallFolder = newPath;
            }, _ => true);


            this.SqlServerInstanceInstallFolderBrowseCommand = new SimpleCommand(_ =>
            {
                var folderBrowserDialog = new VistaFolderBrowserDialog
                {
                    SelectedPath = this.GetBrowserDialogInitialPath(this.SqlServerInstanceInstallFolder,
                                                                    defaultSqlServerInstanceInstallFolderParent)
                };

                folderBrowserDialog.ShowDialog();
                var newPath = folderBrowserDialog.SelectedPath;
                if (!newPath.EndsWith(Path.DirectorySeparatorChar + defaultSqlServerInstanceInstallFolderName))
                {
                    newPath = Path.Combine(newPath, defaultSqlServerInstanceInstallFolderName);
                }
                this.SqlServerInstanceInstallFolder = newPath;
            }, _ => this.WizardViewModel.PackageCombinationConfiguration.InstallationType == InstallationType.MasterServer);


            this._installFolderHelper = new WixVariableHelper(wizardViewModel.Bootstrapper, "InstallDir");
            this._sqlServerInstanceInstallFolderHelper =
                new WixVariableHelper(wizardViewModel.Bootstrapper, "SqlServerInstanceInstallDir",
                                      x => x.TrimEnd('\\', '/'));
            this._sqlServerAdditionalParametersHelper =
                new WixVariableHelper(wizardViewModel.Bootstrapper, "SqlServerAdditionalParameters");

            this._installFolderHelper.Set(defaultInstallFolder);
            this._sqlServerInstanceInstallFolderHelper.Set(defaultSqlServerInstanceInstallFolder);
        }
        public ClientConfigurationPageViewModel(WizardViewModel wizardViewModel)
            : base(wizardViewModel)
        {
            this.CanCancel           = true;
            this.CanGoToPreviousPage = true;
            this.CanGoToNextPage     = true;

            // The Next button is conditional on the user acknowledging
            // that the port is the default port. But don't just go to
            // next page after acknowledging so user has a chance to
            // change the port.
            this.NextPageCommand = new SimpleCommand(_ =>
            {
                // Remove any leading and trailing spaces from port and user.
                Bootstrapper.Engine.StringVariables["P4PORT"] = Bootstrapper.Engine.StringVariables["P4PORT"].TrimStart(' ');
                Bootstrapper.Engine.StringVariables["P4PORT"] = Bootstrapper.Engine.StringVariables["P4PORT"].TrimEnd(' ');
                Bootstrapper.Engine.StringVariables["P4USER"] = Bootstrapper.Engine.StringVariables["P4USER"].TrimStart(' ');
                Bootstrapper.Engine.StringVariables["P4USER"] = Bootstrapper.Engine.StringVariables["P4USER"].TrimEnd(' ');

                if (Bootstrapper.Engine.StringVariables["DefaultPortWarned"] == "false" &&
                    Bootstrapper.Engine.StringVariables["P4PORT"] == "perforce:1666")
                {
                    var defaultPortWarningDialog = new DefaultPortWarningDialog()
                    {
                        DialogTitle = this._dialogTitle
                    };
                    // If user clicks OK then Value is true, so we know to save the selected folder.
                    defaultPortWarningDialog.ShowDialog();
                    Bootstrapper.Engine.StringVariables["DefaultPortWarned"] = "true";
                }
                else
                {
                    this.BeginNextPhase();
                }
            }, _ => true);

            // TODO Try (again?) using Bootstrapper.Engine.StringVariables to set and get P4EDITOR.
            this._clientConfigurationBrowseHelper = new WixVariableHelper(wizardViewModel.Bootstrapper, "P4EDITOR"); // TODO Search registry for it, and set in bootstrapper.
            this.PathToEditor = Bootstrapper.Engine.StringVariables["P4EDITOR"];
            this._dialogTitle = string.Format(Localisation.Wizard_WindowTitle,
                                              Bootstrapper.Engine.StringVariables["WixBundleName"],
                                              Bootstrapper.Engine.StringVariables["TitleBarRelease"]);

            this.ClientConfigServerHelpCommand = new SimpleCommand(_ =>
            {
                var serverHelpDialog = new ServerHelpDialog
                {
                    DialogTitle = this._dialogTitle
                };
                // If user clicks OK then Value is true, so we know to save the selected folder.
                serverHelpDialog.ShowDialog();
            }, _ => true);

            this.ClientConfigBrowseCommand = new SimpleCommand(_ =>
            {
                using (OpenFileDialog openFileDialog = new OpenFileDialog())
                {
                    string path = this.PathToEditor;
                    openFileDialog.InitialDirectory = Path.GetDirectoryName(path);
                    openFileDialog.FileName         = Path.GetFileName(path);
                    openFileDialog.CheckPathExists  = true;
                    openFileDialog.CheckFileExists  = true;
                    openFileDialog.Title            = WixWPFWizardBA.Localisation.ClientConfigurationDialog_BrowseDlgTitle;
                    openFileDialog.Filter           = WixWPFWizardBA.Localisation.ClientConfigurationDialog_BrowseDlgFilter; // "Applications (*.exe)|*.exe"
                    openFileDialog.FilterIndex      = 1;
                    openFileDialog.RestoreDirectory = true;

                    DialogResult result = openFileDialog.ShowDialog(null); // If don't use null, Cancel button can't be clicked.

                    if (result == DialogResult.OK)
                    {
                        this.PathToEditor = openFileDialog.FileName;
                    }
                }
            }, _ => true);
        }