private void okButton_Click(object sender, System.EventArgs e)
		{
			ArrayList messageList = new ArrayList();

			this.Enabled = false;
			this.Cursor = Cursors.WaitCursor;

			ProgressForm progressForm = new ProgressForm();
			progressForm.Owner = this;
			progressForm.Show();

			Application.DoEvents();

			string createConnectionString = null;

			if (this.useIntegratedSecurityCheckBox.Checked == true)
				createConnectionString = "Server=" + this.databaseServerTextBox.Text + ";Integrated Security=True;";
			else
				createConnectionString = "Server=" + this.databaseServerTextBox.Text + ";UID=" + this.databaseUsernameTextBox.Text + ";PWD=" + this.databasePasswordTextBox.Text + ";";
	
			progressForm.CurrentStepDescription = "Creating the database.";
			progressForm.ProgressValue = 1;
			Application.DoEvents();

			try
			{
				ServerSetupHelper.InstallDatabase(createConnectionString, this.databaseNameTextBox.Text,this.terrariumPasswordTextBox.Text);
			}
			catch( Exception ex)
			{
				messageList.Add(ex.Message);
			}

			string webConnectionString = "Server=" + this.databaseServerTextBox.Text + ";Database=" + this.databaseNameTextBox.Text + ";UID=TerrariumUser;PWD=" + this.terrariumPasswordTextBox.Text + ";";

			progressForm.CurrentStepDescription = "Preparing to create the website.";
			progressForm.ProgressValue = 2;
			Application.DoEvents();

			try
			{
				ServerSetupHelper.InstallWebConfig(this.webPathText.Text, webConnectionString);
			}
			catch(Exception ex)
			{
				messageList.Add(ex.Message);
			}

			progressForm.CurrentStepDescription = "Creating the website.";
			progressForm.ProgressValue = 3;
			Application.DoEvents();
			
			try
			{
				ServerSetupHelper.InstallWebRoot("localhost",this.webPathText.Text,this.webNameText.Text);
			}
			catch(Exception ex)
			{
				messageList.Add(ex.Message);
			}

			progressForm.CurrentStepDescription = "Setting up permissions.";
			progressForm.ProgressValue = 4;
			Application.DoEvents();

			try
			{
				ServerSetupHelper.InstallACLs(this.webPathText.Text);
			}
			catch(Exception ex)
			{
				messageList.Add(ex.Message);
			}

			Application.DoEvents();

			progressForm.CurrentStepDescription = "Installing performance counters and event logs.";
			progressForm.ProgressValue = 5;
			Application.DoEvents();

			try
			{
				//Install the performance counters and the event logs
				System.Configuration.Install.AssemblyInstaller installer = new System.Configuration.Install.AssemblyInstaller("InstallerItems.dll", null);
				System.Collections.Hashtable dictionary = new Hashtable();
				installer.Install(dictionary);
				installer.Commit(dictionary);
				installer.Dispose();
			}
			catch(Exception ex)
			{
				messageList.Add(ex.Message);
			}

			this.Cursor = Cursors.Default;

			progressForm.Close();
			progressForm.Dispose();

			installed = true;

			VerificationForm verification = new VerificationForm(messageList);
			verification.ServerUrl = "http://" + System.Environment.MachineName + "/" + this.webNameText.Text + "/default.aspx";
			verification.Owner = this;
			verification.ShowDialog();
			
			this.Close();
		}
Esempio n. 2
0
        private void okButton_Click(object sender, System.EventArgs e)
        {
            ArrayList messageList = new ArrayList();

            this.Enabled = false;
            this.Cursor  = Cursors.WaitCursor;

            ProgressForm progressForm = new ProgressForm();

            progressForm.Owner = this;
            progressForm.Show();

            Application.DoEvents();

            string createConnectionString = null;

            if (this.useIntegratedSecurityCheckBox.Checked == true)
            {
                createConnectionString = "Server=" + this.databaseServerTextBox.Text + ";Integrated Security=True;";
            }
            else
            {
                createConnectionString = "Server=" + this.databaseServerTextBox.Text + ";UID=" + this.databaseUsernameTextBox.Text + ";PWD=" + this.databasePasswordTextBox.Text + ";";
            }

            progressForm.CurrentStepDescription = "Creating the database.";
            progressForm.ProgressValue          = 1;
            Application.DoEvents();

            try
            {
                ServerSetupHelper.InstallDatabase(createConnectionString, this.databaseNameTextBox.Text, this.terrariumPasswordTextBox.Text);
            }
            catch (Exception ex)
            {
                messageList.Add(ex.Message);
            }

            string webConnectionString = "Server=" + this.databaseServerTextBox.Text + ";Database=" + this.databaseNameTextBox.Text + ";UID=TerrariumUser;PWD=" + this.terrariumPasswordTextBox.Text + ";";

            progressForm.CurrentStepDescription = "Preparing to create the website.";
            progressForm.ProgressValue          = 2;
            Application.DoEvents();

            try
            {
                ServerSetupHelper.InstallWebConfig(this.webPathText.Text, webConnectionString);
            }
            catch (Exception ex)
            {
                messageList.Add(ex.Message);
            }

            progressForm.CurrentStepDescription = "Creating the website.";
            progressForm.ProgressValue          = 3;
            Application.DoEvents();

            try
            {
                ServerSetupHelper.InstallWebRoot("localhost", this.webPathText.Text, this.webNameText.Text);
            }
            catch (Exception ex)
            {
                messageList.Add(ex.Message);
            }

            progressForm.CurrentStepDescription = "Setting up permissions.";
            progressForm.ProgressValue          = 4;
            Application.DoEvents();

            try
            {
                ServerSetupHelper.InstallACLs(this.webPathText.Text);
            }
            catch (Exception ex)
            {
                messageList.Add(ex.Message);
            }

            Application.DoEvents();

            progressForm.CurrentStepDescription = "Installing performance counters and event logs.";
            progressForm.ProgressValue          = 5;
            Application.DoEvents();

            try
            {
                //Install the performance counters and the event logs
                System.Configuration.Install.AssemblyInstaller installer = new System.Configuration.Install.AssemblyInstaller("InstallerItems.dll", null);
                System.Collections.Hashtable dictionary = new Hashtable();
                installer.Install(dictionary);
                installer.Commit(dictionary);
                installer.Dispose();
            }
            catch (Exception ex)
            {
                messageList.Add(ex.Message);
            }

            this.Cursor = Cursors.Default;

            progressForm.Close();
            progressForm.Dispose();

            installed = true;

            VerificationForm verification = new VerificationForm(messageList);

            verification.ServerUrl = "http://" + System.Environment.MachineName + "/" + this.webNameText.Text + "/default.aspx";
            verification.Owner     = this;
            verification.ShowDialog();

            this.Close();
        }