/// <summary> /// Implements the OnStartup event /// </summary> /// <param name="application"></param> /// <returns></returns> public Result OnStartup(UIControlledApplication application) { m_MyForm = null; // no dialog needed yet; the command will bring it thisApp = this; // static access to this application instance return(Result.Succeeded); }
/// <summary> /// Implements the OnShutdown event /// </summary> /// <param name="application"></param> /// <returns></returns> public Result OnShutdown(UIControlledApplication application) { if (m_MyForm != null && !m_MyForm.IsDisposed) { m_MyForm.Dispose(); m_MyForm = null; // if we've had a dialog, we had subscribed application.Idling -= IdlingHandler; } return(Result.Succeeded); }
/// <summary> /// This method creates and shows a modeless dialog, unless it already exists. /// </summary> /// <remarks> /// The external command invokes this on the end-user's request /// </remarks> /// public void ShowForm(UIApplication uiapp) { m_revit = uiapp; m_document = uiapp.ActiveUIDocument.Document; // If we do not have a dialog yet, create and show it if (m_MyForm == null || m_MyForm.IsDisposed) { m_MyForm = new AppearanceAssetEditingForm(); m_MyForm.Show(); // if we have a dialog, we need Idling too uiapp.Idling += IdlingHandler; } }