420 lines
		
	
	
		
			17 KiB
		
	
	
	
		
			C#
		
	
			
		
		
	
	
			420 lines
		
	
	
		
			17 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.Forms;
 | |
| using ITC81DB_0H_ImageDll;
 | |
| using ITC81DB_0H.DialogForms;
 | |
| 
 | |
| namespace ITC81DB_0H
 | |
| {
 | |
|     public partial class ControlConfiSerialMarkoPrint : UserControl
 | |
|     {
 | |
|         #region Field
 | |
|         private FormMenu m_ParentForm; 
 | |
|         #endregion
 | |
| 
 | |
|         #region Constructor
 | |
|         public ControlConfiSerialMarkoPrint(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.engBackgroundBottomAddOn));
 | |
| 
 | |
|                 this.buttonMarkoprintInput.Text = "Input";
 | |
| 
 | |
|                 this.checkBoxDate.Text = "Add date";
 | |
|                 this.checkBoxTodayDate.Text = "Today date";
 | |
|                 this.radioButtonLine1.Text = "1";
 | |
|                 this.radioButtonLine2.Text = "2";
 | |
|                 this.labelTitleSettingDate.Text = "Date setting";
 | |
|                 this.labelTitleLineNumber.Text = "Line number";
 | |
|             }
 | |
|             else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.Chinese)
 | |
|             {
 | |
|                 this.smartGroupBox1.Image = new Bitmap(images.GetImage(Class1.ButtonImages.chnBackgroundBottomAddOn));
 | |
| 
 | |
|                 this.buttonMarkoprintInput.Text = "输入";
 | |
| 
 | |
|                 this.checkBoxDate.Text = "加入日期";
 | |
|                 this.checkBoxTodayDate.Text = "今天日期";
 | |
|                 this.radioButtonLine1.Text = "1";
 | |
|                 this.radioButtonLine2.Text = "2";
 | |
|                 this.labelTitleSettingDate.Text = "设定日期";
 | |
|                 this.labelTitleLineNumber.Text = "电话号码";
 | |
|             }
 | |
|             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.rusBackgroundBottomAddOn));
 | |
| 
 | |
|                 this.buttonMarkoprintInput.Text = "Ввод";
 | |
| 
 | |
|                 this.checkBoxDate.Text = "Добавить дату";
 | |
|                 this.checkBoxTodayDate.Text = "Текущая дата";
 | |
|                 this.radioButtonLine1.Text = "1 строка";
 | |
|                 this.radioButtonLine2.Text = "2 строка";
 | |
|                 this.labelTitleSettingDate.Text = "Настроить дату";
 | |
|                 this.labelTitleLineNumber.Text = "Номер строки";
 | |
|             }
 | |
|             else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.German)
 | |
|             {
 | |
|                 this.smartGroupBox1.Image = new Bitmap(images.GetImage(Class1.ButtonImages.gerBackgroundBottomAddOn));
 | |
| 
 | |
|                 this.buttonMarkoprintInput.Text = "Eingang";
 | |
| 
 | |
|                 this.checkBoxDate.Text = "Datum hinzufügen";
 | |
|                 this.checkBoxTodayDate.Text = "Heutiges Datum";
 | |
|                 this.radioButtonLine1.Text = "1";
 | |
|                 this.radioButtonLine2.Text = "2";
 | |
|                 this.labelTitleSettingDate.Text = "Datum einstellen";
 | |
|                 this.labelTitleLineNumber.Text = "Zeile";
 | |
|             }
 | |
|             else
 | |
|             {
 | |
|                 this.smartGroupBox1.Image = new Bitmap(images.GetImage(Class1.ButtonImages.korBackgroundBottomAddOn));
 | |
| 
 | |
|                 this.buttonMarkoprintInput.Text = "입력";
 | |
| 
 | |
|                 this.checkBoxDate.Text = "날짜 표시";
 | |
|                 this.checkBoxTodayDate.Text = "오늘 날짜";
 | |
|                 this.radioButtonLine1.Text = "1줄";
 | |
|                 this.radioButtonLine2.Text = "2줄";
 | |
|                 this.labelTitleSettingDate.Text = "출력날짜설정";
 | |
|                 this.labelTitleLineNumber.Text = "출력 줄 수";
 | |
|             }
 | |
