Пример #1
0
        //   The external command invokes this on the end-user's request
        public void ShowForm()
        {
            // If we do not have a dialog yet, create and show it
            if (m_MyForm == null)
            {
                // A new handler to handle request posting by the dialog
                ClasherHandler handler = new ClasherHandler();

                // External Event for the dialog to use (to post requests)
                ExternalEvent exEvent = ExternalEvent.Create(handler);

                // External execution handler to provide the needed context by revit to perform modifications on active document
                CleanViewHandler cleanViewHandler = new CleanViewHandler();
                // External event used for clean elements on the active view
                ExternalEvent externalCleanEvent = ExternalEvent.Create(cleanViewHandler);

                // We give the objects to the new dialog;
                // The dialog becomes the owner responsible for disposing them, eventually.
                m_MyForm         = new MainUserControl(exEvent, handler, externalCleanEvent);
                m_MyForm.Closed += MyFormClosed;
                m_MyForm.Show();
            }
        }
Пример #2
0
 private void MyFormClosed(object sender, EventArgs e)
 {
     m_MyForm = null;
 }