Exemplo n.º 1
0
        public Autodesk.Revit.UI.Result Execute(ExternalCommandData commandData, ref string message,
                                                ElementSet elements)
        {
            uiApp = commandData.Application;
            Autodesk.Revit.ApplicationServices.Application app = uiApp.Application;
            m_Doc = uiApp.ActiveUIDocument.Document;

            string m_mainPageGuid = "ef5b0ecc-5859-4642-bb27-769393383d99";

            Guid retval = Guid.Empty;

            try
            {
                retval = new Guid(m_mainPageGuid);
            }
            catch (Exception)
            {
            }

            DockablePaneId sm_UserDockablePaneId = new DockablePaneId(retval);
            DockablePane   pane = uiApp.GetDockablePane(sm_UserDockablePaneId);

            pane.Show();

            return(Result.Succeeded);
        }
Exemplo n.º 2
0
        public Result Execute(
            ExternalCommandData commandData,
            ref string message,
            ElementSet elements)
        {
            DockablePaneProviderData data = new DockablePaneProviderData();
            MainPage MainDockableWindow   = new MainPage();

            m_MyDockableWindow = MainDockableWindow;
            //MainDockableWindow.SetupDockablePane(me);
            data.FrameworkElement          = MainDockableWindow as System.Windows.FrameworkElement;
            data.InitialState              = new DockablePaneState();
            data.InitialState.DockPosition = DockPosition.Tabbed;
            //DockablePaneId targetPane;
            //if (m_targetGuid == Guid.Empty)
            //    targetPane = null;
            //else targetPane = new DockablePaneId(m_targetGuid);
            //if (m_position == DockPosition.Tabbed)
            data.InitialState.TabBehind = DockablePanes.BuiltInDockablePanes.ProjectBrowser;
            DockablePaneId dpid = new DockablePaneId(new Guid("{D7C963CE-B7CA-426A-8D51-6E8254D21157}"));

            commandData.Application.RegisterDockablePane(dpid, "AEC Dockable Window", MainDockableWindow as IDockablePaneProvider);
            commandData.Application.ViewActivated += new EventHandler <ViewActivatedEventArgs>(Application_ViewActivated);
            return(Result.Succeeded);
        }
Exemplo n.º 3
0
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            // dockable window
            Viewer dock = new Viewer();

            dockableWindow = dock;
            edata          = commandData;

            // create a new dockable pane id
            DockablePaneId id = new DockablePaneId(new Guid("{68D44FAC-CF09-46B2-9544-D5A3F809373C}"));

            try
            {
                // register dockable pane
                commandData.Application.RegisterDockablePane(id, "TwentyTwo Dockable Sample",
                                                             dockableWindow as IDockablePaneProvider);
                TaskDialog.Show("Info Message", "Dockable window have registered!");
                // subscribe document opened event
                commandData.Application.Application.DocumentOpened += new EventHandler <Autodesk.Revit.DB.Events.DocumentOpenedEventArgs>(Application_DocumentOpened);
                // subscribe view activated event
                commandData.Application.ViewActivated += new EventHandler <ViewActivatedEventArgs>(Application_ViewActivated);
            }
            catch (Exception ex)
            {
                // show error info dialog
                TaskDialog.Show("Info Message", ex.Message);
            }

            // return result
            return(Result.Succeeded);
        }
        public Result OnStartup(UIControlledApplication application)
        {
            ThisApp = this;

            var elementCategoryFilter = new ElementCategoryFilter(BuiltInCategory.OST_GenericAnnotation);

            _updaterModified = new UpdaterModified(application.ActiveAddInId);
            if (!UpdaterRegistry.IsUpdaterRegistered(_updaterModified.GetUpdaterId()))
            {
                UpdaterRegistry.RegisterUpdater(_updaterModified);
                UpdaterRegistry.AddTrigger(_updaterModified.GetUpdaterId(), elementCategoryFilter, Element.GetChangeTypeAny());
            }

            _updaterAdded = new UpdaterAdded(application.ActiveAddInId);
            if (!UpdaterRegistry.IsUpdaterRegistered(_updaterAdded.GetUpdaterId()))
            {
                UpdaterRegistry.RegisterUpdater(_updaterAdded);
                UpdaterRegistry.AddTrigger(_updaterAdded.GetUpdaterId(), elementCategoryFilter, Element.GetChangeTypeElementAddition());
            }

            _paneId = new DockablePaneId(Guid.NewGuid());
            _handler = new RequestHandler();
            _exEvent = ExternalEvent.Create(_handler);
            _sheetNoteModel = new ViewModel();
            _mainPage = new MainPage { Resources = {["ViewModel"] = _sheetNoteModel } };

            application.RegisterDockablePane(_paneId, "Sheet Note Manager", (IDockablePaneProvider)_mainPage);
            application.ControlledApplication.DocumentClosed += new EventHandler<DocumentClosedEventArgs>(OnDocumentClosed);
            application.ControlledApplication.DocumentOpened += new EventHandler<DocumentOpenedEventArgs>(OnDocumentOpened);

            return Result.Succeeded;
        }
