using System; using System.Linq; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Text; using System.Windows.Forms; using ITC81DB_0H.Forms; using ITC81DB_2H_ImageDll; using SmartX; using ITC81DB_2H.Datastore; namespace ITC81DB_0H.Controls { public partial class ControlCenterEquipHelp : UserControl { #region Field private FormMenu m_ParentForm; private Define.E_MenuBottomEquipment CurrentMenu; #endregion #region Constructor public ControlCenterEquipHelp(FormMenu parent) { InitializeComponent(); this.ParentForm = parent; this.InitializeDesign(); this.DefaultSetting(); } #endregion #region Property public FormMenu ParentForm { get { return this.m_ParentForm; } private set { this.m_ParentForm = value; } } #endregion #region Method public void InitializeDesign() { Class1 images = new Class1(); if (this.ParentForm.ParentForm.SystemConfig1.Language == Define.E_LanguageID.English) { this.buttonUpdate.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.engHelpUpdateDisable)); this.buttonUpdate.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.engHelpUpdateDown)); this.buttonUpdate.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.engHelpUpdateUp)); this.buttonInitialize.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.engHelpInitializationDisable)); this.buttonInitialize.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.engHelpInitializationDown)); this.buttonInitialize.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.engHelpInitializationUp)); this.buttonEngineerSetting.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.engHelpEngineerDisable)); this.buttonEngineerSetting.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.engHelpEngineerDown)); this.buttonEngineerSetting.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.engHelpEngineerUp)); this.buttonFunction.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.engHelpFunctionDisable)); this.buttonFunction.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.engHelpFunctionDown)); this.buttonFunction.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.engHelpFunctionUp)); this.buttonUser.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.engHelpUserDisable)); this.buttonUser.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.engHelpUserDown)); this.buttonUser.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.engHelpUserUp)); this.buttonEquipmentTest.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.engHelpEquipmentTestDisable)); this.buttonEquipmentTest.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.engHelpEquipmentTestDown)); this.buttonEquipmentTest.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.engHelpEquipmentTestUp)); } else if (this.ParentForm.ParentForm.SystemConfig1.Language == Define.E_LanguageID.Chinese) { this.buttonUpdate.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnHelpUpdateDisable)); this.buttonUpdate.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnHelpUpdateDown)); this.buttonUpdate.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnHelpUpdateUp)); this.buttonInitialize.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnHelpInitializationDisable)); this.buttonInitialize.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnHelpInitializationDown)); this.buttonInitialize.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnHelpInitializationUp)); this.buttonEngineerSetting.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnHelpEngineerDisable)); this.buttonEngineerSetting.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnHelpEngineerDown)); this.buttonEngineerSetting.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnHelpEngineerUp)); this.buttonFunction.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnHelpFunctionDisable)); this.buttonFunction.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnHelpFunctionDown)); this.buttonFunction.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnHelpFunctionUp)); this.buttonUser.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnHelpUserDisable)); this.buttonUser.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnHelpUserDown)); this.buttonUser.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnHelpUserUp)); this.buttonEquipmentTest.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnHelpEquipmentTestDisable)); this.buttonEquipmentTest.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnHelpEquipmentTestDown)); this.buttonEquipmentTest.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnHelpEquipmentTestUp)); } else if (this.ParentForm.ParentForm.SystemConfig1.Language == Define.E_LanguageID.Czech) { } else if (this.ParentForm.ParentForm.SystemConfig1.Language == Define.E_LanguageID.Russian) { this.buttonUpdate.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.rusHelpUpdateDisable)); this.buttonUpdate.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.rusHelpUpdateDown)); this.buttonUpdate.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.rusHelpUpdateUp)); this.buttonInitialize.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.rusHelpInitializationDisable)); this.buttonInitialize.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.rusHelpInitializationDown)); this.buttonInitialize.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.rusHelpInitializationUp)); this.buttonEngineerSetting.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.rusHelpEngineerDisable)); this.buttonEngineerSetting.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.rusHelpEngineerDown)); this.buttonEngineerSetting.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.rusHelpEngineerUp)); this.buttonFunction.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.rusHelpFunctionDisable)); this.buttonFunction.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.rusHelpFunctionDown)); this.buttonFunction.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.rusHelpFunctionUp)); this.buttonUser.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.rusHelpUserDisable)); this.buttonUser.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.rusHelpUserDown)); this.buttonUser.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.rusHelpUserUp)); this.buttonEquipmentTest.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.rusHelpEquipmentTestDisable)); this.buttonEquipmentTest.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.rusHelpEquipmentTestDown)); this.buttonEquipmentTest.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.rusHelpEquipmentTestUp)); } else if (this.ParentForm.ParentForm.SystemConfig1.Language == Define.E_LanguageID.German) { this.buttonUpdate.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.gerHelpUpdateDisable)); this.buttonUpdate.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.gerHelpUpdateDown)); this.buttonUpdate.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.gerHelpUpdateUp)); this.buttonInitialize.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.gerHelpInitializationDisable)); this.buttonInitialize.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.gerHelpInitializationDown)); this.buttonInitialize.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.gerHelpInitializationUp)); this.buttonEngineerSetting.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.gerHelpEngineerDisable)); this.buttonEngineerSetting.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.gerHelpEngineerDown)); this.buttonEngineerSetting.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.gerHelpEngineerUp)); this.buttonFunction.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.gerHelpFunctionDisable)); this.buttonFunction.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.gerHelpFunctionDown)); this.buttonFunction.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.gerHelpFunctionUp)); this.buttonUser.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.gerHelpUserDisable)); this.buttonUser.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.gerHelpUserDown)); this.buttonUser.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.gerHelpUserUp)); this.buttonEquipmentTest.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.gerHelpEquipmentTestDisable)); this.buttonEquipmentTest.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.gerHelpEquipmentTestDown)); this.buttonEquipmentTest.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.gerHelpEquipmentTestUp)); } else { this.buttonUpdate.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.korHelpUpdateDisable)); this.buttonUpdate.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.korHelpUpdateDown)); this.buttonUpdate.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.korHelpUpdateUp)); this.buttonInitialize.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.korHelpInitializationDisable)); this.buttonInitialize.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.korHelpInitializationDown)); this.buttonInitialize.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.korHelpInitializationUp)); this.buttonEngineerSetting.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.korHelpEngineerDisable)); this.buttonEngineerSetting.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.korHelpEngineerDown)); this.buttonEngineerSetting.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.korHelpEngineerUp)); this.buttonFunction.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.korHelpFunctionDisable)); this.buttonFunction.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.korHelpFunctionDown)); this.buttonFunction.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.korHelpFunctionUp)); this.buttonUser.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.korHelpUserDisable)); this.buttonUser.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.korHelpUserDown)); this.buttonUser.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.korHelpUserUp)); } } private void DefaultSetting() { this.CurrentMenu = Define.E_MenuBottomEquipment.Help; if (this.ParentForm.ParentForm.SystemConfig1.IsLogin == true) this.buttonUser.Visible = true; else this.buttonUser.Visible = false; } public void DisplayHiddenMenu(bool bValue) { if (this.ParentForm.ParentForm.SystemConfig1.IsLogin == true) this.buttonEngineerSetting.Location = new Point(28, 240); else this.buttonEngineerSetting.Location = new Point(526, 17); this.buttonEngineerSetting.Visible = bValue; } private void UpdateDisplayUser(UserItem user) { if (user.Group == Define.E_UserGroup.Developer && this.ParentForm.ParentForm.SystemConfig1.IsLogin == true) this.DisplayHiddenMenu(true); else this.DisplayHiddenMenu(false); } public void UpdateMenuDisplay(SystemStatus status) { switch (status.CurrentUser.Group) { case Define.E_UserGroup.Level1: this.buttonUpdate.Enabled = this.ParentForm.ParentForm.CurrentUserGroup.Level1.IsEquipUpdate; this.buttonInitialize.Enabled = this.ParentForm.ParentForm.CurrentUserGroup.Level1.IsEquipInitialize; this.buttonFunction.Enabled = this.ParentForm.ParentForm.CurrentUserGroup.Level1.IsEquipFunctionSetting; this.buttonUser.Enabled = true; this.buttonEngineerSetting.Enabled = this.ParentForm.ParentForm.CurrentUserGroup.Level1.IsEquipEngineerSetting; break; case Define.E_UserGroup.Level2: this.buttonUpdate.Enabled = this.ParentForm.ParentForm.CurrentUserGroup.Level2.IsEquipUpdate; this.buttonInitialize.Enabled = this.ParentForm.ParentForm.CurrentUserGroup.Level2.IsEquipInitialize; this.buttonFunction.Enabled = this.ParentForm.ParentForm.CurrentUserGroup.Level2.IsEquipFunctionSetting; this.buttonUser.Enabled = true; this.buttonEngineerSetting.Enabled = this.ParentForm.ParentForm.CurrentUserGroup.Level2.IsEquipEngineerSetting; break; case Define.E_UserGroup.Level3: this.buttonUpdate.Enabled = this.ParentForm.ParentForm.CurrentUserGroup.Level3.IsEquipUpdate; this.buttonInitialize.Enabled = this.ParentForm.ParentForm.CurrentUserGroup.Level3.IsEquipInitialize; this.buttonFunction.Enabled = this.ParentForm.ParentForm.CurrentUserGroup.Level3.IsEquipFunctionSetting; this.buttonUser.Enabled = true; this.buttonEngineerSetting.Enabled = true; break; case Define.E_UserGroup.Admin: case Define.E_UserGroup.Developer: this.buttonUpdate.Enabled = true; this.buttonInitialize.Enabled = true; this.buttonFunction.Enabled = true; this.buttonUser.Enabled = true; this.buttonEngineerSetting.Enabled = true; break; case Define.E_UserGroup.NotLogin: this.buttonUpdate.Enabled = this.ParentForm.ParentForm.CurrentUserGroup.NotLogin.IsEquipUpdate; this.buttonInitialize.Enabled = this.ParentForm.ParentForm.CurrentUserGroup.NotLogin.IsEquipInitialize; this.buttonFunction.Enabled = this.ParentForm.ParentForm.CurrentUserGroup.NotLogin.IsEquipFunctionSetting; this.buttonUser.Enabled = this.ParentForm.ParentForm.CurrentUserGroup.NotLogin.IsEquipUserSetting; this.buttonEngineerSetting.Enabled = true; break; default: break; } } public void DisplayRefresh(SystemStatus status) { this.ParentForm.ParentForm.CurrentSystemStatus.CurrentDisplay = Define.E_DisplayStore.EquipHelp; this.ParentForm.ParentForm.SetDisplayMode(Define.E_DisplayMode.Menu); this.ParentForm.DisplayTitleRoot(this.ParentForm.ParentForm.CurrentSystemStatus); this.UpdateDisplayUser(status.CurrentUser); } #endregion #region Event Handler private void buttonMenu_Click(object sender, EventArgs e) { SmartButton button = sender as SmartButton; if (button == null) return; if (button == this.buttonUpdate) this.CurrentMenu = Define.E_MenuBottomEquipment.Update; else if (button == this.buttonInitialize) this.CurrentMenu = Define.E_MenuBottomEquipment.Initialize; else if (button == this.buttonFunction) this.CurrentMenu = Define.E_MenuBottomEquipment.FunctionSetting; else if (button == this.buttonUser) this.CurrentMenu = Define.E_MenuBottomEquipment.User; else if (button == this.buttonEngineerSetting) this.CurrentMenu = Define.E_MenuBottomEquipment.Engineer; else this.CurrentMenu = Define.E_MenuBottomEquipment.Help; this.ParentForm.DisplayBottomEquipment(this.CurrentMenu); } #endregion } }