Beispiel #1
0
        /// <summary>
        /// De-facto the command is here.
        /// </summary>
        /// <param name="uiapp"></param>
        public void ShowForm(UIApplication uiapp)
        {
            //get the isntance of Revit Thread
            //to pass it to the Windows Form later
            if (null == _hWndRevit)
            {
                Process process
                  = Process.GetCurrentProcess();

                IntPtr h = process.MainWindowHandle;
                _hWndRevit = new WindowHandle(h);
            }

            if (m_MyForm == null || m_MyForm.IsDisposed)
            {
                //new handler
                RequestHandler handler = new RequestHandler();
                //new event
                ExternalEvent exEvent = ExternalEvent.Create(handler);

                m_MyForm = new Interface(uiapp, exEvent, handler);
                //pass parent (Revit) thread here
                m_MyForm.Show(_hWndRevit);
            }
        }
Beispiel #2
0
 public Result OnStartup(UIControlledApplication a)
 {
     ControlledApplication c_app = a.ControlledApplication;
     AddRibbonPanel(a);
     //a.DialogBoxShowing
     //+= new EventHandler<DialogBoxShowingEventArgs>(
     //    a_DialogBoxShowing);
     m_MyForm = null;  // no dialog needed yet; ThermalAsset command will bring it
     thisApp = this;  // static access to this application instance
     c_app.DocumentChanged
         += new EventHandler<Autodesk.Revit.DB.Events.DocumentChangedEventArgs>(
             c_app_DocumentChanged);
     return Result.Succeeded;
 }