private void cmdEdit_Click(object sender, EventArgs e) { MNP_Align.editAlign(idAlign); }
private void cmdUpdate_Click(object sender, EventArgs e) { Control cntrl; ControlCollection cntrls = (ControlCollection)this.Controls; List <AlgnEntData> algnData = new List <AlgnEntData>(); int k = cntrls.Count; k = (k - 9) / 1 - 1; Object[,] varData = new object[k, 6]; for (int i = 0; i < cntrls.Count; i++) { cntrl = cntrls[i]; if (cntrl.Name.Contains("lbl")) { int id = int.Parse(cntrl.Name.Substring(4, 1)); int idx = id + 2; varData[id, idx] = cntrl.Text; } } AlgnEntData aData; for (int i = 0; i < k; i++) { aData = new AlgnEntData(); aData.ID = int.Parse(varData[i, 1].ToString()); aData.Type = varData[i, 2].ToString(); aData.StaBeg = double.Parse(varData[i, 3].ToString()); aData.StaEnd = double.Parse(varData[i, 4].ToString()); aData.Length = double.Parse(varData[i, 5].ToString()); aData.Radius = double.Parse(varData[i, 6].ToString()); algnData.Add(aData); } Alignment align = (Alignment)idAlign.getEnt(); AlignmentEntityCollection ents = align.Entities; bool changed = false; for (int i = 0; i < ents.Count; i++) { AlignmentEntity ent = ents[i]; if (ent.EntityType == AlignmentEntityType.Arc) { if (algnData[1].Radius == 0) { ents.Remove(ent); changed = true; } } else { AlignmentArc arc = (AlignmentArc)ent; if (!arc.Radius.Equals(algnData[i].Radius)) { arc.Radius = algnData[i].Radius; changed = true; } } if (changed) { this.Close(); MNP_Align.editAlign(align.ObjectId); } } }