protected override void btnOk_Click(object sender, EventArgs e) { try { ValidationHelper.NotNullOrEmpty(txtName.Text.Trim(), "Name"); ValidationHelper.NotNullOrEmpty(txtWorkingDirectory.Text.Trim(), "Working directory"); ValidationHelper.NotNullOrEmpty(txtPubXmlDirectory.Text.Trim(), "PubXml directory"); ValidationHelper.NotNullOrEmpty(txtSolutionName.Text.Trim(), "Solution name"); if (_deployProjectConfiguration == null) _deployProjectConfiguration = new DeployProjectConfiguration(); _deployProjectConfiguration.Name = txtName.Text.Trim(); _deployProjectConfiguration.WorkingDirectory = txtWorkingDirectory.Text.Trim(); _deployProjectConfiguration.BatDirectory = txtBatDirectory.Text.Trim(); _deployProjectConfiguration.PubXmlDirectory = txtPubXmlDirectory.Text.Trim(); _deployProjectConfiguration.SolutionName = txtSolutionName.Text.Trim(); _deployProjectConfiguration.ValidateDirectories(); Close(); DialogResult = DialogResult.OK; } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public static bool Edit(DeployProjectConfiguration deployProjectConfiguration) { var form = new EditDeployProjectForm { _deployProjectConfiguration = deployProjectConfiguration, txtName = { Text = deployProjectConfiguration.Name }, txtWorkingDirectory = { Text = deployProjectConfiguration.WorkingDirectory }, txtBatDirectory = { Text = deployProjectConfiguration.BatDirectory }, txtPubXmlDirectory = { Text = deployProjectConfiguration.PubXmlDirectory }, txtSolutionName = { Text = deployProjectConfiguration.SolutionName } }; return form.ShowDialog() == DialogResult.OK; }