public IDisposable Bind( ExplorerModel model, Chat chat) { return(model.WhenAnyValue(m => m.VisibleRange) .Where(r => model.SourceItems.Count == 0) // only initial .Where(r => !_conductor.IsBusy) // ignore if other load are already in progress .Synchronize(_conductor.Locker) .SelectSeq(r => StartLoading(chat)) .ObserveOn(RxApp.MainThreadScheduler) .Accept(list => HandleLoading(model, chat, list))); }
public IDisposable Bind( ExplorerModel model, Chat chat) { return(model.WhenAnyValue(m => m.VisibleRange) .Throttle(TimeSpan.FromSeconds(1)) .Select(r => r.LastIndex) .DistinctUntilChanged() .Where(index => model.SourceItems.Count != 0) // skip initial .Where(index => index + 4 > model.SourceItems.Count) // bottom is within 4 items .Where(index => !_conductor.IsBusy) // ignore if other load are already in progress .Synchronize(_conductor.Locker) .SelectSeq(r => StartLoading(model, chat)) .ObserveOn(RxApp.MainThreadScheduler) .Accept(list => HandleLoading(model, list))); }