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_2.Forms; using ITC81DB_2.DialogForms; using ITC81DB_2_ImageDll; using System.Threading; namespace ITC81DB_2.Controls { public partial class ControlCenterEquipFunctionSetting : UserControl { #region Field private FormMenu m_ParentForm; #endregion #region Constructor public ControlCenterEquipFunctionSetting(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(); this.ParentForm.DisplayTitleRoot(this.ParentForm.ParentForm.CurrentSystemStatus); if (this.ParentForm.ParentForm.SystemConfig.Language == DataStore.LanguageID.English) { this.labelTitleBuzzerONTime.Text = "Buzzer ON time"; this.labelTitleRelayRunTime.Text = "Relay Run time"; this.labelTitleChattering.Text = "Chattering"; this.labelTitleLanguage.Text = "Language"; this.labelTitleEquipmentID.Text = "Equipment ID"; this.labelTitleLogin.Text = "Login"; this.labelTitleCommunicationLog.Text = "Log"; } 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.labelTitleBuzzerONTime.Text = "부저 ON 시간"; this.labelTitleRelayRunTime.Text = "릴레이 동작 시간"; this.labelTitleChattering.Text = "채터링감지"; this.labelTitleLanguage.Text = "언어설정"; this.labelTitleEquipmentID.Text = "장비 ID"; this.labelTitleLogin.Text = "로그인"; this.labelTitleCommunicationLog.Text = "통신로그"; } } private void DefaultSetting() { this.comboBoxLanguage.SelectedIndexChanged -= new EventHandler(this.comboBoxLanguage_SelectedIndexChanged); this.comboBoxLanguage.Items.Clear(); this.comboBoxLanguage.Items.Add("한국어"); this.comboBoxLanguage.Items.Add("English"); this.comboBoxLanguage.SelectedIndexChanged += new EventHandler(this.comboBoxLanguage_SelectedIndexChanged); } private void UpdateParameterDisplay(SystemConfigurationItem item, SystemParameter9507 parameter) { string value = ""; int index = 0; // Equipment ID value = item.EquipmentID.ToString(); if (this.labelEquipmentID.Text != value) this.labelEquipmentID.Text = value; // 언어 index = (int)item.Language; if (this.comboBoxLanguage.SelectedIndex != index) { this.comboBoxLanguage.SelectedIndexChanged -= new EventHandler(this.comboBoxLanguage_SelectedIndexChanged); this.comboBoxLanguage.SelectedIndex = index; this.comboBoxLanguage.SelectedIndexChanged += new EventHandler(this.comboBoxLanguage_SelectedIndexChanged); } // 로그인 if (item.IsLogin == false) this.buttonLogin.ButtonUp(); else this.buttonLogin.ButtonDown(); // 부저ON시간 value = parameter.BuzzerOnTime.Trim(); if (this.labelBuzzerOnTime.Text != value) this.labelBuzzerOnTime.Text = value; // 릴레이동작시간 value = parameter.RelayOnTime.Trim(); if (this.labelRelayOnTime.Text != value) this.labelRelayOnTime.Text = value; // 채터링감지 value = parameter.Chattering.Trim(); if (this.labelChattering.Text != value) this.labelChattering.Text = value; } private void UpdateUserPasswordDisplay(UserPasswordType user) { if (this.labelUser1Password.Text != user.Level1Password) this.labelUser1Password.Text = user.Level1Password; if (this.labelUser2Password.Text != user.Level2Password) this.labelUser2Password.Text = user.Level2Password; if (this.labelUser3Password.Text != user.Level3Password) this.labelUser3Password.Text = user.Level3Password; } private void UpdateDisplayUser(UserItem user) { // 디버그 후 지울것 this.labelTitleCommunicationLog.Visible = true; this.buttonCommunicationLog.Visible = true; //if (user.Group == DataStore.UserGroup.Level4Developer && this.ParentForm.ParentForm.SystemConfig.IsLogin == true) //{ // this.labelTitleCommunicationLog.Visible = true; // this.buttonCommunicationLog.Visible = true; //} //else //{ // this.labelTitleCommunicationLog.Visible = false; // this.buttonCommunicationLog.Visible = false; //} } public void DisplayRefresh(SystemStatus status) { this.ParentForm.ParentForm.CurrentSystemStatus.CurrentDisplay = DataStore.DisplayStore.EquipFuctionSetting; this.ParentForm.ParentForm.SetDisplayMode(DataStore.DisplayMode.Menu); this.ParentForm.DisplayTitleRoot(this.ParentForm.ParentForm.CurrentSystemStatus); this.UpdateUserPasswordDisplay(this.ParentForm.ParentForm.CurrentSystemStatus.CurrentUserPasswordType); this.UpdateParameterDisplay(this.ParentForm.ParentForm.SystemConfig, this.ParentForm.ParentForm.CurrentSystemParameter9507); this.UpdateDisplayUser(status.CurrentUser); } #endregion #region Event Handler private void labelEquipmentID_Click(object sender, EventArgs e) { DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelEquipmentID.Text, 3, 0, false, this.ParentForm.ParentForm.SystemConfig.Language); if (myKeyPad.ShowDialog() == DialogResult.OK) { if (myKeyPad.doubleValue < 1 || myKeyPad.doubleValue > 9999) { // 입력범위를 확인하세요 DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.ParentForm.SystemConfig.Language); myMsg.ShowDialog(); } else { this.labelEquipmentID.Text = myKeyPad.StringValue; this.ParentForm.ParentForm.SystemConfig.EquipmentID = myKeyPad.IntValue; this.ParentForm.ParentForm.SaveSystemConfigurationFile(this.ParentForm.ParentForm.SystemConfig); } } } private void labelBuzzerOnTime_Click(object sender, EventArgs e) { string value = ""; DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelBuzzerOnTime.Text, 4, 0, false, this.ParentForm.ParentForm.SystemConfig.Language); if (myKeyPad.ShowDialog() == DialogResult.OK) { if (myKeyPad.doubleValue < 0 || myKeyPad.doubleValue > 9999) { // 입력범위를 확인하세요 DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.ParentForm.SystemConfig.Language); myMsg.ShowDialog(); } else { this.labelBuzzerOnTime.Text = myKeyPad.StringValue; value = Helper.StringZeroFillDigits4(this.labelBuzzerOnTime.Text); this.ParentForm.ParentForm.CurrentSystemParameter9507.BuzzerOnTime = myKeyPad.StringValue; this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress._6001_BuzzerOnTime, value); } } } private void labelRelayOnTime_Click(object sender, EventArgs e) { string value = ""; DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelRelayOnTime.Text, 4, 0, false, this.ParentForm.ParentForm.SystemConfig.Language); if (myKeyPad.ShowDialog() == DialogResult.OK) { if (myKeyPad.doubleValue < 0 || myKeyPad.doubleValue > 9999) { // 입력범위를 확인하세요 DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.ParentForm.SystemConfig.Language); myMsg.ShowDialog(); } else { this.labelRelayOnTime.Text = myKeyPad.StringValue; value = Helper.StringZeroFillDigits4(this.labelRelayOnTime.Text); this.ParentForm.ParentForm.CurrentSystemParameter9507.RelayOnTime = myKeyPad.StringValue; this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress._6002_RelayRunTime, value); } } } private void labelChattering_Click(object sender, EventArgs e) { string value = ""; DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelChattering.Text, 4, 0, false, this.ParentForm.ParentForm.SystemConfig.Language); if (myKeyPad.ShowDialog() == DialogResult.OK) { if (myKeyPad.doubleValue < 0 || myKeyPad.doubleValue > 500) { // 입력범위를 확인하세요 DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.ParentForm.SystemConfig.Language); myMsg.ShowDialog(); } else { this.labelChattering.Text = myKeyPad.StringValue; value = Helper.StringZeroFillDigits4(this.labelChattering.Text); this.ParentForm.ParentForm.CurrentSystemParameter9507.Chattering = myKeyPad.StringValue; this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress._6006_Chattering, value); } } } private void labelUser1Password_Click(object sender, EventArgs e) { DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelUser1Password.Text, 4, 0, false, this.ParentForm.ParentForm.SystemConfig.Language); if (myKeyPad.ShowDialog() == DialogResult.OK) { if (myKeyPad.StringValue.Length != 4) { // 입력범위를 확인하세요 DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.ParentForm.SystemConfig.Language); myMsg.ShowDialog(); } else { this.labelUser1Password.Text = myKeyPad.StringValue; this.ParentForm.ParentForm.CurrentSystemStatus.CurrentUserPasswordType.Level1Password = myKeyPad.StringValue; this.ParentForm.ParentForm.SaveUserGroupPasswordFile(this.ParentForm.ParentForm.CurrentSystemStatus.CurrentUserPasswordType); } } } private void labelUser2Password_Click(object sender, EventArgs e) { DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelUser2Password.Text, 4, 0, false, this.ParentForm.ParentForm.SystemConfig.Language); if (myKeyPad.ShowDialog() == DialogResult.OK) { if (myKeyPad.StringValue.Length != 4) { // 입력범위를 확인하세요 DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.ParentForm.SystemConfig.Language); myMsg.ShowDialog(); } else { this.labelUser2Password.Text = myKeyPad.StringValue; this.ParentForm.ParentForm.CurrentSystemStatus.CurrentUserPasswordType.Level2Password = myKeyPad.StringValue; this.ParentForm.ParentForm.SaveUserGroupPasswordFile(this.ParentForm.ParentForm.CurrentSystemStatus.CurrentUserPasswordType); } } } private void labelUser3Password_Click(object sender, EventArgs e) { DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelUser3Password.Text, 4, 0, false, this.ParentForm.ParentForm.SystemConfig.Language); if (myKeyPad.ShowDialog() == DialogResult.OK) { if (myKeyPad.StringValue.Length != 4) { // 입력범위를 확인하세요 DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.ParentForm.SystemConfig.Language); myMsg.ShowDialog(); } else { this.labelUser3Password.Text = myKeyPad.StringValue; this.ParentForm.ParentForm.CurrentSystemStatus.CurrentUserPasswordType.Level3Password = myKeyPad.StringValue; this.ParentForm.ParentForm.SaveUserGroupPasswordFile(this.ParentForm.ParentForm.CurrentSystemStatus.CurrentUserPasswordType); } } } private void comboBoxLanguage_SelectedIndexChanged(object sender, EventArgs e) { if (this.comboBoxLanguage.SelectedIndex == 0) this.ParentForm.ParentForm.SystemConfig.Language = DataStore.LanguageID.Korean; else if (this.comboBoxLanguage.SelectedIndex == 1) this.ParentForm.ParentForm.SystemConfig.Language = DataStore.LanguageID.English; else if (this.comboBoxLanguage.SelectedIndex == 2) this.ParentForm.ParentForm.SystemConfig.Language = DataStore.LanguageID.Chinese; else if (this.comboBoxLanguage.SelectedIndex == 3) this.ParentForm.ParentForm.SystemConfig.Language = DataStore.LanguageID.Czech; else this.ParentForm.ParentForm.SystemConfig.Language = DataStore.LanguageID.Korean; this.ParentForm.ParentForm.SaveSystemConfigurationFile(this.ParentForm.ParentForm.SystemConfig); // 각 화면 언어 적용 SmartSplash splash = new SmartSplash(); splash.CenterPosition = true; splash.AnimationInterval = 200; splash.LoadingImagePathname = "SmartLoading4"; splash.Start(); this.ParentForm.ParentForm.ChildFormMainDisplay.InitializeDesign(); this.ParentForm.ParentForm.ChildFormMenu.InitializeDesign(); Thread.Sleep(50); this.ParentForm.ParentForm.ChildFormMainDisplay.MainDisplayMenu.InitializeDesign(); this.ParentForm.ParentForm.ChildFormMainDisplay.MainDisplayNormal.InitializeDesign(); this.ParentForm.ParentForm.ChildFormMainDisplay.MainDisplayDataStatistics.InitializeDesign(); this.ParentForm.ParentForm.ChildFormMainDisplay.MainDisplayList.InitializeDesign(); this.ParentForm.ParentForm.ChildFormMainDisplay.MainDisplayXYChart.InitializeDesign(); Thread.Sleep(50); this.ParentForm.ParentForm.ChildFormMenu.CenterBasicDataBackup.InitializeDesign(); this.ParentForm.ParentForm.ChildFormMenu.CenterBasicDataStatistics.InitializeDesign(); this.ParentForm.ParentForm.ChildFormMenu.CenterBasicHelp.InitializeDesign(); this.ParentForm.ParentForm.ChildFormMenu.CenterBasicProduct.InitializeDesign(); this.ParentForm.ParentForm.ChildFormMenu.CenterBasicTime.InitializeDesign(); Thread.Sleep(50); this.ParentForm.ParentForm.ChildFormMenu.CenterConfiCommunication.InitializeDesign(); this.ParentForm.ParentForm.ChildFormMenu.CenterConfiHelp.InitializeDesign(); this.ParentForm.ParentForm.ChildFormMenu.CenterConfiOption.InitializeDesign(); this.ParentForm.ParentForm.ChildFormMenu.CenterConfiOptionBoard.InitializeDesign(); Thread.Sleep(50); this.ParentForm.ParentForm.ChildFormMenu.CenterEquipFunctionSetting.InitializeDesign(); this.ParentForm.ParentForm.ChildFormMenu.CenterEquipHelp.InitializeDesign(); this.ParentForm.ParentForm.ChildFormMenu.CenterEquipInitialize.InitializeDesign(); this.ParentForm.ParentForm.ChildFormMenu.CenterEquipTest.InitializeDesign(); this.ParentForm.ParentForm.ChildFormMenu.CenterEquipUpdate.InitializeDesign(); this.ParentForm.ParentForm.ChildFormMenu.CenterEquipUser.InitializeDesign(); Thread.Sleep(50); this.ParentForm.ParentForm.ChildFormMenu.CenterInforAS.InitializeDesign(); this.ParentForm.ParentForm.ChildFormMenu.CenterInforHelp.InitializeDesign(); this.ParentForm.ParentForm.ChildFormMenu.CenterInforSystemInformation.InitializeDesign(); Thread.Sleep(50); this.ParentForm.ParentForm.ChildFormMenu.CenterSystemAutoZero.InitializeDesign(); this.ParentForm.ParentForm.ChildFormMenu.CenterSystemCalibration.InitializeDesign(); this.ParentForm.ParentForm.ChildFormMenu.CenterSystemExternalOutput.InitializeDesign(); this.ParentForm.ParentForm.ChildFormMenu.CenterSystemHelp.InitializeDesign(); this.ParentForm.ParentForm.ChildFormMenu.CenterSystemIOTest.InitializeDesign(); this.ParentForm.ParentForm.ChildFormMenu.CenterSystemJudgmentSetting.InitializeDesign(); this.ParentForm.ParentForm.ChildFormMenu.CenterSystemSorterSetting.InitializeDesign(); Thread.Sleep(50); this.ParentForm.ParentForm.ChildFormMenu.CenterInforAS.DefaultSetting(); splash.Finish(); } private void buttonLogin_Click(object sender, EventArgs e) { DialogFormYesNo myDlg = new DialogFormYesNo(this.ParentForm.ParentForm.SystemConfig.Language, 15); if (myDlg.ShowDialog() == DialogResult.Yes) { if (this.buttonLogin.ButtonStatus == SmartX.SmartButton.BUTSTATUS.UP) this.ParentForm.ParentForm.SystemConfig.IsLogin = false; else this.ParentForm.ParentForm.SystemConfig.IsLogin = true; this.ParentForm.ParentForm.SaveSystemConfigurationFile(this.ParentForm.ParentForm.SystemConfig); DialogFormMessage msg = new DialogFormMessage(18, this.ParentForm.ParentForm.SystemConfig.Language); msg.ShowDialog(); } else { if (this.ParentForm.ParentForm.SystemConfig.IsLogin == false) this.buttonLogin.ButtonUp(); else this.buttonLogin.ButtonDown(); } } private void buttonCommunicationLog_Click(object sender, EventArgs e) { if (this.buttonCommunicationLog.ButtonStatus == SmartButton.BUTSTATUS.DOWN) { this.ParentForm.ParentForm.smartFileCommunicationLog.Close(); this.ParentForm.ParentForm.smartFileCommunicationLog.Open(this.ParentForm.ParentForm.BufferSmartUart); this.ParentForm.ParentForm.IsCommunicationLogOpen = true; } else { this.ParentForm.ParentForm.IsCommunicationLogOpen = false; this.ParentForm.ParentForm.smartFileCommunicationLog.Close(); } } #endregion } }