2023-02-13 07:47:48 +00:00
|
|
|
|
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 SmartX;
|
|
|
|
|
using ITC81DB_2H_ImageDll;
|
2023-05-24 04:16:07 +00:00
|
|
|
|
using ITC81DB_2H.Datastore;
|
2023-02-13 07:47:48 +00:00
|
|
|
|
|
|
|
|
|
namespace ITC81DB_0H.Controls
|
|
|
|
|
{
|
|
|
|
|
public partial class ControlCenterSystemAutoZero : UserControl
|
|
|
|
|
{
|
|
|
|
|
#region Field
|
|
|
|
|
private FormMenu m_ParentForm;
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region Constructor
|
|
|
|
|
public ControlCenterSystemAutoZero(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();
|
|
|
|
|
|
2023-05-24 04:16:07 +00:00
|
|
|
|
if (this.ParentForm.ParentForm.SystemConfig1.Language == Define.E_LanguageID.English)
|
2023-02-13 07:47:48 +00:00
|
|
|
|
{
|
|
|
|
|
this.smartGroupBox1.Image = new Bitmap(images.GetImage(Class1.ButtonImages.engBackgroundAutoZero));
|
|
|
|
|
}
|
2023-05-24 04:16:07 +00:00
|
|
|
|
else if (this.ParentForm.ParentForm.SystemConfig1.Language == Define.E_LanguageID.Chinese)
|
2023-02-13 07:47:48 +00:00
|
|
|
|
{
|
|
|
|
|
this.smartGroupBox1.Image = new Bitmap(images.GetImage(Class1.ButtonImages.chnBackgroundAutoZero));
|
|
|
|
|
}
|
2023-05-24 04:16:07 +00:00
|
|
|
|
else if (this.ParentForm.ParentForm.SystemConfig1.Language == Define.E_LanguageID.Czech)
|
2023-02-13 07:47:48 +00:00
|
|
|
|
{
|
|
|
|
|
}
|
2023-05-24 04:16:07 +00:00
|
|
|
|
else if (this.ParentForm.ParentForm.SystemConfig1.Language == Define.E_LanguageID.Russian)
|
2023-02-13 07:47:48 +00:00
|
|
|
|
{
|
|
|
|
|
this.smartGroupBox1.Image = new Bitmap(images.GetImage(Class1.ButtonImages.rusBackgroundAutoZero));
|
|
|
|
|
}
|
2023-05-24 04:16:07 +00:00
|
|
|
|
else if (this.ParentForm.ParentForm.SystemConfig1.Language == Define.E_LanguageID.German)
|
2023-02-13 07:47:48 +00:00
|
|
|
|
{
|
|
|
|
|
this.smartGroupBox1.Image = new Bitmap(images.GetImage(Class1.ButtonImages.gerBackgroundAutoZero));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
this.smartGroupBox1.Image = new Bitmap(images.GetImage(Class1.ButtonImages.korBackgroundAutoZero));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
private void DefaultSetting()
|
|
|
|
|
{
|
|
|
|
|
this.comboBoxVariate.SelectedIndexChanged -= new EventHandler(this.comboBoxVariate_SelectedIndexChanged);
|
|
|
|
|
this.comboBoxVariate.Items.Clear();
|
|
|
|
|
this.comboBoxVariate.Items.Add(0.1);
|
|
|
|
|
this.comboBoxVariate.Items.Add(0.2);
|
|
|
|
|
this.comboBoxVariate.Items.Add(0.5);
|
|
|
|
|
this.comboBoxVariate.Items.Add(1.0);
|
|
|
|
|
this.comboBoxVariate.SelectedIndex = 0;
|
|
|
|
|
this.comboBoxVariate.SelectedIndexChanged += new EventHandler(this.comboBoxVariate_SelectedIndexChanged);
|
|
|
|
|
}
|
|
|
|
|
|
2023-02-23 08:34:29 +00:00
|
|
|
|
public void UpdateZeroParameterDisplay(SystemParameter4 item)
|
2023-02-13 07:47:48 +00:00
|
|
|
|
{
|
|
|
|
|
int iValue = 0;
|
|
|
|
|
string value = "";
|
|
|
|
|
|
2023-02-23 08:34:29 +00:00
|
|
|
|
// On/Off
|
|
|
|
|
if (item.MainAutoZeroIsAutoZeroUsing == false)
|
|
|
|
|
this.buttonIsAutoZeroUsing.ButtonUp();
|
2023-02-13 07:47:48 +00:00
|
|
|
|
else
|
2023-02-23 08:34:29 +00:00
|
|
|
|
this.buttonIsAutoZeroUsing.ButtonDown();
|
2023-02-13 07:47:48 +00:00
|
|
|
|
|
2023-02-23 08:34:29 +00:00
|
|
|
|
// + Range
|
|
|
|
|
value =Helper.StringToDecimalPlaces(item.MainAutoZeroPlusRange, this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces);
|
2023-02-13 07:47:48 +00:00
|
|
|
|
if (this.labelPlusRange.Text != value)
|
|
|
|
|
this.labelPlusRange.Text = value;
|
|
|
|
|
|
2023-02-23 08:34:29 +00:00
|
|
|
|
// - Range
|
|
|
|
|
value = Helper.StringToDecimalPlaces(item.MainAutoZeroMinusRange, this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces);
|
|
|
|
|
if (this.labelMinusRange.Text != value)
|
|
|
|
|
this.labelMinusRange.Text = value;
|
2023-02-13 07:47:48 +00:00
|
|
|
|
|
2023-02-23 08:34:29 +00:00
|
|
|
|
// Variate
|
|
|
|
|
iValue = int.Parse(item.MainAutoZeroVariate);
|
2023-02-13 07:47:48 +00:00
|
|
|
|
this.comboBoxVariate.SelectedIndexChanged -= new EventHandler(this.comboBoxVariate_SelectedIndexChanged);
|
|
|
|
|
this.comboBoxVariate.SelectedIndex = iValue;
|
|
|
|
|
this.comboBoxVariate.SelectedIndexChanged += new EventHandler(this.comboBoxVariate_SelectedIndexChanged);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void DisplayRefresh(SystemStatus status)
|
|
|
|
|
{
|
2023-05-24 04:16:07 +00:00
|
|
|
|
this.ParentForm.ParentForm.CurrentSystemStatus.CurrentDisplay = Define.E_DisplayStore.SystemAutoZero;
|
|
|
|
|
this.ParentForm.ParentForm.SetDisplayMode(Define.E_DisplayMode.Menu);
|
2023-02-13 07:47:48 +00:00
|
|
|
|
this.ParentForm.DisplayTitleRoot(this.ParentForm.ParentForm.CurrentSystemStatus);
|
|
|
|
|
|
|
|
|
|
//this.UpdateZeroParameterDisplay(this.ParentForm.ParentForm.CurrentSystemParameter4);
|
2023-02-23 08:34:29 +00:00
|
|
|
|
this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Read, CommunicationID.MainBoard, CommunicationAddress.ParameterRead4907, "");
|
2023-02-13 07:47:48 +00:00
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region Event Handler
|
|
|
|
|
private void buttonIsAutoZeroUsing_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
2023-02-27 11:52:59 +00:00
|
|
|
|
string value = "";
|
2023-05-24 04:16:07 +00:00
|
|
|
|
string before = "", after = "";
|
|
|
|
|
|
|
|
|
|
if (this.ParentForm.ParentForm.CurrentSystemParameter4.LCDAutoZeroIsAutoZeroUsing == true)
|
|
|
|
|
before = "ON";
|
|
|
|
|
else
|
|
|
|
|
before = "OFF";
|
2023-02-27 11:52:59 +00:00
|
|
|
|
|
2023-02-13 07:47:48 +00:00
|
|
|
|
if (this.buttonIsAutoZeroUsing.ButtonStatus == SmartButton.BUTSTATUS.DOWN)
|
2023-05-24 04:16:07 +00:00
|
|
|
|
{
|
2023-02-13 07:47:48 +00:00
|
|
|
|
this.ParentForm.ParentForm.CurrentSystemParameter4.LCDAutoZeroIsAutoZeroUsing = true;
|
2023-05-24 04:16:07 +00:00
|
|
|
|
after = "ON";
|
|
|
|
|
}
|
2023-02-13 07:47:48 +00:00
|
|
|
|
else
|
2023-05-24 04:16:07 +00:00
|
|
|
|
{
|
2023-02-13 07:47:48 +00:00
|
|
|
|
this.ParentForm.ParentForm.CurrentSystemParameter4.LCDAutoZeroIsAutoZeroUsing = false;
|
2023-05-24 04:16:07 +00:00
|
|
|
|
after = "OFF";
|
|
|
|
|
}
|
2023-02-13 07:47:48 +00:00
|
|
|
|
|
|
|
|
|
this.ParentForm.ParentForm.SaveSystemParameter4File(this.ParentForm.ParentForm.CurrentSystemParameter4);
|
2023-02-27 11:52:59 +00:00
|
|
|
|
|
|
|
|
|
value = Helper.StringZeroFillDigits4(Convert.ToInt16(this.ParentForm.ParentForm.CurrentSystemParameter4.LCDAutoZeroIsAutoZeroUsing));
|
|
|
|
|
this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress.AutoZeroIsUsing, value);
|
2023-05-24 04:16:07 +00:00
|
|
|
|
|
|
|
|
|
if (before != after)
|
|
|
|
|
this.ParentForm.ParentForm.SetTrackingHistoryData(Define.E_TrackingParameter.AutoZeroIsUsing, "", before, after);
|
2023-02-13 07:47:48 +00:00
|
|
|
|
}
|
|
|
|
|
private void labelPlusRange_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
string value = "";
|
2023-05-24 04:16:07 +00:00
|
|
|
|
string before = "", after = "";
|
|
|
|
|
|
|
|
|
|
before = this.labelPlusRange.Text;
|
2023-02-13 07:47:48 +00:00
|
|
|
|
DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelPlusRange.Text, 5, this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces, false, this.ParentForm.ParentForm.SystemConfig1.Language);
|
|
|
|
|
|
|
|
|
|
if (myKeyPad.ShowDialog() == DialogResult.OK)
|
|
|
|
|
{
|
|
|
|
|
if (myKeyPad.doubleValue > 500.0)
|
|
|
|
|
{
|
|
|
|
|
// 입력범위를 확인하세요
|
|
|
|
|
DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.ParentForm.SystemConfig1.Language);
|
|
|
|
|
myMsg.ShowDialog();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2023-05-24 04:16:07 +00:00
|
|
|
|
after = this.labelPlusRange.Text = myKeyPad.StringValue;
|
2023-02-13 07:47:48 +00:00
|
|
|
|
this.ParentForm.ParentForm.CurrentSystemParameter4.LCDAutoZeroPlusRange = myKeyPad.StringValue.Replace(".","");
|
|
|
|
|
this.ParentForm.ParentForm.SaveSystemParameter4File(this.ParentForm.ParentForm.CurrentSystemParameter4);
|
|
|
|
|
|
2023-02-27 11:52:59 +00:00
|
|
|
|
value = Helper.StringZeroFillDigits7(this.ParentForm.ParentForm.CurrentSystemParameter4.LCDAutoZeroPlusRange);
|
2023-02-13 07:47:48 +00:00
|
|
|
|
this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress.AutoZeroPlusRange, value);
|
2023-05-24 04:16:07 +00:00
|
|
|
|
|
|
|
|
|
if (before != after)
|
|
|
|
|
this.ParentForm.ParentForm.SetTrackingHistoryData(Define.E_TrackingParameter.AutoZeroRangePlus, "", before, after);
|
2023-02-13 07:47:48 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
private void labelMinusRange_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
string value = "";
|
2023-05-24 04:16:07 +00:00
|
|
|
|
string before = "", after = "";
|
|
|
|
|
|
|
|
|
|
before = this.labelMinusRange.Text;
|
2023-02-13 07:47:48 +00:00
|
|
|
|
DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelMinusRange.Text, 5, this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces, false, this.ParentForm.ParentForm.SystemConfig1.Language);
|
|
|
|
|
|
|
|
|
|
if (myKeyPad.ShowDialog() == DialogResult.OK)
|
|
|
|
|
{
|
|
|
|
|
if (myKeyPad.doubleValue > 500.0)
|
|
|
|
|
{
|
|
|
|
|
// 입력범위를 확인하세요
|
|
|
|
|
DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.ParentForm.SystemConfig1.Language);
|
|
|
|
|
myMsg.ShowDialog();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2023-05-24 04:16:07 +00:00
|
|
|
|
after = this.labelMinusRange.Text = myKeyPad.StringValue;
|
2023-02-13 07:47:48 +00:00
|
|
|
|
this.ParentForm.ParentForm.CurrentSystemParameter4.LCDAutoZeroMinusRange = myKeyPad.StringValue.Replace(".", "");
|
|
|
|
|
this.ParentForm.ParentForm.SaveSystemParameter4File(this.ParentForm.ParentForm.CurrentSystemParameter4);
|
|
|
|
|
|
2023-02-27 11:52:59 +00:00
|
|
|
|
value = Helper.StringZeroFillDigits7(this.ParentForm.ParentForm.CurrentSystemParameter4.LCDAutoZeroMinusRange);
|
2023-02-13 07:47:48 +00:00
|
|
|
|
this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress.AutoZeroMinusRange, value);
|
2023-05-24 04:16:07 +00:00
|
|
|
|
|
|
|
|
|
if (before != after)
|
|
|
|
|
this.ParentForm.ParentForm.SetTrackingHistoryData(Define.E_TrackingParameter.AutoZeroRangeMinus, "", before, after);
|
2023-02-13 07:47:48 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
private void comboBoxVariate_SelectedIndexChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
string value = "";
|
2023-05-24 04:16:07 +00:00
|
|
|
|
string before = "", after = "";
|
|
|
|
|
|
|
|
|
|
before = this.ParentForm.ParentForm.CurrentSystemParameter4.LCDAutoZeroVariate;
|
2023-02-13 07:47:48 +00:00
|
|
|
|
|
2023-05-24 04:16:07 +00:00
|
|
|
|
after = this.ParentForm.ParentForm.CurrentSystemParameter4.LCDAutoZeroVariate = this.comboBoxVariate.SelectedIndex.ToString();
|
2023-02-13 07:47:48 +00:00
|
|
|
|
this.ParentForm.ParentForm.SaveSystemParameter4File(this.ParentForm.ParentForm.CurrentSystemParameter4);
|
|
|
|
|
|
|
|
|
|
value = Helper.StringZeroFillDigits4(this.comboBoxVariate.SelectedIndex.ToString());
|
|
|
|
|
this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress.AutoZeroVariate, value);
|
2023-05-24 04:16:07 +00:00
|
|
|
|
|
|
|
|
|
if (before != after)
|
|
|
|
|
this.ParentForm.ParentForm.SetTrackingHistoryData(Define.E_TrackingParameter.AutoZeroVariation, "", before, after);
|
2023-02-13 07:47:48 +00:00
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
}
|