ITC81DB_2H/ITC81DB_0H/Controls/Etc/ControlConfiSerialHitachi.cs

190 lines
8.9 KiB
C#

using System;
using System.Linq;
using System.Collections.ObjectModel;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Net.Sockets;
using System.Text;
using System.Threading;
using System.Windows.Forms;
using ITC81DB_0H.Forms;
using ITC81DB_2H_ImageDll;
using ITC81DB_0H.DialogForms;
namespace ITC81DB_0H
{
public partial class ControlConfiSerialHitachi : UserControl
{
#region Field
private FormMenu m_ParentForm;
#endregion
#region Constructor
public ControlConfiSerialHitachi(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.buttonBlank.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.engON_Black));
this.buttonBlank.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.engOFF_Black));
this.smartGroupBox1.Image = new Bitmap(images.GetImage(Class1.ButtonImages.engBackgroundBottomAddOn));
this.labelTitleRoomNumber.Text = "Room number setting(1~9)";
this.labelTitleBlank.Text = "Blank(ON : None, OFF : Space)";
}
else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.Chinese)
{
this.buttonBlank.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnON_Black));
this.buttonBlank.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnOFF_Black));
this.smartGroupBox1.Image = new Bitmap(images.GetImage(Class1.ButtonImages.chnBackgroundBottomAddOn));
this.labelTitleRoomNumber.Text = "房间号设定(1~9)";
this.labelTitleBlank.Text = "空白(开 : 不使用, 关闭 : 空白)";
}
else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.Czech)
{
}
else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.Russian)
{
this.buttonBlank.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.rusON_Black));
this.buttonBlank.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.rusOFF_Black));
this.smartGroupBox1.Image = new Bitmap(images.GetImage(Class1.ButtonImages.rusBackgroundBottomAddOn));
this.labelTitleRoomNumber.Text = "Установка номера комнаты(1~9)";
this.labelTitleBlank.Text = "Пусто (ВКЛ : Нет, ВЫКЛ : Пробел)";
}
else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.German)
{
this.buttonBlank.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.gerON_Black));
this.buttonBlank.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.gerOFF_Black));
this.smartGroupBox1.Image = new Bitmap(images.GetImage(Class1.ButtonImages.gerBackgroundBottomAddOn));
this.labelTitleRoomNumber.Text = "Einstellung der Zimmernummer(1~9)";
this.labelTitleBlank.Text = "Leer(EIN: Keine, AUS: Leerzeichen)";
}
else
{
this.buttonBlank.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.engON_Black));
this.buttonBlank.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.engOFF_Black));
this.smartGroupBox1.Image = new Bitmap(images.GetImage(Class1.ButtonImages.korBackgroundBottomAddOn));
this.labelTitleRoomNumber.Text = "방 번호 설정(1~9)";
this.labelTitleBlank.Text = "빈 칸 처리(ON : None, OFF : Space)";
}
}
private void DefaultSetting()
{
}
public void DisplayRefresh(DataStore.MenuBottomConfiguration menu)
{
if (menu == DataStore.MenuBottomConfiguration.SerialCOM1)
{
this.labelRoomNumber.Text = this.ParentForm.ParentForm.SystemConfig2.HitachiRoomNumberCOM1.ToString();
if (this.ParentForm.ParentForm.SystemConfig2.IsHitachiBlankToNoneCOM1 == true)
this.buttonBlank.ButtonDown();
else
this.buttonBlank.ButtonUp();
}
else if (menu == DataStore.MenuBottomConfiguration.SerialCOM3)
{
this.labelRoomNumber.Text = this.ParentForm.ParentForm.SystemConfig2.HitachiRoomNumberCOM3.ToString();
if (this.ParentForm.ParentForm.SystemConfig2.IsHitachiBlankToNoneCOM3 == true)
this.buttonBlank.ButtonDown();
else
this.buttonBlank.ButtonUp();
}
else if (menu == DataStore.MenuBottomConfiguration.SerialCOM4)
{
this.labelRoomNumber.Text = this.ParentForm.ParentForm.SystemConfig2.HitachiRoomNumberCOM4.ToString();
if (this.ParentForm.ParentForm.SystemConfig2.IsHitachiBlankToNoneCOM4 == true)
this.buttonBlank.ButtonDown();
else
this.buttonBlank.ButtonUp();
}
}
#endregion
#region Event Handler
private void labelRoomNumber_Click(object sender, EventArgs e)
{
string value = "";
DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelRoomNumber.Text, 1, 0, false, this.ParentForm.ParentForm.SystemConfig1.Language);
if (myKeyPad.ShowDialog() == DialogResult.OK)
{
if (myKeyPad.doubleValue < 1 || myKeyPad.doubleValue > 9)
{
// 입력범위를 확인하세요
DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.ParentForm.SystemConfig1.Language);
myMsg.ShowDialog();
}
else
{
this.labelRoomNumber.Text = myKeyPad.StringValue;
value = Helper.StringZeroFillDigits4(this.labelRoomNumber.Text);
DataStore.MenuBottomConfiguration temp = this.ParentForm.CurrentConfigurationMenu();
if (temp == DataStore.MenuBottomConfiguration.SerialCOM1)
this.ParentForm.ParentForm.SystemConfig2.HitachiRoomNumberCOM1 = myKeyPad.IntValue;
else if (temp == DataStore.MenuBottomConfiguration.SerialCOM3)
this.ParentForm.ParentForm.SystemConfig2.HitachiRoomNumberCOM3 = myKeyPad.IntValue;
else if (temp == DataStore.MenuBottomConfiguration.SerialCOM4)
this.ParentForm.ParentForm.SystemConfig2.HitachiRoomNumberCOM4 = myKeyPad.IntValue;
this.ParentForm.ParentForm.SaveSystemConfigurationFile2(this.ParentForm.ParentForm.SystemConfig2);
}
}
}
private void buttonBlank_Click(object sender, EventArgs e)
{
DataStore.MenuBottomConfiguration temp = this.ParentForm.CurrentConfigurationMenu();
if (this.buttonBlank.ButtonStatus == SmartX.SmartButton.BUTSTATUS.DOWN)
{
if (temp == DataStore.MenuBottomConfiguration.SerialCOM1)
this.ParentForm.ParentForm.SystemConfig2.IsHitachiBlankToNoneCOM1 = true;
else if (temp == DataStore.MenuBottomConfiguration.SerialCOM3)
this.ParentForm.ParentForm.SystemConfig2.IsHitachiBlankToNoneCOM3 = true;
else if (temp == DataStore.MenuBottomConfiguration.SerialCOM4)
this.ParentForm.ParentForm.SystemConfig2.IsHitachiBlankToNoneCOM4 = true;
}
else
{
if (temp == DataStore.MenuBottomConfiguration.SerialCOM1)
this.ParentForm.ParentForm.SystemConfig2.IsHitachiBlankToNoneCOM1 = false;
else if (temp == DataStore.MenuBottomConfiguration.SerialCOM3)
this.ParentForm.ParentForm.SystemConfig2.IsHitachiBlankToNoneCOM3 = false;
else if (temp == DataStore.MenuBottomConfiguration.SerialCOM4)
this.ParentForm.ParentForm.SystemConfig2.IsHitachiBlankToNoneCOM4 = false;
}
this.ParentForm.ParentForm.SaveSystemConfigurationFile2(this.ParentForm.ParentForm.SystemConfig2);
}
#endregion
}
}