/// <summary> /// This is the method which launches the WPF window, and injects any methods that are /// wrapped by ExternalEventHandlers. This can be done in a number of different ways, and /// implementation will differ based on how the WPF is set up. /// </summary> /// <param name="uiapp">The Revit UIApplication within the add-in will operate.</param> public void ShowForm(ExternalCommandData commandData) { DockablePane myForm = commandData.Application.GetDockablePane(paneId); // If we do not have a dialog yet, create and show it if (myForm != null && myForm == null) { return; } //EXTERNAL EVENTS WITH ARGUMENTS //EXTERNAL EVENTS WITH ARGUMENTS EventHandlerMethodPropertiesOnOff evP = new EventHandlerMethodPropertiesOnOff(); EventHandlerMethodProjectBrowserOnOff evPB = new EventHandlerMethodProjectBrowserOnOff(); // The dialog becomes the owner responsible for disposing the objects given to it. //myForm = new NewForm(evP, evPB); myForm.Show(); }
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); }
public NewForm(EventHandlerMethodPropertiesOnOff eExternalMethodPropertiesOnOff, EventHandlerMethodProjectBrowserOnOff eExternalMethodProjectBrowserOnOff) { InitializeComponent(); _mExternalMethodPropertiesOnOff = eExternalMethodPropertiesOnOff; _ExternalMethodProjectBrowserOnOff = eExternalMethodProjectBrowserOnOff; }