码迷,mamicode.com
首页 > 其他好文 > 详细

ArcGIS Pro配置中删除已有所有TAB

时间:2020-04-06 14:00:06      阅读:71      评论:0      收藏:0      [点我收藏+]

标签:instance   inter   select   inpu   ==   rom   for   gis   nbsp   

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

    }
}

 

ArcGIS Pro配置中删除已有所有TAB

标签:instance   inter   select   inpu   ==   rom   for   gis   nbsp   

原文地址:https://www.cnblogs.com/gisoracle/p/12641474.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!