public Result Execute(UIApplication uiapp)
        {
            thisCmd = this;

            //For Each action that requires change in Revit DB (open transaction)
            //Initialize new instance of Event Handler
            //Assign Event Handler instance to ExEvent
            #region Assigning Handlers to ExEvents

            #region GENERIC
            EventHandler_Generic_GoToView handler_Generic_GoToView = new EventHandler_Generic_GoToView();
            this.ExEvent_Generic_GoToView = ExternalEvent.Create(handler_Generic_GoToView);

            EventHandler_Generic_ZoomViewToElement handler_Generic_ZoomViewToElement = new EventHandler_Generic_ZoomViewToElement();
            this.ExEvent_Generic_ZoomViewToElement = ExternalEvent.Create(handler_Generic_ZoomViewToElement);

            EventHandler_Generic_RemoveInstance handler_Generic_RemoveInstance = new EventHandler_Generic_RemoveInstance();
            this.ExEvent_Generic_RemoveInstance = ExternalEvent.Create(handler_Generic_RemoveInstance);
            #endregion

            #region REVISIONS
            EventHandler_Revision_Issued handler_Revision_Issued = new EventHandler_Revision_Issued();
            this.ExEvent_Revision_Issued = ExternalEvent.Create(handler_Revision_Issued);

            EventHandler_Revision_Visibility handler_Revision_Visibility = new EventHandler_Revision_Visibility();
            this.ExEvent_Revision_Visibility = ExternalEvent.Create(handler_Revision_Visibility);

            EventHandler_Revision_ChangeComment handler_Revision_ChangeComment = new EventHandler_Revision_ChangeComment();
            this.ExEvent_Revision_ChangeComment = ExternalEvent.Create(handler_Revision_ChangeComment);

            EventHandler_Revision_ChangeRevDescription handler_Revision_ChangeRevDescription = new EventHandler_Revision_ChangeRevDescription();
            this.ExEvent_Revision_ChangeRevDescription = ExternalEvent.Create(handler_Revision_ChangeRevDescription);

            EventHandler_Revision_NewRevision handler_Revision_NewRevision = new EventHandler_Revision_NewRevision();
            this.ExEvent_Revision_NewRevision = ExternalEvent.Create(handler_Revision_NewRevision);

            EventHandler_Revision_HideAllButThis handler_Revision_HideAllButThis = new EventHandler_Revision_HideAllButThis();
            this.ExEvent_Revision_HideAllButThis = ExternalEvent.Create(handler_Revision_HideAllButThis);

            EventHandler_Revision_Reorder handler_Revision_Reorder = new EventHandler_Revision_Reorder();
            this.ExEvent_Revision_Reorder = ExternalEvent.Create(handler_Revision_Reorder);
            #endregion

            #endregion

            Registered = true;
            return(Result.Succeeded);
        }
Exemple #2
0
        /// <summary>
        /// Actions performed when application has been initialized but Document is not opened yet
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ControlledApplication_ApplicationInitialized(object sender, Autodesk.Revit.DB.Events.ApplicationInitializedEventArgs e)
        {
            if (this.uiapp == null)
            {
                this.uiapp = new UIApplication(sender as Autodesk.Revit.ApplicationServices.Application);
            }

            //Register Dockable Window Event
            Cmd_RegisterDockableWindow cmd_RegisterWindow = new Cmd_RegisterDockableWindow();

            cmd_RegisterWindow.Execute(this.uiapp);

            //Register All Events that would require open transactions in Revit DB
            Cmd_RegisterEvents cmd_RegisterEvents = new Cmd_RegisterEvents();

            cmd_RegisterEvents.Execute(this.uiapp);
        }
Exemple #3
0
        /// <summary>
        /// Actions performed whilst Document is opening
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ControlledApplication_DocumentOpening(object sender, Autodesk.Revit.DB.Events.DocumentOpeningEventArgs e)
        {
            if (this.uiapp == null)
            {
                this.uiapp = new UIApplication(sender as Autodesk.Revit.ApplicationServices.Application);
            }

            //register events if haven't been registered yet
            if ((Cmd_RegisterDockableWindow.thisCmd == null) && (Cmd_RegisterDockableWindow.Registered == false))
            {
                Cmd_RegisterDockableWindow cmd_RegisterWindow = new Cmd_RegisterDockableWindow();
                cmd_RegisterWindow.Execute(this.uiapp);
            }

            if ((Cmd_RegisterEvents.thisCmd == null) && (Cmd_RegisterEvents.Registered == false))
            {
                Cmd_RegisterEvents cmd_RegisterEvents = new Cmd_RegisterEvents();
                cmd_RegisterEvents.Execute(this.uiapp);
            }
        }
Exemple #4
0
        /// <summary>
        /// Actions performed when Document has been opened
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="args"></param>
        private void ControlledApplication_DocumentOpened(object sender, DocumentOpenedEventArgs args)
        {
            this.doc           = args.Document;
            this.uidoc         = thisApp.uiapp.ActiveUIDocument;
            this.projectNumber = this.doc.Title;

            //register events if haven't been registered yet
            if ((Cmd_RegisterDockableWindow.thisCmd == null) && (Cmd_RegisterDockableWindow.Registered == false))
            {
                Cmd_RegisterDockableWindow cmd_RegisterWindow = new Cmd_RegisterDockableWindow();
                cmd_RegisterWindow.Execute(this.uiapp);
            }

            if ((Cmd_RegisterEvents.thisCmd == null) && (Cmd_RegisterEvents.Registered == false))
            {
                Cmd_RegisterEvents cmd_RegisterEvents = new Cmd_RegisterEvents();
                cmd_RegisterEvents.Execute(this.uiapp);
            }

            Cmd_ShowDockableWindow cmd_ShowWindow = new Cmd_ShowDockableWindow();

            cmd_ShowWindow.Execute(sender as UIApplication);
        }