Exemplo n.º 5
0
        private void HideDockableWindow(UIApplication application)
        {
            DockablePaneId dpid = new DockablePaneId(new Guid("{C38746CB-C632-4C88-9556-4DAEDB1A6E97}"));
            DockablePane   dp   = application.GetDockablePane(dpid);

            dp.Hide();
        }
Exemplo n.º 6
0
        private System.IO.TextWriter m_textWriter;  //Used to re-route any standard IO to the WPF UI.


        #endregion

        /// <summary>
        /// Called by Revit to initialize dockable pane settings set in DockingSetupDialog.
        /// </summary>
        /// <param name="data"></param>
        public void SetupDockablePane(Autodesk.Revit.UI.DockablePaneProviderData data)
        {
            data.FrameworkElement = this as FrameworkElement;
            DockablePaneProviderData d = new DockablePaneProviderData();


            data.InitialState = new Autodesk.Revit.UI.DockablePaneState();
            data.InitialState.DockPosition = m_position;
            DockablePaneId targetPane;

            if (m_targetGuid == Guid.Empty)
            {
                targetPane = null;
            }
            else
            {
                targetPane = new DockablePaneId(m_targetGuid);
            }
            if (m_position == DockPosition.Tabbed)
            {
                data.InitialState.TabBehind = targetPane;
            }


            if (m_position == DockPosition.Floating)
            {
                data.InitialState.SetFloatingRectangle(new Autodesk.Revit.UI.Rectangle(m_left, m_top, m_right, m_bottom));
            }

            Log.Message("***Intial docking parameters***");
            Log.Message(APIUtility.GetDockStateSummary(data.InitialState));
        }
Exemplo n.º 7
0
        /// <summary>
        /// Method to register dock panel at zero doc state
        /// </summary>
        /// <param name="app"></param>
        private void RegisterDockPanel(UIControlledApplication app)
        {
            FamilyBrowserWPF dockPage = new FamilyBrowserWPF();
            DockablePaneId   dpId     = new DockablePaneId(new Guid("{22827024-7B1A-4D88-80A5-1A8E894F1057}"));

            app.RegisterDockablePane(dpId, "Family Browser", dockPage as IDockablePaneProvider);
        }
        public virtual Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            m_UIApp = commandData.Application;
            m_UIDoc = m_UIApp.ActiveUIDocument;

            MainPanel mainpanel = Ribbon.instance.GetMainPanel();

            mainpanel.Init(m_UIApp);

            string modelDectionGUID = "9202DA7D-2BFA-4445-A621-904EDB479DD8";
            Guid   retval           = Guid.Empty;

            try {
                retval = new Guid(modelDectionGUID);
            } catch (Exception) {
                throw;
            }

            DockablePaneId dockablePaneId = new DockablePaneId(retval);
            DockablePane   dockablePane   = m_UIApp.GetDockablePane(dockablePaneId);

            dockablePane.Show();

            return(Result.Succeeded);
        }
Exemplo n.º 9
0
        /// <summary>
        /// Registers Communicator Dockable Panel.
        /// </summary>
        /// <param name="application">UIControlledApp</param>
        public static void RegisterCommunicator(UIControlledApplication application)
        {
            var view = new CommunicatorView();

            AppCommand.CommunicatorWindow = view;

            var unused = new DockablePaneProviderData
            {
                FrameworkElement = AppCommand.CommunicatorWindow,
                InitialState     = new DockablePaneState
                {
                    DockPosition = DockPosition.Tabbed,
                    TabBehind    = DockablePanes.BuiltInDockablePanes.ProjectBrowser
                }
            };

            var dpid = new DockablePaneId(new Guid(Properties.Resources.CommunicatorGuid));

            try
            {
                // (Konrad) It's possible that a dockable panel with the same id already exists
                // This ensures that we don't get an exception here.
                application.RegisterDockablePane(dpid, "Mission Control", AppCommand.CommunicatorWindow);
            }
            catch (Exception e)
            {
                Log.AppendLog(LogMessageType.EXCEPTION, e.Message);
            }
        }
