Exemplo n.º 1
0
 private void _tabMainControl_SelectedPageChanged(object sender, TabPageChangedEventArgs e)
 {
     if (e.Page != null)
     {
         this._currentTabController = this._dictTabCtroller[e.Page.Text];
         this._currentMainControl   = this._dictTabCtroller[e.Page.Text].MainControl;
         if (this._currentMainControl.LeftControl != null)
         {
         }
         this._currentEventHandler = this._dictTabCtroller[e.Page.Text].eventHandler;
         _currentDeptId            = this._dictTabCtroller[e.Page.Text].CurrentDeptid;
         this._moduleid            = this._dictTabCtroller[e.Page.Text].ModuleId;
         UserContextManager.userContext.currentWorkstationModule = this._dictTabCtroller[e.Page.Text].CurrentModule;
         this._currentController = this._dictTabCtroller[e.Page.Text].MainController;
         string str = "HIS";//FileHelper.LicensesData.Rows[0]["useCompanyName"].ToString();
         this.Text = string.Format("{0}-管理系统主程序【{1}】", str, e.Page.Text);
         this.ResetToolbar();
         if (this._dictTabCtroller[e.Page.Text].MainController is BaseManagerLeftMainController)
         {
             (this._dictTabCtroller[e.Page.Text].MainController as BaseManagerLeftMainController).CreateToolBarButtons();
         }
         else
         {
             if (this._dictTabCtroller[e.Page.Text].MainController != null)
             {
                 this._dictTabCtroller[e.Page.Text].MainController.CreateToolBarButtons();
             }
         }
     }
 }
Exemplo n.º 2
0
 private void InitTabController()
 {
     _tabControlController = new TabControlController(tabControl);
     _tabControlController.AddTabPage <MenuEntity>(
         Language.Current.Explorer_ExplorerTreeView_Tab_Menu, _menuTreeContainer);
     _tabControlController.AddTabPage <ToolStripPageEntity>(
         Language.Current.Explorer_ExplorerTreeView_Tab_ToolStrip, _toolStripTreeContainer);
     _tabControlController.TabPageChanged +=
         new TabControlController.OnTabPageChangedEventHandler(_tabControlController_TabPageChanged);
 }
Exemplo n.º 3
0
        private BarLargeButtonItem SetBarLargeButtonItem(SystemModuleData moduleData, IMainController controller, EventHandler eventHandler)
        {
            BarLargeButtonItem item = new BarLargeButtonItem(this.barManager, moduleData.moduleName)
            {
                Manager = { ShowFullMenus = true }
            };

            if (moduleData.toolbarIcon.Length > 1)
            {
                Image image = ImageHelper.CovertBytesToImage(moduleData.toolbarIcon, new Size(0x10, 0x10));
                item.Glyph = image;
            }
            item.Tag = controller;
            if (!this._quickChanelDictionary.ContainsKey(moduleData.moduleId))
            {
                this._quickChanelDictionary.Add(moduleData.moduleId, item);
            }
            item.ItemClick += delegate(object sender, ItemClickEventArgs e) {
                if (eventHandler != null)
                {
                    this._currentEventHandler = eventHandler;
                    _currentDeptId            = this.GenerateCurrentWstationDeptId(moduleData.deptId);
                    this._moduleid            = moduleData.moduleId;
                    UserContextManager.userContext.currentWorkstationModule = this.GenerateSystemModule(moduleData.moduleId);
                    this._currentController = controller;
                    if (!((this._dictTabCtroller == null) || this._dictTabCtroller.ContainsKey(moduleData.moduleName)))
                    {
                        TabControlController controller1 = new TabControlController
                        {
                            eventHandler   = eventHandler,
                            CurrentDeptid  = _currentDeptId,
                            ModuleId       = moduleData.moduleId,
                            CurrentModule  = UserContextManager.userContext.currentWorkstationModule,
                            MainController = controller
                        };
                        this._dictTabCtroller.Add(moduleData.moduleName, controller1);
                    }
                    eventHandler(e.Item.Tag, e);
                }
            };
            return(item);
        }
