public IDisposable Subscribe(IObserver <TableUpdate> observer) { var disposable = _subject.Subscribe(observer); _table.ReplayRows(observer); return(disposable); }
public static IDisposable ReplayAndSubscribe(this IReactiveTable table, Action <TableUpdate> onNext) { var rowObserver = new Subject <TableUpdate>(); var subscription = rowObserver.Subscribe(onNext); table.ReplayRows(rowObserver); table.Subscribe(rowObserver); return(subscription); }
/// <summary> /// Let the filtered table know that the values used in the predicate have changed and /// the filter needs to be re-applied. /// </summary> public void PredicateChanged() { _sourceTable.ReplayRows( new AnonymousObserver <TableUpdate>( update => { var sourceRowIndex = update.RowIndex; int filterRowIndex; var isMapped = _sourceRowToFilterRow.TryGetValue(sourceRowIndex, out filterRowIndex); var isVisible = _predicate.RowIsVisible(_sourceTable, sourceRowIndex); if (isVisible && !isMapped) { AddVisibleRow(sourceRowIndex); } else if (!isVisible && isMapped) { RemoveNotVisibleRow(sourceRowIndex); } })); }
/// <summary> /// Use this when aggregating over tables that have existing data /// </summary> public void FinishInitialisation() { _sourceTable.ReplayRows(Observer.Create <TableUpdate>(OnSourceValue)); }