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.DialogForms; using ITC81DB.Forms; using ITC81DB_ImageDll; namespace ITC81DB.Controls { public partial class ControlCenterSystemCalibration : UserControl { #region Field private FormMenu m_ParentForm; private Color NormalColor; private Color FinishColor; // 중량 조정이 완료 되었는지 확인하는 Flag private bool IsCalibrationFinish; #endregion #region Constructor public ControlCenterSystemCalibration(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 == DataStore.LanguageID.English) { this.smartGroupBox1.Image = new Bitmap(images.GetImage(Class1.ButtonImages.engBackgroundCalibration)); this.buttonCancel.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.engCalibrationCancelDisable)); this.buttonCancel.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.engCalibrationCancelDown)); this.buttonCancel.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.engCalibrationCancelUp)); this.buttonBalance.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.engCalibrationCounterweightDisable)); this.buttonBalance.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.engCalibrationCounterweightDown)); this.buttonBalance.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.engCalibrationCounterweightUp)); this.buttonStart.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.engCalibrationStartDisable)); this.buttonStart.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.engCalibrationStartDown)); this.buttonStart.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.engCalibrationStartUp)); this.buttonZero.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.engCalibrationZeroDisable)); this.buttonZero.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.engCalibrationZeroDown)); this.buttonZero.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.engCalibrationZeroUp)); } else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.Chinese) { this.smartGroupBox1.Image = new Bitmap(images.GetImage(Class1.ButtonImages.chnBackgroundCalibration)); this.buttonCancel.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnFormCalibrationCancelDisable)); this.buttonCancel.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnFormCalibrationCancelDown)); this.buttonCancel.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnFormCalibrationCancelUp)); this.buttonBalance.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnFormCalibrationCounterweightDisable)); this.buttonBalance.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnFormCalibrationCounterweightDown)); this.buttonBalance.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnFormCalibrationCounterweightUp)); this.buttonStart.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnFormCalibrationStartDisable)); this.buttonStart.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnFormCalibrationStartDown)); this.buttonStart.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnFormCalibrationStartUp)); this.buttonZero.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnFormCalibrationZeroDisable)); this.buttonZero.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnFormCalibrationZeroDown)); this.buttonZero.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnFormCalibrationZeroUp)); } else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.Czech) { } else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.Russian) { this.smartGroupBox1.Image = new Bitmap(images.GetImage(Class1.ButtonImages.rusBackgroundCalibration)); this.buttonCancel.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.rusCalibrationCancelDisable)); this.buttonCancel.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.rusCalibrationCancelDown)); this.buttonCancel.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.rusCalibrationCancelUp)); this.buttonBalance.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.rusCalibrationCounterweightDisable)); this.buttonBalance.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.rusCalibrationCounterweightDown)); this.buttonBalance.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.rusCalibrationCounterweightUp)); this.buttonStart.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.rusCalibrationStartDisable)); this.buttonStart.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.rusCalibrationStartDown)); this.buttonStart.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.rusCalibrationStartUp)); this.buttonZero.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.rusCalibrationZeroDisable)); this.buttonZero.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.rusCalibrationZeroDown)); this.buttonZero.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.rusCalibrationZeroUp)); } else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.German) { this.smartGroupBox1.Image = new Bitmap(images.GetImage(Class1.ButtonImages.gerBackgroundCalibration)); this.buttonCancel.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.gerCalibrationCancelDisable)); this.buttonCancel.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.gerCalibrationCancelDown)); this.buttonCancel.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.gerCalibrationCancelUp)); this.buttonBalance.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.gerCalibrationCounterweightDisable)); this.buttonBalance.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.gerCalibrationCounterweightDown)); this.buttonBalance.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.gerCalibrationCounterweightUp)); this.buttonStart.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.gerCalibrationStartDisable)); this.buttonStart.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.gerCalibrationStartDown)); this.buttonStart.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.gerCalibrationStartUp)); this.buttonZero.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.gerCalibrationZeroDisable)); this.buttonZero.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.gerCalibrationZeroDown)); this.buttonZero.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.gerCalibrationZeroUp)); } else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.Spanish) { this.smartGroupBox1.Image = new Bitmap(images.GetImage(Class1.ButtonImages.engBackgroundCalibration)); this.buttonCancel.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.engCalibrationCancelDisable)); this.buttonCancel.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.engCalibrationCancelDown)); this.buttonCancel.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.engCalibrationCancelUp)); this.buttonBalance.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.engCalibrationCounterweightDisable)); this.buttonBalance.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.engCalibrationCounterweightDown)); this.buttonBalance.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.engCalibrationCounterweightUp)); this.buttonStart.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.engCalibrationStartDisable)); this.buttonStart.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.engCalibrationStartDown)); this.buttonStart.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.engCalibrationStartUp)); this.buttonZero.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.engCalibrationZeroDisable)); this.buttonZero.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.engCalibrationZeroDown)); this.buttonZero.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.engCalibrationZeroUp)); } else { this.smartGroupBox1.Image = new Bitmap(images.GetImage(Class1.ButtonImages.korBackgroundCalibration)); this.buttonCancel.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.korCalibrationCancelDisable)); this.buttonCancel.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.korCalibrationCancelDown)); this.buttonCancel.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.korCalibrationCancelUp)); this.buttonBalance.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.korCalibrationCounterweightDisable)); this.buttonBalance.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.korCalibrationCounterweightDown)); this.buttonBalance.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.korCalibrationCounterweightUp)); this.buttonStart.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.korCalibrationStartDisable)); this.buttonStart.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.korCalibrationStartDown)); this.buttonStart.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.korCalibrationStartUp)); this.buttonZero.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.korCalibrationZeroDisable)); this.buttonZero.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.korCalibrationZeroDown)); this.buttonZero.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.korCalibrationZeroUp)); } } private void DefaultSetting() { this.NormalColor = Color.White; this.FinishColor = Color.Lime; } private void CalibrationButtonEnable(bool btStart, bool btBalance, bool btCcancel) { this.buttonStart.Enabled = btStart; this.buttonBalance.Enabled = btBalance; this.buttonCancel.Enabled = btCcancel; } private void CalibrationPictureBoxVisible(bool step1, bool step2, bool step3) { if (step1 == true) { this.pictureBoxStep1.Visible = true; this.pictureBoxStep2.Visible = false; this.pictureBoxStep3.Visible = false; } else if (step2 == true) { this.pictureBoxStep1.Visible = false; this.pictureBoxStep2.Visible = true; this.pictureBoxStep3.Visible = false; } else if(step3 == true) { this.pictureBoxStep1.Visible = false; this.pictureBoxStep2.Visible = false; this.pictureBoxStep3.Visible = true; } else { this.pictureBoxStep1.Visible = true; this.pictureBoxStep2.Visible = false; this.pictureBoxStep3.Visible = false; } } private void UpdateControlsDisplay() { this.listBoxHelp.ClearAll(); if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.English) { this.listBoxHelp.AddItem("Push the start button."); } else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.Chinese) { this.listBoxHelp.AddItem("需要重量调节,"); this.listBoxHelp.AddItem("请点击开始按钮"); } else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.Czech) { this.listBoxHelp.AddItem("Presione el botón [START]"); this.listBoxHelp.AddItem("para iniciar la calibración"); } else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.Russian) { this.listBoxHelp.AddItem("Нажмите кнопку [Старт],"); this.listBoxHelp.AddItem("чтобы начать калибровку"); } else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.German) { this.listBoxHelp.AddItem("Drücken Sie die"); this.listBoxHelp.AddItem("Taste [Start],"); this.listBoxHelp.AddItem("um die Kalibrierung"); this.listBoxHelp.AddItem("zu starten"); } else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.Spanish) { this.listBoxHelp.AddItem("Presiona el botón"); this.listBoxHelp.AddItem("de inicio"); } else { this.listBoxHelp.AddItem("중량조정을 하시려면"); this.listBoxHelp.AddItem("시작 버튼을 누르세요"); } this.CalibrationButtonEnable(true, false, false); this.CalibrationPictureBoxVisible(true, false, false); if (this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces == 0) { if (this.radioButtonDecimalPlaces0.Checked != true) this.radioButtonDecimalPlaces0.Checked = true; } else if (this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces == 1) { if (this.radioButtonDecimalPlaces1.Checked != true) this.radioButtonDecimalPlaces1.Checked = true; } else if (this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces == 2) { if (this.radioButtonDecimalPlaces2.Checked != true) this.radioButtonDecimalPlaces2.Checked = true; } else { if (this.radioButtonDecimalPlaces0.Checked != true) this.radioButtonDecimalPlaces0.Checked = true; } if (this.ParentForm.ParentForm.SystemConfig1.Unit == "g") { if (this.radioButtonUnitG.Checked != true) this.radioButtonUnitG.Checked = true; } else if (this.ParentForm.ParentForm.SystemConfig1.Unit == "kg") { if (this.radioButtonUnitKg.Checked != true) this.radioButtonUnitKg.Checked = true; } else if (this.ParentForm.ParentForm.SystemConfig1.Unit == "oz") { if (this.radioButtonUnitOz.Checked != true) this.radioButtonUnitOz.Checked = true; } else { if (this.radioButtonUnitG.Checked != true) this.radioButtonUnitG.Checked = true; } if (this.labelMaxWeightUnit.Text != this.ParentForm.ParentForm.SystemConfig1.Unit) this.labelMaxWeightUnit.Text = this.ParentForm.ParentForm.SystemConfig1.Unit; if (this.labelBalanceWeightUnit.Text != this.ParentForm.ParentForm.SystemConfig1.Unit) this.labelBalanceWeightUnit.Text = this.ParentForm.ParentForm.SystemConfig1.Unit; if (this.labelWeightUnit.Text != this.ParentForm.ParentForm.SystemConfig1.Unit) this.labelWeightUnit.Text = this.ParentForm.ParentForm.SystemConfig1.Unit; } public void UpdateCalibrationItemDisplay(DataStore.EquipmentStatus status, CalibrationItem item) { string value = ""; value = Helper.CommunicationWeightValueToString(item.BalanceWeight, this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces); if (this.labelBalanceWeight.Text != value) this.labelBalanceWeight.Text = value; value = Helper.CommunicationWeightValueToString(item.MaxWeight, this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces); if (this.labelMaxWeight.Text != value) this.labelMaxWeight.Text = value; value = item.Digit.Trim(); if (value == "1") { if (this.radioButtonDigit1.Checked != true) this.radioButtonDigit1.Checked = true; } else if (value == "2") { if (this.radioButtonDigit2.Checked != true) this.radioButtonDigit2.Checked = true; } else if (value == "5") { if (this.radioButtonDigit5.Checked != true) this.radioButtonDigit5.Checked = true; } else { if (this.radioButtonDigit1.Checked != true) this.radioButtonDigit1.Checked = true; } value = Helper.StringToDecimalPlaces(item.Constant.Trim(), 6); if (this.labelConstant.Text != value) this.labelConstant.Text = value; } public void UpdateWeightDisplay(DataStore.EquipmentStatus status, WeightData data) { switch (data.Status) { case DataStore.WeightStatus.CalNomal: this.labelWeight.Text = Helper.DoubleToString(data.Weight, this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces); this.labelWeight.ForeColor = this.NormalColor; this.labelADC.Text = data.ADCValue; this.CalibrationButtonEnable(true, false, false); this.CalibrationPictureBoxVisible(true, false, false); break; case DataStore.WeightStatus.CalStandby: // 분동중량 표시 this.IsCalibrationFinish = false; this.labelWeight.Text = string.Format("-{0}", this.labelBalanceWeight.Text); this.labelWeight.ForeColor = this.NormalColor; this.labelADC.Text = data.ADCValue; this.listBoxHelp.ClearAll(); if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.English) { this.listBoxHelp.AddItem("Put the balance weight."); } else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.Chinese) { this.listBoxHelp.AddItem("请放上砝码"); } else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.Czech) { } else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.Russian) { this.listBoxHelp.AddItem("Утановите весы"); } else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.German) { this.listBoxHelp.AddItem("Gewicht auf den"); this.listBoxHelp.AddItem("Förderer legen"); } else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.Spanish) { this.listBoxHelp.AddItem("Ponga el peso de"); this.listBoxHelp.AddItem("la balanza."); } else { this.listBoxHelp.AddItem("분동을 올려주세요"); } this.CalibrationButtonEnable(false, true, true); this.CalibrationPictureBoxVisible(false, true, false); break; case DataStore.WeightStatus.CalBalans: // 분동중량표시 this.labelWeight.Text = string.Format("-{0}", this.labelBalanceWeight.Text); this.labelWeight.ForeColor = this.NormalColor; this.labelADC.Text = data.ADCValue; this.CalibrationButtonEnable(false, false, true); this.CalibrationPictureBoxVisible(false, false, true); break; case DataStore.WeightStatus.CalFinish: this.listBoxHelp.ClearAll(); if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.English) { this.listBoxHelp.AddItem("Finish the calibration"); } else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.Chinese) { this.listBoxHelp.AddItem("重量调节已完成"); } else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.Czech) { } else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.Russian) { this.listBoxHelp.AddItem("Завершение калибровки"); } else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.German) { this.listBoxHelp.AddItem("Die Kalibrierung ist"); this.listBoxHelp.AddItem("abgeschlossen."); } else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.Spanish) { this.listBoxHelp.AddItem("Calibración terminada"); } else { this.listBoxHelp.AddItem("중량조정이 완료 되었습니다"); } this.CalibrationButtonEnable(true, false, false); this.CalibrationPictureBoxVisible(true, false, false); this.labelWeight.Text = Helper.DoubleToString(data.Weight, this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces); this.labelWeight.ForeColor = this.FinishColor; this.labelADC.Text = data.ADCValue; if (this.IsCalibrationFinish == false) { this.IsCalibrationFinish = true; this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Read, CommunicationID.MainBoard, CommunicationAddress.ParameterRead3901, ""); } break; case DataStore.WeightStatus.CalError: this.listBoxHelp.ClearAll(); if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.English) { this.listBoxHelp.AddItem("Calibration error"); this.listBoxHelp.AddItem("Please try again."); } else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.Chinese) { this.listBoxHelp.AddItem("错误发生,重试"); } else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.Czech) { } else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.Russian) { this.listBoxHelp.AddItem("Произошла ошибка"); this.listBoxHelp.AddItem("Попробуйте еще раз"); } else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.German) { this.listBoxHelp.AddItem("Fehler!"); this.listBoxHelp.AddItem("Bitte noch einmal"); this.listBoxHelp.AddItem("versuchen"); } else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.Spanish) { this.listBoxHelp.AddItem("Error de calibración"); this.listBoxHelp.AddItem("Intentar otra vez"); } else { this.listBoxHelp.AddItem("중량조정 에러"); this.listBoxHelp.AddItem("다시 시도해 주세요."); } this.CalibrationButtonEnable(true, false, false); this.CalibrationPictureBoxVisible(true, false, false); this.labelWeight.Text = Helper.DoubleToString(data.Weight, this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces); this.labelWeight.ForeColor = this.NormalColor; this.labelADC.Text = data.ADCValue; break; default: break; } } public void DisplayRefresh(SystemStatus status) { this.ParentForm.ParentForm.CurrentSystemStatus.CurrentDisplay = DataStore.DisplayStore.SystemCalibration; this.ParentForm.ParentForm.SetDisplayMode(DataStore.DisplayMode.Calibration); this.ParentForm.DisplayTitleRoot(this.ParentForm.ParentForm.CurrentSystemStatus); this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Read, CommunicationID.MainBoard, CommunicationAddress.ParameterRead3901, ""); this.UpdateControlsDisplay(); this.Refresh(); } #endregion #region Event Handler private void labelMaxWeight_Click(object sender, EventArgs e) { string value = ""; DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelMaxWeight.Text, 5, this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces, false, this.ParentForm.ParentForm.SystemConfig1.Language); if (myKeyPad.ShowDialog() == DialogResult.OK) { if (myKeyPad.doubleValue < 0 || myKeyPad.doubleValue > Helper.StringToWeight("99999", this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces)) { // 입력범위를 확인하세요 DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.ParentForm.SystemConfig1.Language); myMsg.Location = new Point(167, 207); myMsg.ShowDialog(); } else { this.labelMaxWeight.Text = myKeyPad.StringValue; value = Helper.StringZeroFillDigits7(this.labelMaxWeight.Text.Replace(".", "")); this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.SubBoardAll, CommunicationAddress.MaxWeight, value); } } } private void labelBalanceWeight_Click(object sender, EventArgs e) { string value = ""; DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelBalanceWeight.Text, 5, this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces, false, this.ParentForm.ParentForm.SystemConfig1.Language); if (myKeyPad.ShowDialog() == DialogResult.OK) { if (myKeyPad.doubleValue < 0 || myKeyPad.doubleValue > Helper.StringToWeight("99999", this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces)) { // 입력범위를 확인하세요 DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.ParentForm.SystemConfig1.Language); myMsg.Location = new Point(167, 207); myMsg.ShowDialog(); } else { this.labelBalanceWeight.Text = myKeyPad.StringValue; value = Helper.StringZeroFillDigits7(this.labelBalanceWeight.Text.Replace(".", "")); this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.SubBoardAll, CommunicationAddress.BalanceWeight, value); } } } private void radioButtonUnit_Click(object sender, EventArgs e) { if (this.radioButtonUnitG.Checked == true) this.ParentForm.ParentForm.SystemConfig1.Unit = "g"; else if(this.radioButtonUnitKg.Checked == true) this.ParentForm.ParentForm.SystemConfig1.Unit = "kg"; else if (this.radioButtonUnitOz.Checked == true) this.ParentForm.ParentForm.SystemConfig1.Unit = "oz"; else this.ParentForm.ParentForm.SystemConfig1.Unit = "g"; this.ParentForm.ParentForm.SaveSystemConfigurationFile1(this.ParentForm.ParentForm.SystemConfig1); this.ParentForm.ParentForm.ChildFormMainDisplay.MainDataStatistics.LabelUnit(); this.labelMaxWeightUnit.Text = this.labelBalanceWeightUnit.Text = this.labelWeightUnit.Text = this.ParentForm.ParentForm.SystemConfig1.Unit; } private void radioButtonDigit_Click(object sender, EventArgs e) { string value = ""; if (this.radioButtonDigit1.Checked == true) value = "1"; else if (this.radioButtonDigit2.Checked == true) value = "2"; else if (this.radioButtonDigit5.Checked == true) value = "5"; else value = "1"; value = Helper.StringZeroFillDigits4(value); this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.SubBoardAll, CommunicationAddress.Digit, value); } private void radioButtonDecimalPlaces_Click(object sender, EventArgs e) { this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Read, CommunicationID.MainBoard, CommunicationAddress.ParameterRead3901, ""); this.ParentForm.ParentForm.OpenSmartFileIO(); if (this.ParentForm.ParentForm.SystemConfig2.IsUsingRandomMode == true) { int currentDecimalPlaces = this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces; bool radioButtonCompare = false; if (this.radioButtonDecimalPlaces0.Checked == true) { if (currentDecimalPlaces != 0) radioButtonCompare = true; } else if (this.radioButtonDecimalPlaces1.Checked == true) { if (currentDecimalPlaces != 1) radioButtonCompare = true; } else if (this.radioButtonDecimalPlaces2.Checked == true) { if (currentDecimalPlaces != 2) radioButtonCompare = true; } if (radioButtonCompare == true) { DialogFormYesNo myDlg = new DialogFormYesNo(this.ParentForm.ParentForm.SystemConfig1.Language, 24); if (myDlg.ShowDialog() == DialogResult.Yes) { if (this.radioButtonDecimalPlaces0.Checked == true) { this.ParentForm.ParentForm.CreateProductFileForRandomMode(); this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces = 0; } else if (this.radioButtonDecimalPlaces1.Checked == true) { this.ParentForm.ParentForm.CreateProductFileForRandomMode(); this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces = 1; } else if (this.radioButtonDecimalPlaces2.Checked == true) { this.ParentForm.ParentForm.CreateProductFileForRandomMode2(); this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces = 2; } this.ParentForm.ParentForm.SaveSystemConfigurationFile1(this.ParentForm.ParentForm.SystemConfig1); this.UpdateCalibrationItemDisplay(this.ParentForm.ParentForm.CurrentSystemStatus.Equipment, this.ParentForm.ParentForm.CurrentCalibrationItem); } } } else { if (this.radioButtonDecimalPlaces0.Checked == true) { this.ParentForm.ParentForm.CreateProductFileForRandomMode(); this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces = 0; } else if (this.radioButtonDecimalPlaces1.Checked == true) { this.ParentForm.ParentForm.CreateProductFileForRandomMode(); this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces = 1; } else if (this.radioButtonDecimalPlaces2.Checked == true) { this.ParentForm.ParentForm.CreateProductFileForRandomMode2(); this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces = 2; } this.ParentForm.ParentForm.SaveSystemConfigurationFile1(this.ParentForm.ParentForm.SystemConfig1); this.UpdateCalibrationItemDisplay(this.ParentForm.ParentForm.CurrentSystemStatus.Equipment, this.ParentForm.ParentForm.CurrentCalibrationItem); } this.ParentForm.ParentForm.CloseSmartFileIO(); this.ParentForm.ParentForm.ReLoadProductFile(); this.ParentForm.ParentForm.TransferRandomMode(); } private void buttonZero_Click(object sender, EventArgs e) { this.ParentForm.ParentForm.TransferData(CommunicationCommand.Zero, CommunicationID.SubBoard1); } private void buttonStart_Click(object sender, EventArgs e) { this.listBoxHelp.ClearAll(); if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.English) { this.listBoxHelp.AddItem("Calibration start"); this.listBoxHelp.AddItem("Wait a minute."); } else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.Chinese) { this.listBoxHelp.AddItem("校准开始按钮"); this.listBoxHelp.AddItem("请等待"); } else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.Czech) { } else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.Russian) { this.listBoxHelp.AddItem("Начало калибровки"); this.listBoxHelp.AddItem("Подождите"); } else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.German) { this.listBoxHelp.AddItem("Kalibrierungsstart"); this.listBoxHelp.AddItem("bitte warten"); } else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.Spanish) { this.listBoxHelp.AddItem("Inicio de la calibración"); this.listBoxHelp.AddItem("Esperar"); } else { this.listBoxHelp.AddItem("중량조정을 시작합니다"); this.listBoxHelp.AddItem("잠시만 기다리세요"); } this.ParentForm.ParentForm.TransferData(CommunicationCommand.CalibrationStart, CommunicationID.SubBoard1); this.CalibrationButtonEnable(false, false, false); } private void buttonBalance_Click(object sender, EventArgs e) { this.listBoxHelp.ClearAll(); if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.English) { this.listBoxHelp.AddItem("Caculating..."); this.listBoxHelp.AddItem("Wait a minute."); } else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.Chinese) { this.listBoxHelp.AddItem("测量砝码中"); this.listBoxHelp.AddItem("请等待"); } else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.Czech) { } else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.Russian) { this.listBoxHelp.AddItem("Имерение…"); this.listBoxHelp.AddItem("Ожидайте"); } else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.German) { this.listBoxHelp.AddItem("Rechnen..."); this.listBoxHelp.AddItem("bitte warten."); } else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.Spanish) { this.listBoxHelp.AddItem("Caculando..."); this.listBoxHelp.AddItem("Esperar"); } else { this.listBoxHelp.AddItem("분동 계산중 입니다"); this.listBoxHelp.AddItem("잠시만 기다리세요"); } this.ParentForm.ParentForm.TransferData(CommunicationCommand.CalibrationBalance, CommunicationID.SubBoard1); this.CalibrationButtonEnable(false, false, true); } private void buttonCancel_Click(object sender, EventArgs e) { this.listBoxHelp.ClearAll(); if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.English) { this.listBoxHelp.AddItem("Cancel the calibration"); } else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.Chinese) { this.listBoxHelp.AddItem("取消重量调节"); } else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.Czech) { } else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.Russian) { this.listBoxHelp.AddItem("Отменить калибровку"); } else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.German) { this.listBoxHelp.AddItem("Brechen Sie die"); this.listBoxHelp.AddItem("Kalibrierung ab"); } else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.Spanish) { this.listBoxHelp.AddItem("Cancelar la calibración"); } else { this.listBoxHelp.AddItem("중량조정을 취소합니다"); } this.ParentForm.ParentForm.TransferData(CommunicationCommand.CalibrationCancel, CommunicationID.SubBoard1); this.CalibrationButtonEnable(true, false, false); } #endregion } }