void _kbListener_KeyUp(object sender, System.Windows.Forms.KeyEventArgs e) { if (e.KeyCode == System.Windows.Forms.Keys.LWin && _magicCombination) { string txt = TxtFetcherFacade.FetchSelectedText(); Txt.AppendText(txt + Environment.NewLine); } }
private void DisplayValue(string sVal) { Chart chart = this.FindName("MyWinformChart") as Chart; try { ushort v = ushort.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.Text = v.ToString(); string item = $"{DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss")}\t{v}"; Txt.AppendText($"{item}\n"); Txt.ScrollToEnd(); chart.Series[0].Points.Add(v); chart.ChartAreas[0].AxisX.Minimum = 0; chart.ChartAreas[0].AxisX.Maximum = (photoDatas.Count >= xCount) ? photoDatas.Count : xCount; if (photoDatas.Count > xCount) { chart.ChartAreas[0].AxisX.ScaleView.Zoom( photoDatas.Count - xCount, photoDatas.Count); } else { chart.ChartAreas[0].AxisX.ScaleView.Zoom(0, xCount); } if (IsSimulation == false) { BtnPortValue.Content = $"{serial.PortName}\n{sVal}"; } else { BtnPortValue.Content = $"{sVal}"; } } catch (Exception ex) { Txt.AppendText($"Error : {ex.Message}\n"); Txt.ScrollToEnd(); } }