/// <summary> /// Launch Setup in Silent Mode /// </summary> /// <returns>a SetupReturnValues reflecting success or possible failure causes</returns> private static SetupReturnValues SilentRun() { // Setup the data for the items to install PrepareInstallData.PrepareInstallDataItems(); // Check to see that we have all the install files we need. // Make sure the file locations are set for the install files. SetupFileValidation.ResetInstallItemFileLocations( PropertyBagDictionary.Instance.GetProperty <string>(PropertyBagConstants.LocationOfSetupFiles), PropertyBagDictionary.Instance.GetProperty <string>(PropertyBagConstants.LocationOfSetupFiles)); if (!PropertyBagDictionary.Instance.PropertyExists(PropertyBagConstants.Uninstall)) { if (!SetupFileValidation.HaveAllNeededInstallItemFiles()) { return(SetupReturnValues.InvalidInstallImage); } SetupHelpers.SetFeatureSwitches(); // If we are not uninstalling, Do the prereq check if (2 == SetupHelpers.DoAllPrerequisiteChecks()) { // We failed prereq tests so we will fail the install SetupLogger.LogError("We failed the prerequisite checks."); return(SetupReturnValues.FailedPrerequisiteChecks); } // If this is a server installation, // - check if there is an existing database, // and if so, check if upgrade is supported from that version // - make sure client is also installed with server. if (PropertyBagDictionary.Instance.PropertyExists(PropertyBagConstants.Server)) { // Error conditions // An unsupported database found // A supported database is found, but user didnt explicitly specify upgrade // CheckDatabase will throw an exception if DB version is // incompatible string sqlMachineName = (String)SetupInputs.Instance.FindItem(SetupInputTags.SqlMachineNameTag); String fullInstanceName = SetupDatabaseHelper.ConstructFullInstanceName( !SetupDatabaseHelper.SqlServerIsOnLocalComputer(sqlMachineName), sqlMachineName, (String)SetupInputs.Instance.FindItem(SetupInputTags.SqlInstanceNameTag), (int)SetupInputs.Instance.FindItem(SetupInputTags.SqlServerPortTag)); } } // Do the install using the passed information InstallActionProcessor installs = new InstallActionProcessor(); SetupLogger.LogInfo("Silent ProcessInstalls Starting"); SetupReturnValues rturn = installs.ProcessInstalls(); SetupLogger.LogInfo("Silent ProcessInstalls Done"); return(rturn); }
/// <summary> /// Validates the inputs on this page /// </summary> /// <returns></returns> public override bool ValidatePage() { bool isPageValid = true; try { Mouse.OverrideCursor = System.Windows.Input.Cursors.Wait; SetupInputs.Instance.EditItem(SetupInputTags.WapSqlMachineNameTag, this.textBoxServer.Text); SetupInputs.Instance.EditItem(SetupInputTags.WapSqlInstanceNameTag, IsDefaultInstance(this.comboBoxInstance.Text) ? String.Empty : this.comboBoxInstance.Text); this.port = String.IsNullOrEmpty(this.textBoxPort.Text) ? InputDefaults.WapSqlServerPort : Convert.ToInt32(this.textBoxPort.Text); SetupInputs.Instance.EditItem(SetupInputTags.WapSqlServerPortTag, this.port); bool isNewDB = this.radioNewDatabase.IsChecked.GetValueOrDefault(false); SetupInputs.Instance.EditItem(SetupInputTags.WapCreateNewSqlDatabaseTag, isNewDB); if (isNewDB) { SetupInputs.Instance.EditItem(SetupInputTags.WapSqlDatabaseNameTag, this.textBoxNewDatabaseName.Text); } else { SetupInputs.Instance.EditItem(SetupInputTags.WapSqlDatabaseNameTag, this.comboBoxExistingDatabaseName.Text); } if (this.checkBoxNewUserId.IsChecked.GetValueOrDefault(false)) { String userName = SetupInputs.Instance.FindItem(SetupInputTags.WapSqlDBAdminNameTag); String domainName = SetupInputs.Instance.FindItem(SetupInputTags.WapSqlDBAdminDomainTag); if (!UserAccountHelper.ValidateCredentials(userName, domainName, this.passwordBoxPassword.SecurePassword)) { throw new Exception("Either the domain account or the password you entered are not valid."); } } String fullInstanceName = SetupDatabaseHelper.ConstructFullInstanceName( !SetupDatabaseHelper.SqlServerIsOnLocalComputer(this.serverName), (String)SetupInputs.Instance.FindItem(SetupInputTags.WapSqlMachineNameTag), (String)SetupInputs.Instance.FindItem(SetupInputTags.WapSqlInstanceNameTag), (int)SetupInputs.Instance.FindItem(SetupInputTags.WapSqlServerPortTag)); SetupDatabaseHelper.CheckDatabase( fullInstanceName, (String)SetupInputs.Instance.FindItem(SetupInputTags.WapSqlDatabaseNameTag), true); } catch (SqlException) { Exception exception = new Exception("Setup cannot connect to the specified SQL Server instance."); SetupLogger.LogException(exception); SetupHelpers.ShowError(exception.Message); isPageValid = false; } catch (Exception exception) { SetupLogger.LogException(exception); SetupHelpers.ShowError(exception.Message); isPageValid = false; } finally { Mouse.OverrideCursor = null; } return(isPageValid); }