private void Read() { _isReading = !_isReading; Task.Factory.StartNew(() => { _timeStamp = DateTime.Now; Values1.Clear(); Values2.Clear(); Values3.Clear(); while (_isReading) { Thread.Sleep(100); var newItems = GetNext(1); Values1.AddRange(newItems.Select(x => x.Series1Lecture)); Values2.AddRange(newItems.Select(x => x.Series2Lecture)); Values3.AddRange(newItems.Select(x => x.Series3Lecture)); if (_refreshAxis) { var lastPoint = Values3.DefaultIfEmpty(new LecturePoint()).Last().TimeSpan; To = lastPoint.Ticks; From = lastPoint.Ticks - TimeSpan.FromSeconds(10).Ticks; } } }); }
private void PictureLast10() { var lastPoint = Values3.DefaultIfEmpty(new LecturePoint()).Last().TimeSpan; To = lastPoint.Ticks; From = lastPoint.Ticks - TimeSpan.FromSeconds(10).Ticks; _isReading = false; }
public void PictureLast10(BindingAssistant assistant) { var lastPoint = Values3.DefaultIfEmpty(new LecturePoint()).Last().TimeSpan; assistant.To = lastPoint.Ticks; assistant.From = lastPoint.Ticks - TimeSpan.FromSeconds(10).Ticks; _isReading = false; }