|         }
 | |
|         private void DefaultSetting()
 | |
|         {
 | |
| 
 | |
|         }
 | |
| 
 | |
|         public void DisplayRefresh(DataStore.MenuBottomConfiguration menu)
 | |
|         {
 | |
|             string sDate = string.Format("{0:yyyy.MM.dd}", DateTime.Now);
 | |
| 
 | |
|             this.radioButtonLine1.Click -= new EventHandler(this.radioButtonLine_Click);
 | |
|             this.radioButtonLine2.Click -= new EventHandler(this.radioButtonLine_Click);
 | |
|             this.checkBoxDate.Click -= new EventHandler(this.checkBoxDate_Click);
 | |
|             this.checkBoxTodayDate.Click -= new EventHandler(this.checkBoxTodayDate_Click);
 | |
| 
 | |
|             if (menu == DataStore.MenuBottomConfiguration.SerialCOM1)
 | |
|             {
 | |
|                 if (this.ParentForm.ParentForm.SystemConfig2.MarkoprintLineNumberCOM1 == 0)
 | |
|                 {
 | |
|                     this.radioButtonLine1.Checked = true;
 | |
|                     this.radioButtonLine2.Checked = false;
 | |
|                 }
 | |
|                 else
 | |
|                 {
 | |
|                     this.radioButtonLine1.Checked = false;
 | |
|                     this.radioButtonLine2.Checked = true;
 | |
|                 }
 | |
| 
 | |
|                 if (this.ParentForm.ParentForm.SystemConfig2.IsMarkoprintDatePrintCOM1 == true)
 | |
|                     this.checkBoxDate.Checked = true;
 | |
|                 else
 | |
|                     this.checkBoxDate.Checked = false;
 | |
| 
 | |
|                 if (this.ParentForm.ParentForm.SystemConfig2.IsMarkoprintTodaytDatePrintCOM1 == true)
 | |
|                 {
 | |
|                     this.ParentForm.ParentForm.SystemConfig2.MarkoprintDateSettingCOM1 = sDate;
 | |
|                     this.checkBoxTodayDate.Checked = true;
 | |
|                 }
 | |
|                 else
 | |
|                     this.checkBoxTodayDate.Checked = false;
 | |
| 
 | |
|                 this.textBoxMarkoprint.Text = this.ParentForm.ParentForm.SystemConfig2.MarkoprintDateSettingCOM1;
 | |
|             }
 | |
|             else if (menu == DataStore.MenuBottomConfiguration.SerialCOM3)
 | |
|             {
 | |
|                 if (this.ParentForm.ParentForm.SystemConfig2.MarkoprintLineNumberCOM3 == 0)
 | |
|                 {
 | |
|                     this.radioButtonLine1.Checked = true;
 | |
|                     this.radioButtonLine2.Checked = false;
 | |
|                 }
 | |
|                 else
 | |
|                 {
 | |
|                     this.radioButtonLine1.Checked = false;
 | |
|                     this.radioButtonLine2.Checked = true;
 | |
|                 }
 | |
| 
 | |
|                 if (this.ParentForm.ParentForm.SystemConfig2.IsMarkoprintDatePrintCOM3 == true)
 | |
|                 {
 | |
|                     this.ParentForm.ParentForm.SystemConfig2.MarkoprintDateSettingCOM3 = sDate;
 | |
|                     this.checkBoxTodayDate.Checked = true;
 | |
|                 }
 | |
|                 else
 | |
|                     this.checkBoxDate.Checked = false;
 | |
| 
 | |
|                 if (this.ParentForm.ParentForm.SystemConfig2.IsMarkoprintTodaytDatePrintCOM3 == true)
 | |
|                     this.checkBoxTodayDate.Checked = true;
 | |
|                 else
 | |
|                     this.checkBoxTodayDate.Checked = false;
 | |
| 
 | |
|                 this.textBoxMarkoprint.Text = this.ParentForm.ParentForm.SystemConfig2.MarkoprintDateSettingCOM3;
 | |
|             }
 | |
|             else if (menu == DataStore.MenuBottomConfiguration.SerialCOM4)
 | |
|             {
 | |
|                 if (this.ParentForm.ParentForm.SystemConfig2.MarkoprintLineNumberCOM4 == 0)
 | |
|                 {
 | |
|                     this.radioButtonLine1.Checked = true;
 | |
|                     this.radioButtonLine2.Checked = false;
 | |
|                 }
 | |
|                 else
 | |
|                 {
 | |
|                     this.radioButtonLine1.Checked = false;
 | |
|                     this.radioButtonLine2.Checked = true;
 | |
|                 }
 | |
| 
 | |
|                 if (this.ParentForm.ParentForm.SystemConfig2.IsMarkoprintDatePrintCOM4 == true)
 | |
|                     this.checkBoxDate.Checked = true;
 | |
|                 else
 | |
|                     this.checkBoxDate.Checked = false;
 | |
| 
 | |
|                 if (this.ParentForm.ParentForm.SystemConfig2.IsMarkoprintTodaytDatePrintCOM4 == true)
 | |
|                 {
 | |
|                     this.ParentForm.ParentForm.SystemConfig2.MarkoprintDateSettingCOM4 = sDate;
 | |
|                     this.checkBoxTodayDate.Checked = true;
 | |
|                 }
 | |
|                 else
 | |
|                     this.checkBoxTodayDate.Checked = false;
 | |
| 
 | |
|                 this.textBoxMarkoprint.Text = this.ParentForm.ParentForm.SystemConfig2.MarkoprintDateSettingCOM4;
 | |
|             }
 | |
| 
 | |
|             this.radioButtonLine1.Click += new EventHandler(this.radioButtonLine_Click);
 | |
|             this.radioButtonLine2.Click += new EventHandler(this.radioButtonLine_Click);
 | |
|             this.checkBoxDate.Click += new EventHandler(this.checkBoxDate_Click);
 | |
|             this.checkBoxTodayDate.Click += new EventHandler(this.checkBoxTodayDate_Click);
 | |
| 
 | |
|             this.ParentForm.ParentForm.SaveSystemConfigurationFile2(this.ParentForm.ParentForm.SystemConfig2);
 | |
|         }        
 | |
