コード例 #1
0
        public Result Execute(ExternalCommandData commandData, ref string message, Autodesk.Revit.DB.ElementSet elements)
        {
            if (!DockablePane.PaneExists(DefaultFamilyTypes.PaneId) ||
                !DockablePane.PaneExists(DefaultElementTypes.PaneId))
            {
                return(Result.Failed);
            }

            UIApplication uiApp = commandData.Application;

            if (uiApp == null)
            {
                return(Result.Failed);
            }

            DockablePane pane = uiApp.GetDockablePane(DefaultFamilyTypes.PaneId);

            pane.Show();
            DockablePane elemTypePane = uiApp.GetDockablePane(DefaultElementTypes.PaneId);

            elemTypePane.Show();

            if (ThisApplication.DefaultFamilyTypesPane != null)
            {
                ThisApplication.DefaultFamilyTypesPane.SetDocument(commandData.Application.ActiveUIDocument.Document);
            }
            if (ThisApplication.DefaultElementTypesPane != null)
            {
                ThisApplication.DefaultElementTypesPane.SetDocument(commandData.Application.ActiveUIDocument.Document);
            }

            return(Result.Succeeded);
        }
コード例 #2
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);
        }
コード例 #3
0
ファイル: Command.cs プロジェクト: R3dNinja/RevitReady
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            UIApplication uiapp = commandData.Application;
            UIDocument    uidoc = uiapp.ActiveUIDocument;
            Application   app   = uiapp.Application;
            Document      doc   = uidoc.Document;

            m_document  = doc;
            m_uiapp     = uiapp;
            m_thisAppId = uiapp.Application.ActiveAddInId;

            DockablePane pane = uiapp.GetDockablePane(App.paneId);

            if (pane != null)
            {
                if (!pane.IsShown())
                {
                    pane.Show();
                }
                else
                {
                    pane.Hide();
                }
            }

            return(Result.Succeeded);
        }
コード例 #4
0
        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);
        }
コード例 #5
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";
            }
        }
コード例 #6
0
ファイル: MpFaceOptions.xaml.cs プロジェクト: sunjini/eZRvt
        public Autodesk.Revit.UI.DockablePane GetPanel(UIApplication uiApp)
        {
            _uiApp = uiApp;

            Autodesk.Revit.UI.DockablePane dp = uiApp.GetDockablePane(DockablePaneId_FaceWall);
            return(dp);
        }
コード例 #7
0
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            UIApplication uiapp = commandData.Application;

            if (DockablePane.PaneIsRegistered(App.PaneId))
            {
                DockablePane docpanel = uiapp.GetDockablePane(App.PaneId);

                if (docpanel.IsShown())
                {
                    docpanel.Hide();
                }
                else
                {
                    docpanel.Show();
                }
            }

            else
            {
                return(Result.Failed);
            }

            return(Result.Succeeded);
        }
コード例 #8
0
ファイル: Command.cs プロジェクト: vldch/DockableWindowTest
        public Result Execute(
            ExternalCommandData commandData,
            ref string message,
            ElementSet elements)
        {
            UIApplication uiapp = commandData.Application;

            if (DockablePane.PaneIsRegistered(Controls.Control1.PaneId))
            {
                DockablePane myCustomPane =
                    uiapp.GetDockablePane(Controls.Control1.PaneId);

                if (myCustomPane.IsShown())
                {
                    myCustomPane.Hide();
                }
                else
                {
                    myCustomPane.Show();
                }
            }

            else
            {
                return(Result.Failed);
            }

            return(Result.Succeeded);
        }
コード例 #9
0
ファイル: App.cs プロジェクト: songohu30/DockPanelButton
        private void HideDockableWindow(UIApplication application)
        {
            DockablePaneId dpid = new DockablePaneId(new Guid("{C38746CB-C632-4C88-9556-4DAEDB1A6E97}"));
            DockablePane   dp   = application.GetDockablePane(dpid);

            dp.Hide();
        }
