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.Forms; using ITC81DB_ImageDll; namespace ITC81DB.Controls { public partial class ControlCenterBasicTime : UserControl { #region Field private FormMenu m_ParentForm; #endregion #region Constructor public ControlCenterBasicTime(FormMenu parent) { InitializeComponent(); this.ParentForm = parent; this.InitializeDesign(); this.DefaultSetting(); this.timer.Enabled = true; } #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.engBackgroundTime)); } else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.Chinese) { this.smartGroupBox1.Image = new Bitmap(images.GetImage(Class1.ButtonImages.chnBackgroundTime)); } 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.rusBackgroundTime)); } else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.German) { this.smartGroupBox1.Image = new Bitmap(images.GetImage(Class1.ButtonImages.gerBackgroundTime)); } else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.Spanish) { this.smartGroupBox1.Image = new Bitmap(images.GetImage(Class1.ButtonImages.engBackgroundTime)); } else { this.smartGroupBox1.Image = new Bitmap(images.GetImage(Class1.ButtonImages.korBackgroundTime)); } } private void DefaultSetting() { } public void DisplayRefresh(SystemStatus status) { DateTime currentTime = DateTime.Now; this.ParentForm.ParentForm.CurrentSystemStatus.CurrentDisplay = DataStore.DisplayStore.BasicTime; this.ParentForm.ParentForm.SetDisplayMode(DataStore.DisplayMode.Menu); this.ParentForm.DisplayTitleRoot(this.ParentForm.ParentForm.CurrentSystemStatus); this.labelCurrentTime.Text = currentTime.ToString("yyyy-MM-dd HH:mm:ss"); this.upDownYear.Value = currentTime.Year; this.upDownMonth.Value = currentTime.Month; this.upDownDate.Value = currentTime.Day; this.upDownHour.Value = currentTime.Hour; this.upDownMinute.Value = currentTime.Minute; this.timer.Enabled = true; this.buttonSave.Visible = false; } #endregion #region Event Handler private void buttonTimeSetting_Click(object sender, EventArgs e) { this.timer.Enabled = false; this.buttonSave.Visible = true; } private void buttonSave_Click(object sender, EventArgs e) { DateTime setDateTime; try { setDateTime = new DateTime(int.Parse(this.upDownYear.TxtValue), int.Parse(this.upDownMonth.TxtValue), int.Parse(this.upDownDate.TxtValue), int.Parse(this.upDownHour.TxtValue), int.Parse(this.upDownMinute.TxtValue), 00); } catch { this.DisplayRefresh(this.ParentForm.ParentForm.CurrentSystemStatus); return; } this.ParentForm.ParentForm.smartConfigs.ControlPanel.SetSystemDateTime(setDateTime); this.timer.Enabled = true; this.buttonSave.Visible = false; } private void timer_Tick(object sender, EventArgs e) { DateTime currentTime = DateTime.Now; this.labelCurrentTime.Text = currentTime.ToString("yyyy-MM-dd HH:mm:ss"); if (this.upDownMinute.TxtValue != Helper.StringZeroFillDigits2(currentTime.Minute.ToString())) { this.upDownHour.Value = currentTime.Hour; this.upDownMinute.Value = currentTime.Minute; } this.ParentForm.ParentForm.ChildFormMainDisplay.UpdateTimeDisplay(); } #endregion } }