public void DisplayValue(string sVal) { try { ushort v = ushort.Parse(sVal); if (v < 0 || v > maxPhotoVal) { return; } SensorData data = new SensorData(DateTime.Now, v); //InsertDataToDB(data); TxtSensorCount.Text = photoDatas.Count.ToString(); PgbPhotoRegistor.Value = v; LblPhotoRegistor.Content = v.ToString(); string item = $"{DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss")}\t{v}"; LineValues.Add((int)v); RtbLog.AppendText($"{item}\n"); RtbLog.ScrollToEnd(); } catch (Exception ex) { RtbLog.AppendText($"Error : {ex.Message}\n"); RtbLog.ScrollToEnd(); } }
private void DisplayValue(string sVal) { try { ushort v = ushort.Parse(sVal); double cv = double.Parse(sVal); if (v < 0 || v > maxPhotoVal) { return; } SensorData data = new SensorData(DateTime.Now, v); photoDatas.Add(data); InsertDataToDB(data); TxtSensorCount.Text = photoDatas.Count.ToString(); PgbPhotoRegistor.Value = v; LblPhotoRegistor.Content = v.ToString(); string item = $"{DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss")}\t{v}"; if (AxisX.MaxValue < 200) { AxisX.MaxValue++; } RtbLog.AppendText($"{item}\n"); RtbLog.ScrollToEnd(); LineValues.Add(cv); DataContext = this; } catch (Exception ex) { RtbLog.AppendText($"Error : {ex.Message}\n"); RtbLog.ScrollToEnd(); //RtbLog.ScrollToCaret(); } }
private void DisplayValue(string sVal) { try { ushort v = ushort.Parse(sVal); if (v < 0 || v > maxPhotoVal) { return; } SensorData data = new SensorData(DateTime.Now, v); photoDatas.Add(data); TxtSensorCount.Text = photoDatas.Count.ToString(); PgbPhotoRegistor.Value = v; LblPhotoRegistor.Text = v.ToString(); string item = $"{photoDatas.Count} {DateTime.Now.ToString("yy-MM-dd hh:mm:ss")}\t{v}"; RtbLog.AppendText($"{item}\n"); RtbLog.ScrollToEnd(); vs.Add(v); Time.Add(time); linegraph.PlotY(vs); if (IsSimulation == false) { BtnPortValue.Content = $"{serial.PortName}\n{sVal}"; InsertDataToDB(data); } else { BtnPortValue.Content = $"{sVal}"; } } catch (Exception ex) { RtbLog.AppendText($"Error : {ex.Message}\n"); RtbLog.ScrollToEnd(); } }
private void RtbLog_TextChanged(object sender, EventArgs e) { //if (Math.Abs(RtbLog.VerticalOffset + RtbLog.ViewportHeight - RtbLog.ExtentHeight) < 0.05) RtbLog.ScrollToEnd(); }