ITC81DB_2/ITC81DB_2/Controls/CenterEquipment/ControlCenterEquipHelp.cs

160 lines
7.7 KiB
C#

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_2.Forms;
using ITC81DB_2_ImageDll;
using SmartX;
namespace ITC81DB_2.Controls
{
public partial class ControlCenterEquipHelp : UserControl
{
#region Field
private FormMenu m_ParentForm;
private DataStore.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.SystemConfig.Language == DataStore.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.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.SystemConfig.Language == DataStore.LanguageID.Chinese)
{
}
else if (this.ParentForm.ParentForm.SystemConfig.Language == DataStore.LanguageID.Czech)
{
}
else if (this.ParentForm.ParentForm.SystemConfig.Language == DataStore.LanguageID.Russian)
{
}
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.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));
this.buttonEquipmentTest.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.korHelpEquipmentTestDisable));
this.buttonEquipmentTest.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.korHelpEquipmentTestDown));
this.buttonEquipmentTest.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.korHelpEquipmentTestUp));
}
}
private void DefaultSetting()
{
this.CurrentMenu = DataStore.MenuBottomEquipment.Help;
if (this.ParentForm.ParentForm.SystemConfig.IsLogin == true)
this.buttonUser.Visible = true;
else
this.buttonUser.Visible = false;
}
public void DisplayHiddenMenu(bool bValue)
{
if (this.ParentForm.ParentForm.SystemConfig.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 == DataStore.UserGroup.Level4Developer && this.ParentForm.ParentForm.SystemConfig.IsLogin == true)
this.DisplayHiddenMenu(true);
else
this.DisplayHiddenMenu(false);
}
public void DisplayRefresh(SystemStatus status)
{
this.ParentForm.ParentForm.CurrentSystemStatus.CurrentDisplay = DataStore.DisplayStore.EquipHelp;
this.ParentForm.ParentForm.SetDisplayMode(DataStore.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 = DataStore.MenuBottomEquipment.Update;
else if (button == this.buttonInitialize)
this.CurrentMenu = DataStore.MenuBottomEquipment.Initialize;
else if (button == this.buttonFunction)
this.CurrentMenu = DataStore.MenuBottomEquipment.FunctionSetting;
else if (button == this.buttonUser)
this.CurrentMenu = DataStore.MenuBottomEquipment.User;
else if (button == this.buttonEquipmentTest)
this.CurrentMenu = DataStore.MenuBottomEquipment.Test;
else if (button == this.buttonEngineerSetting)
this.CurrentMenu = DataStore.MenuBottomEquipment.Engineer;
else
this.CurrentMenu = DataStore.MenuBottomEquipment.Help;
this.ParentForm.DisplayBottomEquipment(this.CurrentMenu);
}
#endregion
}
}