private void btnEditProfile_Click(object sender, EventArgs e)
        {
            // edit the selected profile
            DeploymentProfile profile = SelectedProfile;
            string            oldName = profile.Name;

            FrmProfileEdit frmProfileEdit = new FrmProfileEdit()
            {
                Profile = profile,
                ExistingProfileNames = deploymentSettings.GetExistingProfileNames(oldName)
            };

            if (frmProfileEdit.ShowDialog() == DialogResult.OK)
            {
                // update the profile name if it changed
                if (oldName != profile.Name)
                {
                    deploymentSettings.Profiles.Remove(oldName);

                    try
                    {
                        cbProfile.BeginUpdate();
                        cbProfile.Items.RemoveAt(cbProfile.SelectedIndex);
                        AddProfileToLists(profile);
                    }
                    finally
                    {
                        cbProfile.EndUpdate();
                    }
                }

                // save the deployment settings
                SaveDeploymentSettings();
            }
        }
        private void btnCreateProfile_Click(object sender, EventArgs e)
        {
            // create a new profile
            DeploymentProfile profile = new DeploymentProfile();

            FrmProfileEdit frmProfileEdit = new FrmProfileEdit()
            {
                Profile = profile,
                ExistingProfileNames = deploymentSettings.GetExistingProfileNames()
            };

            if (frmProfileEdit.ShowDialog() == DialogResult.OK)
            {
                AddProfileToLists(profile);
                SaveDeploymentSettings();
            }
        }
        private void btnCreateProfile_Click(object sender, EventArgs e)
        {
            // create a new profile
            HashSet <string> existingNames      = deploymentSettings.GetExistingProfileNames();
            string           defaultProfileName = string.Format(ProfileNameFormat, instance.Name);

            DeploymentProfile profile = new DeploymentProfile
            {
                InstanceID = instance.ID,
                Name       = existingNames.Contains(defaultProfileName) ? "" : defaultProfileName
            };

            FrmProfileEdit frmProfileEdit = new FrmProfileEdit
            {
                Profile = profile,
                ExistingProfileNames = existingNames
            };

            if (frmProfileEdit.ShowDialog() == DialogResult.OK)
            {
                AddProfileToLists(profile);
                SaveDeploymentSettings();
            }
        }