private void Setting35_Load(object sender, EventArgs e) { SystemEvents.TimeChanged += new EventHandler(SystemEvent_TimeChanged); lbl_LoggerDate.Text = DateTime.Now.ToShortDateString(); lbl_LoggerTime.Text = DateTime.Now.ToShortTimeString(); cbbTimeZone.Text = TimeZoneInfo.Local.ToString(); cbbTimeZone.Items.Clear(); ReadOnlyCollection <TimeZoneInfo> timeZones = TimeZoneInfo.GetSystemTimeZones(); foreach (TimeZoneInfo timeZoneInfo in timeZones) { cbbTimeZone.Items.Add(timeZoneInfo.DisplayName); } TimeZone zone = TimeZone.CurrentTimeZone; DateTime local = zone.ToLocalTime(DateTime.Now); Tim_UpdateClock.Enabled = true; byte[] bufSetting = new byte[360]; string FileName = ""; FileName = mGlobal.app_patch(FileName); if (System.IO.File.Exists(FileName + "\\dataSetting.txt") == true) { bufSetting = System.IO.File.ReadAllBytes(FileName + "\\dataSetting.txt"); device35.openSetting(bufSetting); txtSerial.Text = device35.Serial; txtDescription.Text = device35.Description; txtLocation.Text = device35.Location; if (device35.Duration != 65535) { int sec1 = 0; int min2 = 0; if (Convert.ToInt32(device35.Duration) > 60) { min2 = Convert.ToInt32(device35.Duration) / 60; sec1 = Convert.ToInt32(device35.Duration) % 60; lb_interval.Text = string.Format("{0}: {1} min {2} sec.", "Sample interval", min2, sec1); } else { lb_interval.Text = string.Format("{0}: {1} sec.", "Sample interval", Convert.ToInt32(device35.Duration)); } } else { lb_interval.Text = 0.ToString(); } if (device35.Delay == 255) { cbbStartDelay.Text = cbbStartDelay.Items[0].ToString(); } else { cbbStartDelay.Text = device35.Delay.ToString(); } if (device35.Duration == 65535) { cbbDuration.Text = cbbDuration.Items[0].ToString(); } else { cbbDuration.Text = device35.Duration.ToString(); } string Zone = mGlobal.FindSystemTimeZoneFromString(device35.Timezone.ToString()).ToString(); for (int i = 0; i <= cbbTimeZone.Items.Count - 1; i++) { if (cbbTimeZone.Items[i].ToString() == Zone) { cbbTimeZone.Text = cbbTimeZone.Items[i].ToString(); } } } else { btnReadSetting_Click(sender, e); } cbbChannel.Items.Clear(); for (int i = 1; i <= 4; i++) { cbbChannel.Items.Add(i); } cbbChannel.Text = cbbChannel.Items[0].ToString(); cbbChannel.SelectedIndex = 0; if (device35.numOfChannel != 8) { cbbUnit.Items.Clear(); cbbUnit.Items.AddRange(new string[] { "Not Use", "Celsius", "Fahrenheit", "CO2", "%RH", "G" }); } cbbChannel_SelectedIndexChanged(sender, e); cbbUnit_SelectedIndexChanged(sender, e); cbbDuration.DropDownStyle = ComboBoxStyle.DropDownList; cbbStartDelay.DropDownStyle = ComboBoxStyle.DropDownList; cbbUnit.DropDownStyle = ComboBoxStyle.DropDownList; chkRecord.Checked = false; chkDes.Checked = false; chkLoc.Checked = false; chkChannel.Checked = false; mGlobal.len = 64; }