|         #endregion
 | |
| 
 | |
|         #region Event Handler
 | |
|         private void radioButtonLine_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             DataStore.MenuBottomConfiguration temp = this.ParentForm.CurrentConfigurationMenu();
 | |
|             SmartX.SmartRadioButton rb = sender as SmartX.SmartRadioButton;
 | |
| 
 | |
|             if (rb == null)
 | |
|                 return;
 | |
| 
 | |
|             if (rb == this.radioButtonLine1)
 | |
|             {
 | |
|                 switch (temp)
 | |
|                 {
 | |
|                     case DataStore.MenuBottomConfiguration.SerialCOM1:
 | |
|                         this.ParentForm.ParentForm.SystemConfig2.MarkoprintLineNumberCOM1 = 0;
 | |
|                         break;
 | |
|                     case DataStore.MenuBottomConfiguration.SerialCOM3:
 | |
|                         this.ParentForm.ParentForm.SystemConfig2.MarkoprintLineNumberCOM3 = 0;
 | |
|                         break;
 | |
|                     case DataStore.MenuBottomConfiguration.SerialCOM4:
 | |
|                         this.ParentForm.ParentForm.SystemConfig2.MarkoprintLineNumberCOM4 = 0;
 | |
|                         break;
 | |
|                     default:
 | |
|                         break;
 | |
|                 }
 | |
|             }
 | |
|             else if (rb == this.radioButtonLine2)
 | |
|             {
 | |
|                 switch (temp)
 | |
|                 {
 | |
|                     case DataStore.MenuBottomConfiguration.SerialCOM1:
 | |
|                         this.ParentForm.ParentForm.SystemConfig2.MarkoprintLineNumberCOM1 = 1;
 | |
|                         break;
 | |
|                     case DataStore.MenuBottomConfiguration.SerialCOM3:
 | |
|                         this.ParentForm.ParentForm.SystemConfig2.MarkoprintLineNumberCOM3 = 1;
 | |
|                         break;
 | |
|                     case DataStore.MenuBottomConfiguration.SerialCOM4:
 | |
|                         this.ParentForm.ParentForm.SystemConfig2.MarkoprintLineNumberCOM4 = 1;
 | |
|                         break;
 | |
|                     default:
 | |
|                         break;
 | |
|                 }
 | |
|             }
 | |
