private void scrollTime_Scroll(object sender, ScrollEventArgs e) { if (scrollTime.Value < 0 || scrollTime.Value >= m_ListLog.Count) { return; } int index = scrollTime.Value; SensorLogItem log_item = m_ListLog[index]; DateTime dateTime = new DateTime(0L); TimeSpan timeSpan = log_item.Time.Subtract(m_dtStartTime); lblTimeElapsed.Text = dateTime.Add(timeSpan).ToString("mm:ss.fff", DateTimeFormatInfo.InvariantInfo); for (int i = 0; i < m_ListSensors.Count && index >= 0; i++, --index) { SensorLogItem sensorLogItem2 = m_ListLog[index]; for (int j = 0; j < panelDisplay.Controls.Count; j++) { SensorDisplayControl sensorDisplayControl = (SensorDisplayControl)panelDisplay.Controls[j]; if (string.Compare(sensorDisplayControl.Title, sensorLogItem2.Name) == 0) { sensorDisplayControl.EnglishDisplay = sensorLogItem2.EnglishDisplay + " " + sensorLogItem2.EnglishUnits; sensorDisplayControl.MetricDisplay = sensorLogItem2.MetricDisplay + " " + sensorLogItem2.MetricUnits; } } } }
private void RebuildSensorGrid() { panelDisplay.Controls.Clear(); Size controlSize = new Size(controlWidth, controlHeight); for (int i = 0; i < m_ListSensors.Count; i++) { if (panelDisplay.Width > controlWidth) { controlSize.Width = (panelDisplay.Width - 3 * controlMargin) / 2; } else { controlSize.Width = panelDisplay.Width - 2 * controlMargin; } SensorDisplayControl control = new SensorDisplayControl { Title = m_ListSensors[i].Name, Size = controlSize, Tag = m_ListSensors[i] }; if (radioDisplayEnglish.Checked) { control.SetDisplayMode(1); } else { control.SetDisplayMode(2); } control.Refresh(); if (panelDisplay.Width > controlWidth) { if (i % 2 == 0) { control.Location = new Point(controlMargin, (control.Height + controlMargin) * (i / 2) + controlMargin); } else { control.Location = new Point(control.Width + controlMargin * 2, (control.Height + controlMargin) * (i / 2) + controlMargin); } } else { control.Location = new Point(controlMargin, (control.Height + controlMargin) * i + controlMargin); } panelDisplay.Controls.Add(control); } }
private void btnReset_Click(object sender, EventArgs e) { btnReset.Enabled = false; btnSave.Enabled = false; btnStart.Enabled = true; btnStart.Text = Properties.Resources.btnStart_Name_Start; listSensors.Enabled = true; groupDisplay.Enabled = true; m_ListLog.Clear(); lblTimeElapsed.Text = "00:00.000"; scrollTime.Enabled = false; for (int i = 0; i < panelDisplay.Controls.Count; i++) { SensorDisplayControl control = (SensorDisplayControl)panelDisplay.Controls[i]; control.EnglishDisplay = ""; control.MetricDisplay = ""; } }