Exemplo n.º 10
0
        /// <summary>
        /// Shows or Hides the Communicator dockable pane.
        /// </summary>
        /// <param name="application">UIApp</param>
        public void ToggleCommunicator(UIApplication application)
        {
            var dpid = new DockablePaneId(new Guid(Properties.Resources.CommunicatorGuid));
            var dp   = application.GetDockablePane(dpid);

            if (dp == null)
            {
                return;
            }

            var assembly = Assembly.GetExecutingAssembly();

            if (dp.IsShown())
            {
                dp.Hide();
                AppCommand.Instance.CommunicatorButton.LargeImage = ButtonUtil.LoadBitmapImage(assembly, "HOK.MissionControl", "communicatorOff_32x32.png");
                AppCommand.Instance.CommunicatorButton.ItemText   = "Show" + Environment.NewLine + "Communicator";
            }
            else
            {
                dp.Show();
                AppCommand.Instance.CommunicatorButton.LargeImage = ButtonUtil.LoadBitmapImage(assembly, "HOK.MissionControl", "communicatorOn_32x32.png");
                AppCommand.Instance.CommunicatorButton.ItemText   = "Hide" + Environment.NewLine + "Communicator";
            }
        }
Exemplo n.º 11
0
        private MainPage RegisterDockableWindow(UIControlledApplication application)
        {
            #region Register DockableDialog
            DockablePaneProviderData data = new DockablePaneProviderData();

            MainPage MainDockableWindow = new MainPage();

            m_MyDockableWindow = MainDockableWindow;

            //MainDockableWindow.SetupDockablePane(me);

            data.FrameworkElement = MainDockableWindow as System.Windows.FrameworkElement;
            data.InitialState     = new DockablePaneState();

            data.InitialState.DockPosition = DockPosition.Tabbed;


            data.InitialState.TabBehind = DockablePanes.BuiltInDockablePanes.ProjectBrowser;

            DockablePaneId dpid = new DockablePaneId(new Guid("{4f3caa71-44fa-4329-9c9c-687956834eac}"));

            application.RegisterDockablePane(dpid, "NFPA 130 Simulator", MainDockableWindow as IDockablePaneProvider);


            return(MainDockableWindow);

            #endregion
        }
Exemplo n.º 12
0
        public static void RegisterPalette(UIControlledApplication app)
        {
            var view = new PaletteMainView()
            {
                DataContext = new PaletteViewModel(EventInstance.Instance.EventAggregator)
            };

            App.PaletteWindow = view;
            var unused = new DockablePaneProviderData
            {
                FrameworkElement = App.PaletteWindow,
                InitialState     = new DockablePaneState
                {
                    DockPosition = DockPosition.Tabbed,
                    TabBehind    = DockablePanes.BuiltInDockablePanes.ProjectBrowser
                }
            };
            var dpid = new DockablePaneId(new Guid(Properties.Resources.PaletteGuid));

            try
            {
                // It's possible that a dockable panel with the same id already exists
                // This ensures that we don't get an exception here.
                app.RegisterDockablePane(dpid, "Home", App.PaletteWindow);
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
            }
        }
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            DockablePaneId dockablePaneId = new DockablePaneId(Application.paneGuid);
            DockablePane   dockablePane   = commandData.Application.GetDockablePane(dockablePaneId);

            dockablePane.Show();
            return(0);
        }
Exemplo n.º 14
0
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            DockablePaneId dpid = new DockablePaneId(new Guid("FA0C04E6-F9E7-413A-9D33-CFE32622E7B8"));
            DockablePane   dp   = commandData.Application.GetDockablePane(dpid);

            dp.Show();
            return(Result.Succeeded);
        }
Exemplo n.º 15
0
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            DockablePaneId dpid = new DockablePaneId(new Guid("{D7C963CE-B7CA-426A-8D51-6E8254D21157}"));
            DockablePane   dp   = commandData.Application.GetDockablePane(dpid);

            dp.Show();
            return(Result.Succeeded);
        }
Exemplo n.º 16
0
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            var uiapp  = commandData.Application;
            var paneId = new DockablePaneId(MyGuid);

            uiapp.GetDockablePane(paneId).Show();

            return(Result.Succeeded);
        }
