Exemple #1
0
        public static void ProjectBrowserOnOff(UIApplication uiApp, NewForm ui, Document doc)
        {
            Util.LogThreadInfo("Project Browser On Off");

            // rename all the sheets, but first open a transaction
            using (Transaction t = new Transaction(doc, "Project Browser On Off"))
            {
                Util.LogThreadInfo("Project Browser On Off Transaction");

                // start a transaction within the valid Revit API context
                t.Start("Project Browser On Off");

                // our command is a postable command

                RevitCommandId id_built_in = RevitCommandId.LookupPostableCommandId(PostableCommand.ProjectBrowser);
                uiApp.PostCommand(id_built_in);

                t.Commit();
                t.Dispose();
            }
        }
Exemple #2
0
        public Result OnStartup(UIControlledApplication a)
        {
            //Register dockable pane
            //EXTERNAL EVENTS WITH ARGUMENTS
            EventHandlerMethodPropertiesOnOff     evP  = new EventHandlerMethodPropertiesOnOff();
            EventHandlerMethodProjectBrowserOnOff evPB = new EventHandlerMethodProjectBrowserOnOff();
            NewForm Form = new NewForm(evP, evPB);

            // DockablePaneId paneId = new DockablePaneId(new Guid("9d7ed357-534f-4d87-afc4-8e784e3b119e"));

            myForm = Form;

            ThisApp = this;

            a.RegisterDockablePane(paneId, "P PB", Form as IDockablePaneProvider);

            // Method to add Tab and Panel
            RibbonPanel panel            = RibbonPanel(a);
            string      thisAssemblyPath = Assembly.GetExecutingAssembly().Location;

            // BUTTON FOR THE DOCKABLE WPF
            if (panel.AddItem(
                    new PushButtonData("PropertiesProjectBrowserOnOff", "PropertiesProjectBrowserOnOff", thisAssemblyPath,
                                       "PropertiesProjectBrowserOnOff.EntryCommand")) is PushButton button)
            {
                // defines the tooltip displayed when the button is hovered over in Revit's ribbon
                button.ToolTip = "Turn Properties & ProjectBrowser On/Off";
                // defines the icon for the button in Revit's ribbon - note the string formatting
                Uri         uriImage   = new Uri("pack://application:,,,/PropertiesProjectBrowserOnOff;component/Resources/code-small.png");
                BitmapImage largeImage = new BitmapImage(uriImage);
                button.LargeImage = largeImage;
            }

            // listeners/watchers for external events (if you choose to use them)
            a.ApplicationClosing += a_ApplicationClosing; //Set Application to Idling
            a.Idling             += a_Idling;

            return(Result.Succeeded);
        }