Exemplo n.º 1
0
        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);
                }
            }
        }