Exemplo n.º 4
0
 private void MainFrm_OnModuleClicked(object sender, EventArgs e)
 {
     if (sender is SystemModuleData)
     {
         SystemModuleData data           = sender as SystemModuleData;
         IMainController  mainController = null;
         BarItem          item           = new BarLargeButtonItem
         {
             Caption = data.moduleName
         };
         ItemClickEventArgs args = new ItemClickEventArgs(item, null);
         if (this._currentTabController != null)
         {
             this._currentMainControl = this._currentTabController.MainControl;
             mainController           = this._currentTabController.MainController;
         }
         else
         {
             mainController = ((MainFormController)this._formController).GenerateController(data.dllName, data.nameSpace);
             _currentDeptId = this.GenerateCurrentWstationDeptId(data.deptId);
             this._moduleid = data.moduleId;
             UserContextManager.userContext.currentWorkstationModule = this.GenerateSystemModule(data.moduleId);
             this._currentController   = mainController;
             this._currentEventHandler = ((MainFormController)this._formController).quickChanelEventHandler;
         }
         if (!((this._dictTabCtroller == null) || this._dictTabCtroller.ContainsKey(data.moduleName)))
         {
             TabControlController controller2 = new TabControlController
             {
                 eventHandler   = this._currentEventHandler,
                 CurrentDeptid  = _currentDeptId,
                 ModuleId       = data.moduleId,
                 CurrentModule  = UserContextManager.userContext.currentWorkstationModule,
                 MainController = mainController
             };
             this._dictTabCtroller.Add(data.moduleName, controller2);
         }
         ((MainFormController)this._formController).QuickChanelEventHandler(mainController, args);
     }
 }
Exemplo n.º 5
0
        public void DockMainControl(IMainControl mainControl)
        {
            this.ResetToolbar();
            if (mainControl is Control)
            {
                Control control = mainControl as Control;
                if (!((this._dictTabCtroller == null) || this._dictTabCtroller.ContainsKey("首页")) && mainControl is IDesktop)
                {
                    TabControlController controller2 = new TabControlController
                    {
                        eventHandler  = this._currentEventHandler,
                        CurrentDeptid = _currentDeptId,
                        ModuleId      = "00001",
                        CurrentModule = UserContextManager.userContext.currentWorkstationModule,
                        //  MainController = mainController
                    };
                    control.Text = "首页";
                    this._dictTabCtroller.Add("首页", controller2);
                }

                string text = control.Text;
                if ((this._userContext.MachineConfig.IsMultiAppModule && (this._tabMainControl != null)) && !string.IsNullOrEmpty(text))
                {
                    this._tabMainControl.Visible = true;
                    control.Dock = DockStyle.Fill;
                    Control     control2 = this.panel_main;
                    XtraTabPage page     = new XtraTabPage
                    {
                        Text = text
                    };
                    if (this._dictTabCtroller.ContainsKey(text))
                    {
                        if (this._dictTabCtroller[text].MainTabPage == null)
                        {
                            this._dictTabCtroller[text].MainTabPage = page;
                            this._dictTabCtroller[text].MainControl = mainControl;
                            this._tabMainControl.TabPages.Add(page);
                            page.Tag = control;
                            page.Controls.Add(control);
                            this._tabMainControl.SelectedTabPage = page;
                        }
                        else
                        {
                            if (this._tabMainControl.SelectedTabPage.Equals(this._dictTabCtroller[text].MainTabPage))
                            {
                                TabPageChangedEventArgs e = new TabPageChangedEventArgs(null, this._dictTabCtroller[text].MainTabPage);
                                this._tabMainControl_SelectedPageChanged(this._dictTabCtroller[text].MainTabPage, e);
                            }
                            this._tabMainControl.SelectedTabPage = this._dictTabCtroller[text].MainTabPage;
                        }
                    }
                }
                else
                {
                    //if (this._tabMainControl != null)
                    //{
                    //    this._tabMainControl.Visible = false;
                    //}
                    if (this._currentMainControl != mainControl)
                    {
                        if (this._currentMainControl != null)
                        {
                            Control control3;
                            this._currentMainControl.ClearToolBarButton();
                            control.Visible = false;
                            control.Dock    = DockStyle.Fill;
                            this.panel_main.Controls.Add(control);
                            control.Visible = true;
                            if (!this._userContext.MachineConfig.IsMultiAppModule)
                            {
                                control3 = this._currentMainControl as Control;
                                this.panel_main.Controls.Remove(control3);
                                control3.Dispose();
                            }
                            else if (mainControl is IDesktop)
                            {
                                if (this._currentDesktop != null)
                                {
                                    control3 = this._currentDesktop as Control;
                                    this.panel_main.Controls.Remove(control3);
                                    control3.Dispose();
                                }
                                this._currentDesktop = mainControl as IDesktop;
                            }
                        }
                        else
                        {
                            MyControlHelper.DockControl <IMainControl>(mainControl, this.panel_main, DockStyle.Fill);
                            if (mainControl is IDesktop)
                            {
                                this._currentDesktop = mainControl as IDesktop;
                            }
                        }
                        this._currentMainControl = mainControl;
                    }
                }
            }
        }