private void updateButton_Click(object sender, EventArgs e) { // Get the selected distance. Distance d = GetSel(); if (d == null) { MessageBox.Show("You must first select a distance from the list."); return; } Distance dCopy = new Distance(d); using (DistForm dist = new DistForm(dCopy, false)) { if (dist.ShowDialog(this) == DialogResult.OK) { // Change the distance stored in the leg LegFace face = this.CurrentFace; int spanIndex = distancesListBox.SelectedIndex; SpanInfo spanInfo = face.GetSpanData(spanIndex); spanInfo.ObservedDistance = dist.Distance; // Change the displayed distance distancesListBox.Items[spanIndex] = spanInfo.ObservedDistance; m_Edits.UpdateSpan(m_CurFaceIndex, spanIndex, dist.Distance); Rework(); Refresh(spanIndex); } } }
private void insertButton_Click(object sender, EventArgs e) { LegFace face = CurrentFace; if (face == null) { return; } Distance dist = GetSel(); if (dist == null) { MessageBox.Show("You must first select a distance from the list."); return; } // Are we inserting before or after the currently selected distance? bool isBefore = insBeforeRadioButton.Checked; // Get the user to specify a new distance. using (var dial = new DistForm(dist, false)) { if (dial.ShowDialog() == DialogResult.OK) { // Insert the new distance into the current leg. Distance newDist = dial.Distance; m_Edits.InsertSpan(m_CurFaceIndex, newDist, dist, isBefore); int index = face.Insert(newDist, dist, isBefore, true); Rework(); Refresh(index); } } }
private void updateButton_Click(object sender, EventArgs e) { // Get the selected distance. Distance d = (listBox.SelectedItem as Distance); if (d == null) { MessageBox.Show("You must first select a distance from the list."); return; } Distance dCopy = new Distance(d); using (DistForm dist = new DistForm(dCopy, false)) { if (dist.ShowDialog(this) == DialogResult.OK) { // Change the displayed distance m_CurrentFace.ObservedLengths[listBox.SelectedIndex] = dist.Distance; m_CurrentFace.Sections[listBox.SelectedIndex].ObservedLength = dist.Distance; m_UpdCmd.ErasePainting(); RefreshList(); } } }
private void updateButton_Click(object sender, EventArgs e) { // Get the selected distance. Distance d = (listBox.SelectedItem as Distance); if (d == null) { MessageBox.Show("You must first select a distance from the list."); return; } Distance dCopy = new Distance(d); using (DistForm dist = new DistForm(dCopy, false)) { if (dist.ShowDialog(this) == DialogResult.OK) { // Change the displayed distance m_CurrentFace.ObservedLengths[listBox.SelectedIndex] = dist.Distance; m_CurrentFace.Sections[listBox.SelectedIndex].ObservedLength = dist.Distance; m_UpdCmd.ErasePainting(); RefreshList(); } } }
private void updateButton_Click(object sender, EventArgs e) { // Get the selected distance. Distance d = GetSel(); if (d == null) { MessageBox.Show("You must first select a distance from the list."); return; } Distance dCopy = new Distance(d); using (DistForm dist = new DistForm(dCopy, false)) { if (dist.ShowDialog(this) == DialogResult.OK) { // Change the distance stored in the leg LegFace face = this.CurrentFace; int spanIndex = distancesListBox.SelectedIndex; SpanInfo spanInfo = face.GetSpanData(spanIndex); spanInfo.ObservedDistance = dist.Distance; // Change the displayed distance distancesListBox.Items[spanIndex] = spanInfo.ObservedDistance; m_Edits.UpdateSpan(m_CurFaceIndex, spanIndex, dist.Distance); Rework(); Refresh(spanIndex); } } }
private void insertButton_Click(object sender, EventArgs e) { LegFace face = CurrentFace; if (face == null) return; Distance dist = GetSel(); if (dist == null) { MessageBox.Show("You must first select a distance from the list."); return; } // Are we inserting before or after the currently selected distance? bool isBefore = insBeforeRadioButton.Checked; // Get the user to specify a new distance. using (var dial = new DistForm(dist, false)) { if (dial.ShowDialog() == DialogResult.OK) { // Insert the new distance into the current leg. Distance newDist = dial.Distance; m_Edits.InsertSpan(m_CurFaceIndex, newDist, dist, isBefore); int index = face.Insert(newDist, dist, isBefore, true); Rework(); Refresh(index); } } }