public FormManager(DatabaseManager DBManager_O, UInt32 UserID_UL) { InitializeComponent(); HomeImgList.Images.Add(Properties.Resources.Home); HomeImgList.Images.Add(Properties.Resources.HomeNewMsg); mDBManager_O = DBManager_O; mDocManager_O = new DocumentManager(mDBManager_O); mUserID_UL = UserID_UL; // Set drag bar parent window an title this.FormDragBar.SetParentWindow(this); this.FormDragBar.SetTitle("MMSoft - Gestion Manager"); this.ModulesToolStrip.Renderer = new BorderlessToolStripRenderer(); // Set menu items renderer MainMenuStrip.RenderMode = ToolStripRenderMode.Professional; MainMenuStrip.Renderer = new CustomMenuItemRenderer(); //Display user name if (mDBManager_O.mConnected_b) { LblUsername.Text = mDBManager_O.GetTableField("Pers", "PersNom", "PersID=" + mUserID_UL); } LblConnectionStatus.Text = mDBManager_O.mDBInstanceName_ST; mCurrentUC_O = null; mClientUC_O = new ClientUC(mDBManager_O); mProviderUC_O = new ProviderUC(mDBManager_O); mEmployeesUC_O = new MembersUC(mDBManager_O, mDocManager_O); mComJobUC_O = new ComJobUC(mDBManager_O, mDocManager_O); mHomeUC_O = new HomeUC(mDBManager_O); mHomeUC_O.NewMessage += new HomeUC.NewMessageHandler(this.NewMessage); mJobStatesUC_O = new JobsState(mDBManager_O); mJobCorrectionUC_O = new JobsCorrectionUC(mDBManager_O); mStatsUC_O = new StatsUC(mDBManager_O, mDocManager_O); //ControlStyle.SetBackgroundStyle(this); ControlStyle.SetBackgroundStyle(MainMenuStrip); ControlStyle.SetBackgroundStyle(ModulesToolStrip); ControlStyle.SetBackgroundStyle(ModuleContainerPanel); ControlStyle.SetBackgroundStyle(this.StatusStripFormChecking); ModuleChanged(ToolStripBtnHome, new EventArgs()); }
public void ModuleChanged(object sender, EventArgs e) { bool Rts_b = true; // Disable current active UC if (mCurrentUC_O != null) { Rts_b = mCurrentUC_O.Deactivate(); } if (Rts_b) { // Disable all btns ToolStripBtnClient.Checked = false; ToolStripBtnProvider.Checked = false; ToolStripBtnMembers.Checked = false; ToolStripBtnJobs.Checked = false; ToolStripBtnHome.Checked = false; ToolStripBtnJobStates.Checked = false; ToolStripBtnJobsCorrection.Checked = false; ToolStripBtnStats.Checked = false; ToolStripBtnHome.Image = HomeImgList.Images[0]; // Enable correct one if (sender.Equals(ToolStripBtnClient)) { ToolStripBtnClient.Checked = true; mCurrentUC_O = mClientUC_O; } else if (sender.Equals(ToolStripBtnProvider)) { ToolStripBtnProvider.Checked = true; mCurrentUC_O = mProviderUC_O; } else if (sender.Equals(ToolStripBtnMembers)) { ToolStripBtnMembers.Checked = true; mCurrentUC_O = mEmployeesUC_O; } else if (sender.Equals(ToolStripBtnJobs)) { ToolStripBtnJobs.Checked = true; mCurrentUC_O = mComJobUC_O; } else if (sender.Equals(ToolStripBtnHome)) { ToolStripBtnHome.Checked = true; mCurrentUC_O = mHomeUC_O; } else if (sender.Equals(ToolStripBtnJobStates)) { ToolStripBtnJobStates.Checked = true; mCurrentUC_O = mJobStatesUC_O; } else if (sender.Equals(ToolStripBtnJobsCorrection)) { ToolStripBtnJobsCorrection.Checked = true; mCurrentUC_O = mJobCorrectionUC_O; } else if (sender.Equals(ToolStripBtnStats)) { ToolStripBtnStats.Checked = true; mCurrentUC_O = mStatsUC_O; } // Active UC if (mCurrentUC_O != null) { mCurrentUC_O.Activate(ModuleContainerPanel); } } else { ToolStripBtnClient.Checked = mCurrentUC_O.Equals(mClientUC_O); ToolStripBtnProvider.Checked = mCurrentUC_O.Equals(mProviderUC_O); ToolStripBtnMembers.Checked = mCurrentUC_O.Equals(mEmployeesUC_O); ToolStripBtnJobs.Checked = mCurrentUC_O.Equals(mComJobUC_O); ToolStripBtnHome.Checked = mCurrentUC_O.Equals(mHomeUC_O); ToolStripBtnJobStates.Checked = mCurrentUC_O.Equals(mJobStatesUC_O); ToolStripBtnJobsCorrection.Checked = mCurrentUC_O.Equals(mJobCorrectionUC_O); ToolStripBtnStats.Checked = mCurrentUC_O.Equals(mStatsUC_O); } }