ITC81DB_2H/ITC81DB_0H/Controls/CenterInformation/ControlCenterInforSystem.cs

196 lines
6.6 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_0H.DialogForms;
using ITC81DB_0H.Forms;
using ITC81DB_2H_ImageDll;
using ITC81DB_2H.Datastore;
using ITC81DB_0H.Part11_UserManager;
using ITC81DB_0H.Part11_Encryption;
namespace ITC81DB_0H.Controls
{
public partial class ControlCenterInforSystem : UserControl
{
#region Field
private FormMenu m_ParentForm;
#endregion
#region Constructor
public ControlCenterInforSystem(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)
{
}
else if (this.ParentForm.ParentForm.SystemConfig1.Language == Define.E_LanguageID.Chinese)
{
}
else if (this.ParentForm.ParentForm.SystemConfig1.Language == Define.E_LanguageID.Czech)
{
}
else if (this.ParentForm.ParentForm.SystemConfig1.Language == Define.E_LanguageID.Russian)
{
}
else if (this.ParentForm.ParentForm.SystemConfig1.Language == Define.E_LanguageID.German)
{
}
else
{
}
}
private void DefaultSetting()
{
this.labelUserMgrVer.Text = "";
this.labelAes128Ver.Text = "";
this.labelSerialNo.Text = this.ParentForm.ParentForm.SystemConfig1.SerialNumber;
this.labelDisplayVer.Text = FormMain.DisplayVersion;
}
public void UpdatePart11UserManagerVersionDisplay(string ver)
{
this.labelUserMgrVer.Text = ver;
this.labelTitleDllUserMgr.Visible = true;
this.labelUserMgrVer.Visible = true;
}
public void UpdatePart11AesEncryptionVersionDisplay(string ver)
{
this.labelAes128Ver.Text = ver;
this.labelTitleDllAes128.Visible = true;
this.labelAes128Ver.Visible = true;
}
public void UpdateMainBoardVersionDisplay(string version)
{
if (version.Length < 8)
return;
this.labelControlVer.Text = version;
}
public void DisplayHiddenMenu(bool bValue)
{
this.buttonNext.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 DisplayRefresh(SystemStatus status)
{
this.ParentForm.ParentForm.CurrentSystemStatus.CurrentDisplay = Define.E_DisplayStore.InforSystem;
this.ParentForm.ParentForm.SetDisplayMode(Define.E_DisplayMode.Menu);
this.ParentForm.DisplayTitleRoot(this.ParentForm.ParentForm.CurrentSystemStatus);
if (this.ParentForm.ParentForm.SystemConfig1.IsLogin == true)
UserManager.UserManager_GetVersion();
if (this.ParentForm.ParentForm.SystemConfig3.IsPart11 == true)
Encryption.AesEncryption_GetVersion();
this.smartKeyboard.Hide();
this.textBoxSerialNo.Text = this.labelSerialNo.Text;
this.UpdateDisplayUser(status.CurrentUser);
this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Read, CommunicationID.MainBoard, CommunicationAddress.ProgramVersion, "");
}
#endregion
#region Event Handler
private void labelSerialNo_Click(object sender, EventArgs e)
{
DialogFormPasswordKeyPad password = new DialogFormPasswordKeyPad(4, this.ParentForm.ParentForm.SystemConfig1.Language, this.ParentForm.ParentForm.CurrentSystemStatus.CurrentUserPasswordType);
DialogResult dialogResult = password.ShowDialog();
if (dialogResult == DialogResult.OK)
{
if (password.Group == Define.E_UserGroup.Admin)
{
this.textBoxSerialNo.Visible = true;
this.smartKeyboard.KeyboardType = SmartX.SmartKeyboard.KEYBOARDTYPES.NORMAL;
this.smartKeyboard.Left = 15;
this.smartKeyboard.Top = 118;
this.smartKeyboard.Width = 680;
this.smartKeyboard.Height = 268;
this.smartKeyboard.Hide();
this.smartKeyboard.TargetInputObject = this.textBoxSerialNo;
this.textBoxSerialNo.Text = this.labelSerialNo.Text;
this.smartKeyboard.Show();
}
}
}
private void smartKeyboard1_OnXKeyClick(object sender, EventArgs e)
{
this.smartKeyboard.Hide();
this.textBoxSerialNo.Text = this.labelSerialNo.Text;
this.textBoxSerialNo.Visible = false;
}
private void textBoxSerialNo_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == '\r')
{
e.Handled = true;
this.smartKeyboard.Hide();
this.textBoxSerialNo.Visible = false;
this.labelSerialNo.Text = this.textBoxSerialNo.Text.Trim();
this.ParentForm.ParentForm.SystemConfig1.SerialNumber = this.labelSerialNo.Text;
this.ParentForm.ParentForm.SaveSystemConfigurationFile1(this.ParentForm.ParentForm.SystemConfig1);
}
else if (e.KeyChar == 27) // ESC 눌렀을 때
{
e.Handled = true;
this.smartKeyboard.Hide();
this.textBoxSerialNo.Text = this.labelSerialNo.Text;
this.textBoxSerialNo.Visible = false;
}
}
private void buttonNext_Click(object sender, EventArgs e)
{
this.ParentForm.CenterInforSystem2.DisplayRefresh(this.ParentForm.ParentForm.CurrentSystemStatus);
this.ParentForm.CenterInforSystem2.BringToFront();
}
#endregion
}
}