/// <summary> /// Constructor to extend the currently selected line. /// </summary> /// <param name="cc">The container for any dialogs</param> /// <param name="action">The action that initiated this command</param> /// <exception cref="InvalidOperationException">If a line is not currently selected</exception> internal LineExtensionUI(IControlContainer cc, IUserAction action) : base(cc, action) { LineFeature line = EditingController.SelectedLine; if (line == null) throw new InvalidOperationException("You must initially select the line you want to extend."); // The dialog will be created by Run(). m_Dialog = null; // Remember the line that is being extended. m_ExtendLine = line; // And initialize the parameters for the operation's Execute() call. m_Length = null; m_IsExtendFromEnd = true; m_LineType = null; }
/// <summary> /// Constructor for doing an update. /// </summary> /// <param name="editId">The ID of the edit this command deals with.</param> /// <param name="updcmd">The update command.</param> internal LineExtensionUI(IControlContainer cc, EditingActionId editId, UpdateUI updcmd) : base(cc, editId, updcmd) { // The dialog will be created by Run(). m_Dialog = null; // The line we extended is known via the update. m_ExtendLine = null; // And initialize the parameters for the operation's Execute() call. m_Length = null; m_IsExtendFromEnd = true; m_LineType = null; }
/// <summary> /// Starts the user interface (if any) for this command. /// </summary> /// <returns>True if command started ok.</returns> internal override bool Run() { // Don't run more than once. if (m_Dialog!=null) throw new InvalidOperationException("LineExtensionUI.Run - Command is already running."); // Are we doing an update? UpdateUI pup = this.Update; if (pup!=null) m_Dialog = new LineExtensionControl(pup); else m_Dialog = new LineExtensionControl(this, m_ExtendLine, this.Recall); this.Container.Display(m_Dialog); return true; }
/// <summary> /// Destroys any dialogs that are currently displayed. /// </summary> void KillDialogs() { this.Container.Clear(); if (m_Dialog!=null) { m_Dialog.Dispose(); m_Dialog = null; } }
public override void Dispose() { base.Dispose(); // removes any controls from container if (m_Dialog!=null) { m_Dialog.Dispose(); m_Dialog = null; } }