using 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) { HideInstanceDockablePane(uiControlledApp, GlobalResource.InstancePaneGuid); foreach (var panelPair in GlobalResource.DockablePanelDict) { var strGuid = panelPair.Value; HideInstanceDockablePane(uiControlledApp, strGuid); } } public static void HideAllDockablePane(UIApplication uiApp) { HideInstanceDockablePane(uiApp, GlobalResource.InstancePaneGuid); foreach (var panelPair in GlobalResource.DockablePanelDict) { 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); } } }