Example #1
0
 /// <summary>
 /// 解析插件集合中所有的对象
 /// 将其分别装入ICommand,ITool,IToolBarDef,IMenuDefI和DockableWindowDef 5个集合
 /// </summary>
 /// <param name="pluginCol">插件集合</param>
 public void GetPluginArray(PluginCollection pluginCol)
 {
     //遍历插件集合
     foreach (NBGIS.PluginEngine.IPlugin plugin in pluginCol)
     {
         //获得Command接口并添加到Command集合中
         NBGIS.PluginEngine.ICommand cmd = plugin as NBGIS.PluginEngine.ICommand;
         if (cmd != null)
         {
             this._Commands.Add(cmd.ToString(), cmd);
             //找出该Command的Category,如果它还没有添加到Category则添加
             if (cmd.Category != null && _CommandCategory.Contains(cmd.Category) == false)
             {
                 _CommandCategory.Add(cmd.Category);
             }
             continue;
         }
         //获得ITool接口并添加到ITool集合中
         NBGIS.PluginEngine.ITool tool = plugin as NBGIS.PluginEngine.ITool;
         if (tool != null)
         {
             this._Tools.Add(tool.ToString(), tool);
             if (tool.Category != null && _CommandCategory.Contains(tool.Category) == false)
             {
                 _CommandCategory.Add(tool.Category);
             }
             continue;
         }
         //获得IToolBarDef接口并添加到IToolBarDef集合中
         NBGIS.PluginEngine.IToolBarDef toolbardef = plugin as NBGIS.PluginEngine.IToolBarDef;
         if (toolbardef != null)
         {
             this._ToolBars.Add(toolbardef.ToString(), toolbardef);
             continue;
         }
         //获得IMenuDef接口并添加到IMenuDef集合中
         NBGIS.PluginEngine.IMenuDef menudef = plugin as NBGIS.PluginEngine.IMenuDef;
         if (menudef != null)
         {
             this._Menus.Add(menudef.ToString(), menudef);
             continue;
         }
         //获得IDockableWindowDef接口并添加到IDockableWindowDef集合中
         NBGIS.PluginEngine.IDockableWindowDef dockablewindowdef = plugin as NBGIS.PluginEngine.IDockableWindowDef;
         if (dockablewindowdef != null)
         {
             this._DockableWindows.Add(dockablewindowdef.ToString(), dockablewindowdef);
             continue;
         }
     }
 }
Example #2
0
        //解析插件集合中所有对象
        //将其分别装入ICommand、ITool、IToolBarDef、IMenuDef和IDockableWindows5个集合
        public static void  GetPluginArray(PluginCollection pluginCol)
        {
            foreach (NBGIS.PluginEngine.IPlugin plugin in pluginCol)
            {
                /////////////////
                NBGIS.PluginEngine.ICommand cmd = plugin as NBGIS.PluginEngine.ICommand;
                if (cmd != null)
                {
                    m_Commands.Add(cmd.ToString(), cmd);
                    //找出该Command的Category,如果它没有添加到Category中则添加
                    if (cmd.Category != null && (!m_CommandCategory.Contains(cmd.Category)))
                    {
                        m_CommandCategory.Add(cmd.Category);
                    }
                    continue;
                }
                ////////////////
                NBGIS.PluginEngine.ITool tool = plugin as NBGIS.PluginEngine.ITool;
                if (tool != null)
                {
                    m_Tools.Add(tool.ToString(), tool);
                    if (tool.Category != null && (!m_CommandCategory.Contains(tool.Category)))
                    {
                        m_CommandCategory.Add(tool.Category);
                    }
                    continue;
                }

                ////////////////
                NBGIS.PluginEngine.IToolBarDef toolbar = plugin as NBGIS.PluginEngine.IToolBarDef;
                if (toolbar != null)
                {
                    m_ToolBars.Add(toolbar.ToString(), toolbar);
                    continue;
                }
                ////////////////
                NBGIS.PluginEngine.IMenuDef menu = plugin as NBGIS.PluginEngine.IMenuDef;
                if (menu != null)
                {
                    m_Menus.Add(menu.ToString(), menu);
                    continue;
                }
                ////////////////
                NBGIS.PluginEngine.IDockableWindowDef dockableWindow = plugin as NBGIS.PluginEngine.IDockableWindowDef;
                if (dockableWindow != null)
                {
                    m_DockableWindows.Add(dockableWindow.ToString(), dockableWindow);
                    continue;
                }
            }
        }