Пример #1
0
        private void InitializeExtensions() // 初始化扩展信息。
        {
            NavigationNodeList.Clear();
            PendingAppendedNodes.Clear();
            // 获取该扩展点的所有扩展信息。
            var extensions = _context.GetExtensions(NavigationExtensionPoint);

            // 将扩展XML信息转换成扩展模型。
            extensions.ForEach(extension => AddNavigationByExtension(extension));
            HandlePendingAppendedNodes();
        }
Пример #2
0
        /// <summary>
        /// 获取子扩展点信息
        /// </summary>
        /// <param name="EXTENS_POINT"></param>
        /// <returns></returns>
        public List <WinShellApplication> GetChildrenExtensions(IBundleContext Context)
        {
            List <WinShellApplication> WinShellAppCollections = new List <WinShellApplication>();
            var    extensions = Context.GetExtensions(EXTENS_POINT);
            string extensType = string.Empty;
            string extensName = string.Empty;

            foreach (var extension in extensions)
            {
                foreach (XmlNode node in extension.Data)
                {
                    if (node is XmlComment)
                    {
                        continue;
                    }
                    WinShellApplication app = new WinShellApplication();
                    app.Bundle = extension.Owner;

                    if (!string.IsNullOrEmpty(node.Attributes["Text"].Value))
                    {
                        app.ExtensName = node.Attributes["Text"].Value;
                    }

                    if (!string.IsNullOrEmpty(node.Attributes["ToolTip"].Value))
                    {
                        app.ExtensText = node.Attributes["ToolTip"].Value;
                    }

                    if (!string.IsNullOrEmpty(node.Attributes["Class"].Value))
                    {
                        app.ExtensType = node.Attributes["Class"].Value;
                    }

                    if (!string.IsNullOrEmpty(node.Attributes["Icon"].Value))
                    {
                        app.Icon = node.Attributes["Icon"].Value;
                    }

                    if (null != node.Attributes["OperaterType"] && !string.IsNullOrEmpty(node.Attributes["OperaterType"].Value))
                    {
                        app.OperaterType = (enumOperaterType)(System.Enum.Parse(typeof(enumOperaterType), node.Attributes["OperaterType"].Value, false));
                    }
                    WinShellAppCollections.Add(app);
                }
            }
            return(WinShellAppCollections);
        }