Exemplo n.º 17
0
        public static Result test(ExternalCommandData cdata)
        {
            DockablePaneId pbId = Autodesk.Revit.UI.DockablePanes.BuiltInDockablePanes.ProjectBrowser;

            //Autodesk.Revit.UI.DockablePane pane = new DockablePane(pbId);
            var pb = cdata.Application.GetDockablePane(pbId);

            return(Result.Succeeded);
        }
Exemplo n.º 18
0
    public static void RegisterDockablePane(this UIControlledApplication application,
        Guid id, string title,FrameworkElement dockElement, DockablePaneState state )
    {
        var dPid = new DockablePaneId(id);

        var dataProvider = new DockablePaneProviderData {FrameworkElement = dockElement,InitialState = state};
        IDockablePaneProvider provider = new DockPageProvider(dataProvider);
        application.RegisterDockablePane(dPid, title, provider);
    }
Exemplo n.º 19
0
        private void SetPanelData(ExternalCommandData commandData, List <FamilyData> familyData)
        {
            DockablePaneId dpid = new DockablePaneId(new Guid("209923d1-7cdc-4a1c-a4ad-1e2f9aae1dc5"));
            DockablePane   dp   = commandData.Application.GetDockablePane(dpid);

            FamilyManagerDockable.WPFpanel.CategoryName.Content = " " + CategoryName + " ";
            FamilyManagerDockable.WPFpanel.GenerateGrid(familyData);
            dp.Show();
        }
Exemplo n.º 20
0
        /// <summary>
        /// The DockablePanelActivated
        /// </summary>
        private void DockablePanelActivated()
        {
            PanelProprety panelPropreties = new PanelProprety();

            _panelProprety = panelPropreties;
            DockablePaneId paneId = new DockablePaneId(new Guid("{D7C963CE-B7CA-426A-8D51-6E8254D21157}"));

            _uicapp.RegisterDockablePane(paneId, "Historiques", (IDockablePaneProvider)panelPropreties);
        }
Exemplo n.º 21
0
        /// <summary>
        /// Executes the specified command data.
        /// </summary>
        /// <param name="commandData">The command data.</param>
        /// <param name="message">The message.</param>
        /// <param name="elements">The elements.</param>
        /// <returns></returns>
        /// <exception cref="System.NotImplementedException"></exception>
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            var dpid = new DockablePaneId(PaneIdentifiers.GetManagerPaneIdentifier());
            var dp   = commandData.Application.GetDockablePane(dpid);

            dp.Show();

            return(Result.Succeeded);
        }
Exemplo n.º 22
0
        public override void SetupUI()
        {
            var dPid = new DockablePaneId(new Guid(AppConstants.APP_ID));

            if (!DockablePane.PaneIsRegistered(dPid))
            {
                DockPane_Provider dataprovider = new DockPane_Provider();
                _uiapp.RegisterDockablePane(dPid, AppConstants.APP_NAME, dataprovider as IDockablePaneProvider);
            }
        }
Exemplo n.º 23
0
        private void RegisterDockPanel(UIControlledApplication app)
        {
            DockablePaneProviderData data          = new DockablePaneProviderData();
            DockPanelPage            dockPanelPage = new DockPanelPage();

            dockPanelPage.SetupDockablePane(data);
            DockablePaneId dpid = new DockablePaneId(new Guid("{C38746CB-C632-4C88-9556-4DAEDB1A6E97}"));

            app.RegisterDockablePane(dpid, "MyDockPanel", dockPanelPage as IDockablePaneProvider);
        }
Exemplo n.º 24
0
        /// <summary>
        /// The Execute
        /// </summary>
        /// <param name="commandData">The commandData<see cref="ExternalCommandData"/></param>
        /// <param name="message">The message<see cref="string"/></param>
        /// <param name="elements">The elements<see cref="ElementSet"/></param>
        /// <returns>The <see cref="Result"/></returns>
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            DockablePaneId dpid = new DockablePaneId(new Guid(Properties.Resources.PaletteGuid));

            DockablePane dp = commandData.Application
                              .GetDockablePane(dpid);

            dp.Show();

            return(Result.Succeeded);
        }
Exemplo n.º 25
0
 public static bool PaneExists(this UIControlledApplication application, Guid id, out DockablePane pane)
 {
     var dPid = new DockablePaneId(id);
     if (DockablePane.PaneExists(dPid))
     {
         pane = application.GetDockablePane(dPid);
         return true;
     }
     pane = null;
     return false;
 }
