private void OnRecordsShrunk(TimeRecordCollection <T> serie, int oldItemsCount) { lock (Locker) { int itemsRemoved = oldItemsCount - serie.Count; Cursor = Cursor - itemsRemoved; Debug.Assert(Cursor > -1 || Cursor <= -itemsRemoved, "Cursor is meant to be >= 0 unless it was 0 ( - itemsRemoved now )"); if (Cursor < 0) { Cursor = 0; } } }
public TimeSerieNavigator(IEnumerable <T> items) { Records = new TimeRecordCollection <T>(items); Records.NewRecord += Records_NewRecord; Records.OnShrink += OnRecordsShrunk; }
private void Records_NewRecord(TimeRecordCollection <T> sender, T rec) { OnNewRecord?.Invoke(rec); }
public TimeSerieNavigator() { Records = new TimeRecordCollection <T>(); Records.NewRecord += Records_NewRecord;; Records.OnShrink += OnRecordsShrunk; }