ITC81DB_2H/ITC81DB_0H/Controls/CenterConfiguration/ControlCenterConfiHelp.cs

251 lines
18 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 SmartX;
using ITC81DB_0H.Forms;
using ITC81DB_2H_ImageDll;
using ITC81DB_2H.Datastore;
namespace ITC81DB_0H.Controls
{
public partial class ControlCenterConfiHelp : UserControl
{
#region Field
private FormMenu m_ParentForm;
private Define.E_MenuBottomConfiguration CurrentMenu;
#endregion
#region Constructor
public ControlCenterConfiHelp(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.buttonCountingOutput.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.engHelpCountingOutputDisable));
this.buttonCountingOutput.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.engHelpCountingOutputDown));
this.buttonCountingOutput.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.engHelpCountingOutputUp));
this.buttonSerialCOM1.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.engHelpSerialCOM1Disable));
this.buttonSerialCOM1.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.engHelpSerialCOM1Down));
this.buttonSerialCOM1.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.engHelpSerialCOM1Up));
this.buttonSerialCOM3.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.engHelpSerialCOM3Disable));
this.buttonSerialCOM3.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.engHelpSerialCOM3Down));
this.buttonSerialCOM3.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.engHelpSerialCOM3Up));
this.buttonSerialCOM4.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.engHelpSerialCOM4Disable));
this.buttonSerialCOM4.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.engHelpSerialCOM4Down));
this.buttonSerialCOM4.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.engHelpSerialCOM4Up));
this.buttonEthernet.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.engHelpEthernetDisable));
this.buttonEthernet.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.engHelpEthernetDown));
this.buttonEthernet.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.engHelpEthernetUp));
this.buttonOptionBoard.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.engHelpOptionBoardDisable));
this.buttonOptionBoard.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.engHelpOptionBoardDown));
this.buttonOptionBoard.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.engHelpOptionBoardUp));
this.buttonOption.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.engHelpOptionDisable));
this.buttonOption.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.engHelpOptionDown));
this.buttonOption.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.engHelpOptionUp));
}
else if (this.ParentForm.ParentForm.SystemConfig1.Language == Define.E_LanguageID.Chinese)
{
this.buttonCountingOutput.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnHelpCountingOutputDisable));
this.buttonCountingOutput.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnHelpCountingOutputDown));
this.buttonCountingOutput.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnHelpCountingOutputUp));
this.buttonSerialCOM1.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnHelpSerialCOM1Disable));
this.buttonSerialCOM1.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnHelpSerialCOM1Down));
this.buttonSerialCOM1.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnHelpSerialCOM1Up));
this.buttonSerialCOM3.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnHelpSerialCOM3Disable));
this.buttonSerialCOM3.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnHelpSerialCOM3Down));
this.buttonSerialCOM3.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnHelpSerialCOM3Up));
this.buttonSerialCOM4.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnHelpSerialCOM4Disable));
this.buttonSerialCOM4.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnHelpSerialCOM4Down));
this.buttonSerialCOM4.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnHelpSerialCOM4Up));
this.buttonEthernet.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnHelpEthernetDisable));
this.buttonEthernet.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnHelpEthernetDown));
this.buttonEthernet.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnHelpEthernetUp));
this.buttonOptionBoard.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnHelpOptionBoardDisable));
this.buttonOptionBoard.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnHelpOptionBoardDown));
this.buttonOptionBoard.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnHelpOptionBoardUp));
}
else if (this.ParentForm.ParentForm.SystemConfig1.Language == Define.E_LanguageID.Czech)
{
}
else if (this.ParentForm.ParentForm.SystemConfig1.Language == Define.E_LanguageID.Russian)
{
this.buttonCountingOutput.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.rusHelpCountingOutputDisable));
this.buttonCountingOutput.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.rusHelpCountingOutputDown));
this.buttonCountingOutput.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.rusHelpCountingOutputUp));
this.buttonSerialCOM1.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.rusHelpSerialCOM1Disable));
this.buttonSerialCOM1.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.rusHelpSerialCOM1Down));
this.buttonSerialCOM1.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.rusHelpSerialCOM1Up));
this.buttonSerialCOM3.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.rusHelpSerialCOM3Disable));
this.buttonSerialCOM3.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.rusHelpSerialCOM3Down));
this.buttonSerialCOM3.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.rusHelpSerialCOM3Up));
this.buttonSerialCOM4.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.rusHelpSerialCOM4Disable));
this.buttonSerialCOM4.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.rusHelpSerialCOM4Down));
this.buttonSerialCOM4.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.rusHelpSerialCOM4Up));
this.buttonEthernet.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.rusHelpEthernetDisable));
this.buttonEthernet.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.rusHelpEthernetDown));
this.buttonEthernet.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.rusHelpEthernetUp));
this.buttonOptionBoard.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.rusHelpOptionBoardDisable));
this.buttonOptionBoard.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.rusHelpOptionBoardDown));
this.buttonOptionBoard.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.rusHelpOptionBoardUp));
}
else if (this.ParentForm.ParentForm.SystemConfig1.Language == Define.E_LanguageID.German)
{
this.buttonCountingOutput.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.gerHelpCountingOutputDisable));
this.buttonCountingOutput.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.gerHelpCountingOutputDown));
this.buttonCountingOutput.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.gerHelpCountingOutputUp));
this.buttonSerialCOM1.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.gerHelpSerialCOM1Disable));
this.buttonSerialCOM1.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.gerHelpSerialCOM1Down));
this.buttonSerialCOM1.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.gerHelpSerialCOM1Up));
this.buttonSerialCOM3.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.gerHelpSerialCOM3Disable));
this.buttonSerialCOM3.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.gerHelpSerialCOM3Down));
this.buttonSerialCOM3.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.gerHelpSerialCOM3Up));
this.buttonSerialCOM4.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.gerHelpSerialCOM4Disable));
this.buttonSerialCOM4.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.gerHelpSerialCOM4Down));
this.buttonSerialCOM4.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.gerHelpSerialCOM4Up));
this.buttonEthernet.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.gerHelpEthernetDisable));
this.buttonEthernet.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.gerHelpEthernetDown));
this.buttonEthernet.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.gerHelpEthernetUp));
this.buttonOptionBoard.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.gerHelpOptionBoardDisable));
this.buttonOptionBoard.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.gerHelpOptionBoardDown));
this.buttonOptionBoard.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.gerHelpOptionBoardUp));
this.buttonOption.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.gerHelpOptionDisable));
this.buttonOption.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.gerHelpOptionDown));
this.buttonOption.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.gerHelpOptionUp));
}
else
{
this.buttonSerialCOM1.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.korHelpSerialCOM1Disable));
this.buttonSerialCOM1.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.korHelpSerialCOM1Down));
this.buttonSerialCOM1.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.korHelpSerialCOM1Up));
this.buttonSerialCOM3.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.korHelpSerialCOM3Disable));
this.buttonSerialCOM3.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.korHelpSerialCOM3Down));
this.buttonSerialCOM3.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.korHelpSerialCOM3Up));
this.buttonSerialCOM4.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.korHelpSerialCOM4Disable));
this.buttonSerialCOM4.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.korHelpSerialCOM4Down));
this.buttonSerialCOM4.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.korHelpSerialCOM4Up));
this.buttonEthernet.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.korHelpEthernetDisable));
this.buttonEthernet.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.korHelpEthernetDown));
this.buttonEthernet.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.korHelpEthernetUp));
this.buttonOptionBoard.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.korHelpOptionBoardDisable));
this.buttonOptionBoard.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.korHelpOptionBoardDown));
this.buttonOptionBoard.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.korHelpOptionBoardUp));
}
}
private void DefaultSetting()
{
this.CurrentMenu = Define.E_MenuBottomConfiguration.Help;
}
public void UpdateMenuDisplay(SystemStatus status)
{
switch (status.CurrentUser.Group)
{
case Define.E_UserGroup.Level1:
this.buttonSerialCOM1.Enabled = this.ParentForm.ParentForm.CurrentUserGroup.Level1.IsConfiSerial;
this.buttonSerialCOM3.Enabled = this.ParentForm.ParentForm.CurrentUserGroup.Level1.IsConfiSerial;
this.buttonSerialCOM4.Enabled = this.ParentForm.ParentForm.CurrentUserGroup.Level1.IsConfiSerial;
this.buttonEthernet.Enabled = this.ParentForm.ParentForm.CurrentUserGroup.Level1.IsConfiEthernet;
break;
case Define.E_UserGroup.Level2:
this.buttonSerialCOM1.Enabled = this.ParentForm.ParentForm.CurrentUserGroup.Level2.IsConfiSerial;
this.buttonSerialCOM3.Enabled = this.ParentForm.ParentForm.CurrentUserGroup.Level2.IsConfiSerial;
this.buttonSerialCOM4.Enabled = this.ParentForm.ParentForm.CurrentUserGroup.Level2.IsConfiSerial;
this.buttonEthernet.Enabled = this.ParentForm.ParentForm.CurrentUserGroup.Level2.IsConfiEthernet;
break;
case Define.E_UserGroup.Level3:
this.buttonSerialCOM1.Enabled = this.ParentForm.ParentForm.CurrentUserGroup.Level3.IsConfiSerial;
this.buttonSerialCOM3.Enabled = this.ParentForm.ParentForm.CurrentUserGroup.Level3.IsConfiSerial;
this.buttonSerialCOM4.Enabled = this.ParentForm.ParentForm.CurrentUserGroup.Level3.IsConfiSerial;
this.buttonEthernet.Enabled = this.ParentForm.ParentForm.CurrentUserGroup.Level3.IsConfiEthernet;
break;
case Define.E_UserGroup.Admin:
case Define.E_UserGroup.Developer:
this.buttonSerialCOM1.Enabled = true;
this.buttonSerialCOM3.Enabled = true;
this.buttonSerialCOM4.Enabled = true;
this.buttonEthernet.Enabled = true;
this.buttonCountingOutput.Enabled = true;
this.buttonOption.Enabled = true;
break;
case Define.E_UserGroup.NotLogin:
this.buttonSerialCOM1.Enabled = this.ParentForm.ParentForm.CurrentUserGroup.NotLogin.IsConfiSerial;
this.buttonSerialCOM3.Enabled = this.ParentForm.ParentForm.CurrentUserGroup.NotLogin.IsConfiSerial;
this.buttonSerialCOM4.Enabled = this.ParentForm.ParentForm.CurrentUserGroup.NotLogin.IsConfiSerial;
this.buttonEthernet.Enabled = this.ParentForm.ParentForm.CurrentUserGroup.NotLogin.IsConfiEthernet;
break;
default:
break;
}
}
public void DisplayRefresh(SystemStatus status)
{
int value;
value = int.Parse(this.ParentForm.ParentForm.CurrentSystemParameter1.OptionBoard);
if (value == 0)
this.buttonOptionBoard.Visible = false;
else
this.buttonOptionBoard.Visible = true;
this.ParentForm.ParentForm.CurrentSystemStatus.CurrentDisplay = Define.E_DisplayStore.ConfiHelp;
this.ParentForm.ParentForm.SetDisplayMode(Define.E_DisplayMode.Menu);
this.ParentForm.DisplayTitleRoot(this.ParentForm.ParentForm.CurrentSystemStatus);
}
#endregion
#region Event Handler
private void buttonMenu_Click(object sender, EventArgs e)
{
SmartButton button = sender as SmartButton;
if (button == null)
return;
if (button == this.buttonSerialCOM1)
this.CurrentMenu = Define.E_MenuBottomConfiguration.SerialCOM1;
else if (button == this.buttonSerialCOM3)
this.CurrentMenu = Define.E_MenuBottomConfiguration.SerialCOM3;
else if (button == this.buttonSerialCOM4)
this.CurrentMenu = Define.E_MenuBottomConfiguration.SerialCOM4;
else if (button == this.buttonEthernet)
this.CurrentMenu = Define.E_MenuBottomConfiguration.Ethernet;
else if (button == this.buttonOptionBoard)
this.CurrentMenu = Define.E_MenuBottomConfiguration.OptionBoard;
else
this.CurrentMenu = Define.E_MenuBottomConfiguration.Help;
this.ParentForm.DisplayBottomConfiguration(this.CurrentMenu);
}
#endregion
}
}