Exemplo n.º 26
0
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            DockablePaneId dpid = new DockablePaneId(
                new Guid("{F1D5DCB2-DB78-483C-8A77-C7BD7CBC6557}"));

            DockablePane dp = commandData.Application.GetDockablePane(dpid);

            dp.Show();

            return(Result.Succeeded);
        }
Exemplo n.º 27
0
    public static void RegisterDockablePane(this UIControlledApplication application,
                                            Guid id, string title, FrameworkElement dockElement, DockablePaneState state)
    {
        var dPid = new DockablePaneId(id);

        var dataProvider = new DockablePaneProviderData {
            FrameworkElement = dockElement, InitialState = state
        };
        IDockablePaneProvider provider = new DockPageProvider(dataProvider);

        application.RegisterDockablePane(dPid, title, provider);
    }
Exemplo n.º 28
0
    public static bool PaneExists(this UIControlledApplication application, Guid id, out DockablePane pane)
    {
        var dPid = new DockablePaneId(id);

        if (DockablePane.PaneExists(dPid))
        {
            pane = application.GetDockablePane(dPid);
            return(true);
        }
        pane = null;
        return(false);
    }
Exemplo n.º 29
0
        //This method will be called OnStartup() to (hopefully) create a custom dockable pane maybe
        public void AddCustomPane(UIControlledApplication app)
        {
            PaneProvider p = new PaneProvider(new DockablePaneProviderData());

            Guid           id = new Guid("827AC140-6F44-4c03-82FE-292705581800");
            DockablePaneId g  = new DockablePaneId(id);

            app.RegisterDockablePane(g, "Custom Pane", p);
            DockablePane myPain = new DockablePane(g);

            myPain.Show();
        }
Exemplo n.º 30
0
        public Result Execute(
            ExternalCommandData commandData,
            ref string message,
            ElementSet elements)
        {
            DockablePaneId dpid = new DockablePaneId(new Guid("{4f3caa71-44fa-4329-9c9c-687956834eac}"));

            DockablePane dp = commandData.Application.GetDockablePane(dpid);

            dp.Hide();

            return(Result.Succeeded);
        }
Exemplo n.º 31
0
        /// <summary>
        /// Disables Mission Control Communicator docable panel and button.
        /// </summary>
        private static void DisableCommunicator(UIApplication app)
        {
            var dpid = new DockablePaneId(new Guid(Properties.Resources.CommunicatorGuid));
            var dp   = app.GetDockablePane(dpid);

            if (dp == null)
            {
                return;
            }

            dp.Hide();
            AppCommand.Instance.CommunicatorButton.Enabled = false;
        }
Exemplo n.º 32
0
        /// <summary>
        /// Method that is executed when Command is fired
        /// </summary>
        /// <param name="uiapp"></param>
        /// <returns></returns>
        public Result Execute(UIApplication uiapp)
        {
            this.MainDockableWindow = new MainPage();
            DockablePaneProviderData data = new DockablePaneProviderData();

            dpid = new DockablePaneId(new Guid("{D7C963CE-B7CA-426A-8D51-6E8254D21157}"));

            MainDockableWindow.SetupDockablePane(data);
            uiapp.RegisterDockablePane(dpid, "SampleTool-Revisions", this.MainDockableWindow as IDockablePaneProvider);

            Registered = true;
            return(Result.Succeeded);
        }
Exemplo n.º 33
0
        /// <summary>
        /// Return dockable pane inforamtion, given a DockablePaneId
        /// </summary>
        public string GetPaneSummary(DockablePaneId id)
        {
            DockablePane pane = null;

            try
            {
                pane = m_uiApplication.GetDockablePane(id);
                return(GetPaneSummary(pane));
            }
            catch (Exception ex)
            {
                return(ex.Message);
            }
        }
Exemplo n.º 34
0
        public Result OnStartup(UIControlledApplication application)
        {
            var container = CommandContainer.Instance();
            if (container.Valid)
            {
                container.BuildRibbon(application);
            }

            var dPid = new DockablePaneId(DockConstants.Id);
            if (!DockablePane.PaneIsRegistered(dPid))
            {
                var state = new DockablePaneState {DockPosition = DockPosition.Right};
                var element = new DockPage();
                application.RegisterDockablePane(DockConstants.Id, DockConstants.Name, element, state);
            }

            return Result.Succeeded;
        }