Example #1
0
        /// <summary>
        /// 初始化
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void MainGIS_Load(object sender, EventArgs e)
        {
            //从插件文件夹中获得实现插件接口的对象
            PluginCollection pluginCol = PluginHandle.GetPluginsFromDll();
            //解析这些插件对象,获得不同类型的插件集合
            ParsePluginCollection parsePluhinCol = new ParsePluginCollection();

            parsePluhinCol.GetPluginArray(pluginCol);
            _CommandCol        = parsePluhinCol.GetCommands;
            _ToolCol           = parsePluhinCol.GetTools;
            _ToolBarCol        = parsePluhinCol.GetToolBarDefs;
            _MenuItemCol       = parsePluhinCol.GetMenuDefs;
            _DockableWindowCol = parsePluhinCol.GetDockableWindows;

            //获得Command和Tool在UI层上的Category属性,只是纯粹的分类符号
            //可以根据不同类别插件进行UI级解析,可以编写 为uicommon uitool
            //foreach (string categoryName in parsePluhinCol.GetCommandCategorys)
            //{
            //    //对ui进行分为不同的类别
            //    //uiCommandManager.Categories.Add(new UICommandCategory(categoryName));
            //}
            //产生UI对象
            CreateUICommandTool(_CommandCol, _ToolCol);
            CreateToolBars(_ToolBarCol);
            CreateMenus(_MenuItemCol);
            CreateDockableWindow(_DockableWindowCol);
            //保证宿主程序启动后不存在任何默认的处于使用状态的ITool对象
            _mapControl.CurrentTool        = null;
            _pageLayoutControl.CurrentTool = null;
        }
Example #2
0
        /// <summary>
        /// 初始化
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void MainGIS_Load(object sender, EventArgs e)
        {
            //从插件文件夹中获得实现插件接口的对象
            PluginCollection pluginCol = PluginHandle.GetPluginsFromDll();
            //解析这些插件对象,获得不同类型的插件集合
            ParsePluginCollection parsePluhinCol = new ParsePluginCollection();

            parsePluhinCol.GetPluginArray(pluginCol);
            _CommandCol        = parsePluhinCol.GetCommands;
            _ToolCol           = parsePluhinCol.GetTools;
            _ToolBarCol        = parsePluhinCol.GetToolBarDefs;
            _MenuItemCol       = parsePluhinCol.GetMenuDefs;
            _DockableWindowCol = parsePluhinCol.GetDockableWindows;

            //获得Command和Tool在UI层上的Category属性,只是纯粹的分类符号
            //可以根据不同类别插件进行UI级解析,可以编写 为uicommon uitool
            //foreach (string categoryName in parsePluhinCol.GetCommandCategorys)
            //{
            //    //对ui进行分为不同的类别
            //    //uiCommandManager.Categories.Add(new UICommandCategory(categoryName));
            //}
            //产生UI对象
            CreateUICommandTool(_CommandCol, _ToolCol);
            CreateToolBars(_ToolBarCol);
            CreateMenus(_MenuItemCol);
            CreateDockableWindow(_DockableWindowCol);
            //保证宿主程序启动后不存在任何默认的处于使用状态的ITool对象
            _mapControl.CurrentTool        = null;
            _pageLayoutControl.CurrentTool = null;

            //主界面系统名称,获取目录下的SystemName.txt[可灵活设置]
            string sUIName = "县域尺度低丘缓坡山地开发土地优化布局系统";

            string sTxtFileName = System.Windows.Forms.Application.StartupPath + "\\SystemName.txt";

            if (!File.Exists(sTxtFileName))
            {
                this.FindForm().Text = sUIName;
                return;
            }

            StreamReader sr = new StreamReader(sTxtFileName, Encoding.Default);
            String       line;

            while ((line = sr.ReadLine()) != null)
            {
                sUIName = line.ToString();
            }
            //this.Name = sUIName;

            this.FindForm().Text = sUIName;
        }
Example #3
0
        //主窗体Load事件
        private void MainGIS_Load(object sender, EventArgs e)
        {
            //从插件文件夹中获得实现了插件接口的对象
            NBGIS.PluginEngine.PluginCollection pluginCol = NBGIS.PluginEngine.PluginHandle.GetPluginsFromDll();


            //NBGIS.PluginEngine.ParsePluginCollection parsePluginCol = new NBGIS.PluginEngine.ParsePluginCollection();

            //解析这些插件对象,获得不同类型的插件集合
            //把插件集合解析成五种不同的类型存储在ParsePluginCollection对象属性中
            ParsePluginCollection.GetPluginArray(pluginCol);

            //从ParsePluginCollection提取出各种插件对象集合
            m_CommandCol = ParsePluginCollection.GetCommands;
            m_ToolCol    = ParsePluginCollection.GetTools;
            m_ToolBarCol = ParsePluginCollection.GetToolBars;
            m_MenuCol    = ParsePluginCollection.GetMenus;
            //m_DockableWindowCol = ParsePluginCollection.GetDockableWindows;

            //获得Command和Tool在UI层面上的Category属性
            foreach (string categoryName in ParsePluginCollection.GetCommandsCategorys)
            {
                this.uiCommandManager.Categories.Add(new Janus.Windows.UI.CommandBars.UICommandCategory(categoryName));
            }
            //创建插件的UI对象
            this.CreateUICommandAndTool(this.m_CommandCol, this.m_ToolCol);
            this.CreateUIToolBars(this.m_ToolBarCol);
            this.CreateUIMenus(this.m_MenuCol);


            // this.CreateUIDockableWindow(this.m_DockableWindowCol);

            //经过改进,动态创建DockableWindow
            //---------------------------------------------------------------
            NBGIS.PluginEngine.CreateUI.Application    = m_Application;
            NBGIS.PluginEngine.CreateUI.UIPanelManager = uiPanelManager;
            //-------------------------------------------------------------------



            this.m_MapControl.CurrentTool        = null;
            this.m_PageLayoutControl.CurrentTool = null;
        }