| 
 | |
|             this.ParentForm.ParentForm.SaveSystemConfigurationFile2(this.ParentForm.ParentForm.SystemConfig2);
 | |
| 
 | |
|         }
 | |
| 
 | |
|         private void checkBoxDate_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             DataStore.MenuBottomConfiguration temp = this.ParentForm.CurrentConfigurationMenu();
 | |
| 
 | |
|             if (this.checkBoxDate.Checked == true)
 | |
|             {
 | |
|                 switch (temp)
 | |
|                 {
 | |
|                     case DataStore.MenuBottomConfiguration.SerialCOM1:
 | |
|                         this.ParentForm.ParentForm.SystemConfig2.IsMarkoprintDatePrintCOM1 = true;
 | |
|                         break;
 | |
|                     case DataStore.MenuBottomConfiguration.SerialCOM3:
 | |
|                         this.ParentForm.ParentForm.SystemConfig2.IsMarkoprintDatePrintCOM3 = true;
 | |
|                         break;
 | |
|                     case DataStore.MenuBottomConfiguration.SerialCOM4:
 | |
|                         this.ParentForm.ParentForm.SystemConfig2.IsMarkoprintDatePrintCOM4 = true;
 | |
|                         break;
 | |
|                     default:
 | |
|                         break;
 | |
|                 }
 | |
|             }
 | |
|             else
 | |
|             {
 | |
|                 switch (temp)
 | |
|                 {
 | |
|                     case DataStore.MenuBottomConfiguration.SerialCOM1:
 | |
|                         this.ParentForm.ParentForm.SystemConfig2.IsMarkoprintDatePrintCOM1 = false;
 | |
|                         break;
 | |
|                     case DataStore.MenuBottomConfiguration.SerialCOM3:
 | |
|                         this.ParentForm.ParentForm.SystemConfig2.IsMarkoprintDatePrintCOM3 = false;
 | |
|                         break;
 | |
|                     case DataStore.MenuBottomConfiguration.SerialCOM4:
 | |
|                         this.ParentForm.ParentForm.SystemConfig2.IsMarkoprintDatePrintCOM4 = false;
 | |
|                         break;
 | |
|                     default:
 | |
|                         break;
 | |
|                 }
 | |
|             }
 | |
| 
 | |
|             this.ParentForm.ParentForm.SaveSystemConfigurationFile2(this.ParentForm.ParentForm.SystemConfig2);
 | |
|         }
 | |
| 
 | |
|         private void checkBoxTodayDate_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             DataStore.MenuBottomConfiguration temp = this.ParentForm.CurrentConfigurationMenu();
 | |
|             
 | |
|             if (this.checkBoxTodayDate.Checked == true)
 | |
|             {
 | |
|                 string sDate = string.Format("{0:yyyy.MM.dd}", DateTime.Now);
 | |
| 
 | |
|                 switch (temp)
 | |
|                 {
 | |
|                     case DataStore.MenuBottomConfiguration.SerialCOM1:
 | |
|                         this.ParentForm.ParentForm.SystemConfig2.MarkoprintDateSettingCOM1 = sDate;
 | |
|                         this.ParentForm.ParentForm.SystemConfig2.IsMarkoprintTodaytDatePrintCOM1 = true;
 | |
|                         break;
 | |
|                     case DataStore.MenuBottomConfiguration.SerialCOM3:
 | |
|                         this.ParentForm.ParentForm.SystemConfig2.MarkoprintDateSettingCOM3 = sDate;
 | |
|                         this.ParentForm.ParentForm.SystemConfig2.IsMarkoprintTodaytDatePrintCOM3 = true;
 | |
|                         break;
 | |
|                     case DataStore.MenuBottomConfiguration.SerialCOM4:
 | |
|                         this.ParentForm.ParentForm.SystemConfig2.MarkoprintDateSettingCOM4 = sDate;
 | |
|                         this.ParentForm.ParentForm.SystemConfig2.IsMarkoprintTodaytDatePrintCOM4 = true;
 | |
|                         break;
 | |
|                     default:
 | |
|                         break;
 | |
|                 }
 | |
| 
 | |
|                 this.textBoxMarkoprint.Text = sDate;
 | |
|                 this.buttonMarkoprintInput.Enabled = false;
 | |
|             }
 | |
