DocumentOpenedHandle.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. /*-------------------------------------------------------------------------
  2. * 功能描述:DocumentOpenedHandle
  3. * 作者:xulisong
  4. * 创建时间: 2019/7/18 13:33:26
  5. * 版本号:v1.0
  6. * -------------------------------------------------------------------------*/
  7. using System;
  8. using System.Collections.Generic;
  9. using System.Linq;
  10. using System.Text;
  11. using System.Threading.Tasks;
  12. using System.Windows;
  13. using Autodesk.Revit.UI;
  14. using FWindSoft.Revit;
  15. namespace LRH.Tool
  16. {
  17. public class DocumentOpenedHandle: IRevitRegister
  18. {
  19. private void Application_DocumentOpened(object sender, Autodesk.Revit.DB.Events.DocumentOpenedEventArgs e)
  20. {
  21. var paneId = DockablePanes.BuiltInDockablePanes.PropertiesPalette;
  22. DockablePane pane = ExternalApplication.CurrentApp.UIControlApp.GetDockablePane(paneId);
  23. pane.Show();
  24. //MessageBox.Show(e.Document.Title);
  25. }
  26. public void Register(ExternalApplication application)
  27. {
  28. application.DocumentOpened += Application_DocumentOpened; ;
  29. }
  30. public void Unregister(ExternalApplication application)
  31. {
  32. application.DocumentOpened -= Application_DocumentOpened;
  33. }
  34. }
  35. }