コード例 #1
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);
        }
コード例 #2
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);
            }
        }
コード例 #3
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);
        }