/// <summary>
        /// Reacts to selection of the OK button in the dialog.
        /// </summary>
        /// <param name="wnd">The dialog window. If this matches the dialog that
        /// this command knows about, the command will be executed (and, on success,
        /// the dialog will be destroyed). If it's some other window, it must
        /// be a sub-dialog created by our guy, so let it handle the request.</param>
        /// <returns></returns>
        internal override bool DialFinish(Control wnd)
        {
            if (m_Dialog==null)
            {
                MessageBox.Show("LineExtensionUI.DialFinish - No dialog!");
                return false;
            }

            // If we are doing an update, alter the original operation.
            UpdateUI up = this.Update;

            if (up!=null)
            {
                // Get the original operation.
                LineExtensionOperation pop = (up.GetOp() as LineExtensionOperation);
                if (pop==null)
                {
                    MessageBox.Show("LineExtensionUI.DialFinish - Unexpected edit type.");
                    return false;
                }

                // Remember the changes as part of the UI object (the original edit remains
                // unchanged for now)
                UpdateItemCollection changes = pop.GetUpdateItems(m_Dialog.IsExtendFromEnd, m_Dialog.Length);
                if (!up.AddUpdate(pop, changes))
                    return false;
            }
            else
            {
                // Get info from the dialog
                m_IsExtendFromEnd = m_Dialog.IsExtendFromEnd;
                m_Length = m_Dialog.Length;
                IdHandle idh = m_Dialog.PointId;
                CadastralMapModel map = CadastralMapModel.Current;
                m_LineType = (m_Dialog.WantLine ? map.DefaultLineType : null);

                // Execute the edit
                LineExtensionOperation op = null;

                try
                {
                    op = new LineExtensionOperation(m_ExtendLine, m_IsExtendFromEnd, m_Length);
                    op.Execute(idh, m_LineType);
                }

                catch (Exception ex)
                {
                    MessageBox.Show(ex.StackTrace, ex.Message);
                    return false;
                }
            }

            // Destroy the dialog(s).
            KillDialogs();

            // Get the base class to finish up.
            return FinishCommand();
        }
        void InitUpdate(LineExtensionOperation pop)
        {
            Form parent = ParentForm;
            parent.Text = "Update Line Extension";

            m_ExtendLine = pop.ExtendedLine;
            m_IsExtendFromEnd = pop.IsExtendFromEnd;
            m_Length = new Distance(pop.Length);

            // Was an extension line added?
            m_WantLine = (pop.NewLine!=null);

            // Scroll the entity combo to the previously defined
            // entity type for the extension point.
            PointFeature point = pop.NewPoint;
            IEntity ent = point.EntityType;
            if (ent != null)
                pointTypeComboBox.SelectEntity(ent);

            // Display the original observed length.
            lengthTextBox.Text = m_Length.Format();

            // Display the point key (if any)
            idComboBox.DropDownStyle = ComboBoxStyle.DropDown;
            idComboBox.Text = point.FormattedKey;
        }