|             else
 | |
|             {
 | |
|                 switch (temp)
 | |
|                 {
 | |
|                     case DataStore.MenuBottomConfiguration.SerialCOM1:
 | |
|                         this.ParentForm.ParentForm.SystemConfig2.IsMarkoprintTodaytDatePrintCOM1 = false;
 | |
|                         break;
 | |
|                     case DataStore.MenuBottomConfiguration.SerialCOM3:
 | |
|                         this.ParentForm.ParentForm.SystemConfig2.IsMarkoprintTodaytDatePrintCOM3 = false;
 | |
|                         break;
 | |
|                     case DataStore.MenuBottomConfiguration.SerialCOM4:
 | |
|                         this.ParentForm.ParentForm.SystemConfig2.IsMarkoprintTodaytDatePrintCOM4 = false;
 | |
|                         break;
 | |
|                     default:
 | |
|                         break;
 | |
|                 }
 | |
| 
 | |
|                 this.buttonMarkoprintInput.Enabled = true;
 | |
|             }
 | |
| 
 | |
|             this.ParentForm.ParentForm.SaveSystemConfigurationFile2(this.ParentForm.ParentForm.SystemConfig2);
 | |
|         }
 | |
| 
 | |
|         private void buttonMarkoprintInput_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             this.smartKeyboard1.KeyboardType = SmartX.SmartKeyboard.KEYBOARDTYPES.NORMAL;
 | |
|             this.smartKeyboard1.Location = new Point(142, 43);
 | |
|             this.smartKeyboard1.Size = new Size(500, 200);
 | |
|             this.smartKeyboard1.Hide();
 | |
| 
 | |
|             this.smartKeyboard1.TargetInputObject = this.textBoxMarkoprint;
 | |
|             this.smartKeyboard1.Show();
 | |
| 
 | |
|             this.textBoxMarkoprint.Select(this.textBoxMarkoprint.Text.Length, 0);
 | |
|         }
 | |
| 
 | |
|         private void textBoxMarkoprint_KeyPress(object sender, KeyPressEventArgs e)
 | |
|         {
 | |
|             if (e.KeyChar == '\r')
 | |
|             {
 | |
|                 e.Handled = true;
 | |
| 
 | |
|                 DataStore.MenuBottomConfiguration temp = this.ParentForm.CurrentConfigurationMenu();
 | |
| 
 | |
|                 switch (temp)
 | |
|                 {
 | |
|                     case DataStore.MenuBottomConfiguration.SerialCOM1:
 | |
|                         this.ParentForm.ParentForm.SystemConfig2.MarkoprintDateSettingCOM1 = this.textBoxMarkoprint.Text;
 | |
|                         break;
 | |
|                     case DataStore.MenuBottomConfiguration.SerialCOM3:
 | |
|                         this.ParentForm.ParentForm.SystemConfig2.MarkoprintDateSettingCOM3 = this.textBoxMarkoprint.Text;
 | |
|                         break;
 | |
|                     case DataStore.MenuBottomConfiguration.SerialCOM4:
 | |
|                         this.ParentForm.ParentForm.SystemConfig2.MarkoprintDateSettingCOM4 = this.textBoxMarkoprint.Text;
 | |
|                         break;
 | |
|                     default:
 | |
|                         break;
 | |
|                 }
 | |
|                 this.ParentForm.ParentForm.SaveSystemConfigurationFile2(this.ParentForm.ParentForm.SystemConfig2);
 | |
| 
 | |
|                 this.smartKeyboard1.Hide();
 | |
|             }
 | |
|             else if (e.KeyChar == 27)
 | |
|             {
 | |
|                 //ESC
 | |
|                 e.Handled = true;
 | |
|                 this.smartKeyboard1.Hide();
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         private void smartKeyboard1_OnXKeyClick(object sender, EventArgs e)
 | |
|         {
 | |
|             this.smartKeyboard1.Hide();
 | |
|         } 
 | |
|         #endregion
 | |
|     }
 | |
| }
 |