private void cmdOK_Click(object sender, EventArgs e) { if (!ValidateForm()) { DialogResult = DialogResult.None; return; } try { Cursor = Cursors.WaitCursor; if (Mask == null) { FileInfo fiMask = ProjectManager.Project.GetAbsolutePath(txtPath.Text); fiMask.Directory.Create(); ucPolygon.SelectedItem.Copy(fiMask); string lablField = chkLabel.Checked ? cboLabel.Text : string.Empty; string distField = chkDistance.Checked ? cboDistance.Text : string.Empty; Mask = new DirectionalMask(txtName.Text, fiMask, cboField.Text, lablField, cboDirection.Text, rdoAscending.Checked, distField); ProjectManager.Project.Masks.Add(Mask); ProjectManager.AddNewProjectItemToMap(Mask); } else { Mask.Name = txtName.Text; Mask.LabelField = chkLabel.Checked ? cboLabel.Text : string.Empty; Mask.DistanceField = chkDistance.Checked ? cboDistance.Text : string.Empty; Mask.Ascending = rdoAscending.Checked; } ProjectManager.Project.Save(); Cursor = Cursors.Default; } catch (Exception ex) { GCDException.HandleException(ex, "Error creating regular mask."); } }
public frmDirectionalMaskProps(DirectionalMask mask = null) { InitializeComponent(); Mask = mask; }