public void Invalidate(int firstIndex, int count) { int lastIndex = Math.Min(firstIndex + count, _lastNumberOfEntries); int invalidateCount = lastIndex - firstIndex; // When the start index of the invalidation is greater than the last reported index // then this means that our listeners haven't even gotten the change yet and thus // they don't need to be notified of the invalidation either. if (invalidateCount > 0) { var section = LogTableModification.Invalidate(firstIndex, invalidateCount); _listener.OnLogTableModified(_logTable, section); _lastNumberOfEntries = firstIndex; } }
private void Report(int numberOfLinesRead, DateTime now) { // We may never report all lines in one go if the listener specified // that he only wants to receive batches of N. // Therefore we invoke the listener multiple times. int count; while ((count = numberOfLinesRead - _lastNumberOfEntries) > 0) { count = Math.Min(count, _maximumCount); var section = new LogTableModification(_lastNumberOfEntries, count); _listener.OnLogTableModified(_logTable, section); _lastNumberOfEntries += count; _lastReportedTime = now; } }
public void EmitChanged(LogTableModification modification) { _listener.OnLogTableModified(_logTable, modification); }