using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows.Input; using System.Threading.Tasks; using ArcGIS.Core.CIM; using ArcGIS.Core.Data; using ArcGIS.Core.Geometry; using ArcGIS.Desktop.Catalog; using ArcGIS.Desktop.Core; using ArcGIS.Desktop.Editing; using ArcGIS.Desktop.Extensions; using ArcGIS.Desktop.Framework; using ArcGIS.Desktop.Framework.Contracts; using ArcGIS.Desktop.Framework.Dialogs; using ArcGIS.Desktop.Framework.Threading.Tasks; using ArcGIS.Desktop.Mapping; using System.Xml.Linq; namespace ProConfiguration2 { internal class Module1 : Module { private static Module1 _this = null; /// <summary> /// Retrieve the singleton instance to this module here /// </summary> public static Module1 Current { get { return _this ?? (_this = (Module1)FrameworkApplication.FindModule("ProConfiguration2_Module")); } } #region Overrides /// <summary> /// Called by Framework when ArcGIS Pro is closing /// </summary> /// <returns>False to prevent Pro from closing, otherwise True</returns> protected override bool CanUnload() { //TODO - add your business logic //return false to ~cancel~ Application close return true; } //by gisoracle protected void OnUpdateDatabase(System.Xml.Linq.XDocument database) { var nsp = database.Root.Name.Namespace; var tabElements = from seg in database.Root.Descendants(nsp + "tab") select seg; var elements = new HashSet<XElement>(); foreach (var tabElement in tabElements) { if (tabElement.Parent == null || tabElement.Parent.Name.LocalName.StartsWith("backstage")) continue; var id = tabElement.Attribute("id"); if (id == null) continue; if (id.Value.StartsWith("esri")) elements.Add(tabElement); } foreach (var element in elements) { element.Remove(); } } #endregion Overrides } }
原文地址:https://www.cnblogs.com/gisoracle/p/12641474.html
时间: 2024-10-05 05:11:20