Exemplo n.º 1
0
 private void InitAppRunModule()
 {
     //if ((this._userContext.MachineConfig != null) && this._userContext.MachineConfig.IsMultiAppModule)
     //{
     this._tabMainControl = new XtraTabControl();
     this._tabMainControl.ClosePageButtonShowMode = ClosePageButtonShowMode.InAllTabPageHeaders;
     this._tabMainControl.HotTrackedPageChanged  += new TabPageChangedEventHandler(this._tabMainControl_HotTrackedPageChanged);
     this._tabMainControl.CloseButtonClick       += new EventHandler(this._tabMainControl_CloseButtonClick);
     this._tabMainControl.SelectedPageChanged    += new TabPageChangedEventHandler(this._tabMainControl_SelectedPageChanged);
     this._dictTabCtroller     = new Dictionary <string, TabControlController>();
     this._tabMainControl.Dock = DockStyle.Fill;
     this.panel_main.Controls.Add(this._tabMainControl);
     MyControlHelper.DockControl <XtraTabControl>(this._tabMainControl, this.panel_main, DockStyle.Fill);
     //}
 }
Exemplo n.º 2
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;
                    }
                }
            }
        }
Exemplo n.º 3
0
 public void DockMainControl(IMainControl mainControl)
 {
     this.ResetToolbar();
     if (mainControl is Control)
     {
         Control control = mainControl as Control;
         string  text    = control.Text;
         if ((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;
             }
         }
     }
 }