コード例 #10
0
        public static void Init(UIApplication uiApp)
        {
            DockablePane   toolPalettePane = null;
            DockablePaneId toolPaletteId   = new DockablePaneId(new Guid("{D7C963CE-B7CA-426A-8D51-6E8254D21258}"));

            try
            {
                toolPalettePane = uiApp.GetDockablePane(toolPaletteId);
            }
            catch (Exception ex)
            {
                toolPalettePane = null;
            }


            if (toolPalettePane == null)
            {
                KbBimstoreApp.CreateToolPalette(KbBimstoreApp.activeUiContApp);
            }

            try
            {
                toolPalettePane = uiApp.GetDockablePane(toolPaletteId);
            }
            catch (Exception ex)
            {
                toolPalettePane = null;
            }


            if (toolPalettePane != null)
            {
                try
                {
                    KbBimstoreApp.ToolPaletUI.init(uiApp);
                    toolPalettePane.Show();
                }
                catch (Exception ex)
                {
                    Autodesk.Revit.UI.TaskDialog.Show("Exception", ex.Message);
                }
            }
        }
コード例 #11
0
    public static bool PaneExists(this UIApplication 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);
    }
コード例 #12
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;
        }
コード例 #13
0
 /// <summary>
 /// Method that is performed when Command is fired
 /// </summary>
 /// <param name="uiapp"></param>
 /// <returns></returns>
 public Result Execute(UIApplication uiapp)
 {
     if ((Cmd_RegisterEvents.thisCmd != null) && (Cmd_RegisterEvents.Registered == true))
     {
         DockablePane dp = uiapp.GetDockablePane(Cmd_RegisterDockableWindow.dpid);
         dp.Hide();
         return(Result.Succeeded);
     }
     else
     {
         TaskDialog.Show("Cmd_ShowDockableWindow", "DockablePane not Registered. Will not be displayed");
         return(Result.Failed);
     }
 }
コード例 #14
0
        /// <summary>
        /// 设置可停靠页面的可见性
        /// </summary>
        /// <param name="uiApplication"></param>
        /// <param name="state"></param>
        public void SetUserDockablePaneVisibility(UIApplication uiApplication, bool state)
        {
            DockablePane pane = uiApplication.GetDockablePane(userDockablePaneId);

            if (pane != null)
            {
                if (state)
                {
                    pane.Show();
                }
                else
                {
                    pane.Hide();
                }
            }
        }
コード例 #15
0
        /// <summary>
        /// Method that makes Dockable Window Active
        /// </summary>
        private void ShowDocakbleWindow()
        {
            //Acquire UIApplication instance from ThisApplication class
            UIApplication uiapp = ThisApplication.thisApp.uiapp;

            //skip if uiapp is not assigned
            if (uiapp == null)
            {
                return;
            }

            if ((Cmd_RegisterEvents.thisCmd != null) && (Cmd_RegisterEvents.Registered == true))
            {
                DockablePane dp = uiapp.GetDockablePane(Cmd_RegisterDockableWindow.dpid);
                dp.Show();
            }
            else
            {
                TaskDialog.Show("Cmd_ShowDockableWindow", "DockablePane not Registered. Will not be displayed");
            }
        }
コード例 #16
0
ファイル: App.cs プロジェクト: songohu30/DockPanelButton
        public void AlignButtonState(UIApplication application)
        {
            DockablePaneId dpid = new DockablePaneId(new Guid("{C38746CB-C632-4C88-9556-4DAEDB1A6E97}"));

            //Avoids an error when the user cancels document loading
            if (DockablePane.PaneExists(dpid))
            {
                DockablePane dp = application.GetDockablePane(dpid);
                //we are just checking current dock panel state. If it is visible then button is active (green) and the text says "Hide" because it will hide the panel on click.
                //if the panel is not shown then image is inactive (grey) and text says "Show"
                if (dp.IsShown())
                {
                    _button_medium.ItemText = "Hide Medium";
                    PushButton pb = _button_medium as PushButton;
                    pb.LargeImage = GetEmbeddedImage("Resources.Active.png");
                }
                else
                {
                    _button_medium.ItemText = "Show Medium";
                    PushButton pb = _button_medium as PushButton;
                    pb.LargeImage = GetEmbeddedImage("Resources.Inactive.png");
                }
            }
        }
コード例 #17
0
ファイル: MpFaceOptions.xaml.cs プロジェクト: sunjini/eZRvt
 public void HidePanel(UIApplication uiApp)
 {
     Autodesk.Revit.UI.DockablePane dp = uiApp.GetDockablePane(DockablePaneId_FaceWall);
     dp.Hide();
 }
コード例 #18
0
ファイル: MpFaceOptions.xaml.cs プロジェクト: sunjini/eZRvt
 public void ShowPanel(UIApplication uiApp)
 {
     _uiApp = uiApp;
     Autodesk.Revit.UI.DockablePane dp = uiApp.GetDockablePane(DockablePaneId_FaceWall);
     dp.Show();
 }