public IDisposable Subscribe(IObserver <TableUpdate> observer)
        {
            var disposable = _subject.Subscribe(observer);

            _table.ReplayRows(observer);
            return(disposable);
        }
示例#2
0
        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);
        }
示例#3
0
 /// <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);
         }
     }));
 }
示例#4
0
 /// <summary>
 /// Use this when aggregating over tables that have existing data
 /// </summary>
 public void FinishInitialisation()
 {
     _sourceTable.ReplayRows(Observer.Create <TableUpdate>(OnSourceValue));
 }