From 4f89840b0c95ebd0ed79dff1ff1973d030a6c17d Mon Sep 17 00:00:00 2001 From: zhangyuekai <zhangyuekai@126.com> Date: 星期四, 15 八月 2024 12:18:20 +0800 Subject: [PATCH] ... --- HStation.RevitDev/RevitDataExport/Utility/DockPaneUtil.cs | 107 ++++++++++++++++++++++++++++++++++++----------------- 1 files changed, 72 insertions(+), 35 deletions(-) diff --git a/HStation.RevitDev/RevitDataExport/Utility/DockPaneUtil.cs b/HStation.RevitDev/RevitDataExport/Utility/DockPaneUtil.cs index cf43aa3..5489659 100644 --- a/HStation.RevitDev/RevitDataExport/Utility/DockPaneUtil.cs +++ b/HStation.RevitDev/RevitDataExport/Utility/DockPaneUtil.cs @@ -1,54 +1,91 @@ 锘縰sing Autodesk.Revit.UI; +using Autodesk.Revit.UI.Events; +using HStation.RevitDev.Model.ModelEnum; +using HStation.RevitDev.RevitDataExport.Common; +using HStation.RevitDev.RevitDataExport.Forms; using System; +using System.Data.SqlTypes; namespace HStation.RevitDev.RevitDataExport.Utility { public class DockPaneUtil { + public static void HideInstanceDockablePane(UIControlledApplication uiControlledApp, string strGuid) + { + Guid guid = new Guid(strGuid); + DockablePaneId id = new DockablePaneId(guid); + DockablePane pane = null; + try + { + pane = uiControlledApp.GetDockablePane(id); + } + catch (Exception ex) + { + string message = ex.Message; + } + if (pane != null && pane.IsShown()) + { + pane.Hide(); + } + } + + public static void HideInstanceDockablePane(UIApplication uiApp, string strGuid) + { + Guid guid = new Guid(strGuid); + DockablePaneId id = new DockablePaneId(guid); + DockablePane pane = null; + try + { + pane = uiApp.GetDockablePane(id); + } + catch (Exception ex) + { + string message = ex.Message; + } + if (pane != null && pane.IsShown()) + { + pane.Hide(); + } + } + public static void HideAllDockablePane(UIControlledApplication uiControlledApp) { - foreach (var panelPair in Common.GlobalResource.DockablePanelDict) + HideInstanceDockablePane(uiControlledApp, GlobalResource.InstancePaneGuid); + foreach (var panelPair in GlobalResource.DockablePanelDict) { var strGuid = panelPair.Value; - Guid guid = new Guid(strGuid); - DockablePaneId id = new DockablePaneId(guid); - DockablePane pane = null; - try - { - pane = uiControlledApp.GetDockablePane(id); - } - catch (Exception ex) - { - string message = ex.Message; - } - if (pane != null && pane.IsShown()) - { - pane.Hide(); - } + HideInstanceDockablePane(uiControlledApp, strGuid); } } public static void HideAllDockablePane(UIApplication uiApp) - { - foreach (var panelPair in Common.GlobalResource.DockablePanelDict) + { + HideInstanceDockablePane(uiApp, GlobalResource.InstancePaneGuid); + foreach (var panelPair in GlobalResource.DockablePanelDict) { - var strGuid = panelPair.Value; - Guid guid = new Guid(strGuid); - DockablePaneId id = new DockablePaneId(guid); - DockablePane pane = null; - try - { - pane = uiApp.GetDockablePane(id); - } - catch (Exception ex) - { - string message = ex.Message; - } - if (pane != null && pane.IsShown()) - { - pane.Hide(); - } + var strGuid = panelPair.Value; + HideInstanceDockablePane(uiApp, strGuid); } - } + } + + public static void RegistDockablePanel(UIControlledApplication uiControlledApp, RevitType type) + { + var strId = GlobalResource.DockablePanelDict[type]; + Guid guid = new Guid(strId); + DockablePaneId id = new DockablePaneId(guid); + Wpf_FamilyPanel panel = new Wpf_FamilyPanel(type); + GlobalResource.FamilyPanel = panel; + uiControlledApp.RegisterDockablePane(id, type.GetDescription(), panel); + } + + public static void RegistInstanceDockablePanel(UIControlledApplication uiControlledApp) + { + var strId = GlobalResource.InstancePaneGuid; + Guid guid = new Guid(strId); + DockablePaneId id = new DockablePaneId(guid); + Wpf_InstancePanel panel = new Wpf_InstancePanel(); + GlobalResource.InstancePanel = panel; + uiControlledApp.RegisterDockablePane(id, "鏋勪欢鍒楄〃", panel); + } } } -- Gitblit v1.9.3