public ProfileCollectionVirtualise1() { profiles = this.WhenAnyValue(a => a.Value).Select(GetProfiles).ToProperty(this, a => a.Profiles); IList <Profile> GetProfiles(int i) { var ProfilePool = ProfileFactory.BuildPool(); return(DataVirtualizingCollectionBuilder .Build <Profile>(i, RxApp.MainThreadScheduler) .NonPreloading() .Hoarding() .NonTaskBasedFetchers( (offset, pageSize) => { Console.WriteLine($"{nameof(Profiles)}: Loading page with offset {offset}"); var range = Enumerable.Range(offset, pageSize).Select(i => ProfilePool[i % ProfilePool.Count]).ToArray(); return range; }, () => { Console.WriteLine($"{nameof(Profiles)}: Loading count"); return 420420; }) .AsyncIndexAccess((_, __) => new Profile())); } }
public ProfileCollectionTimed() { var pool = ProfileFactory.BuildPool(); _ = Observable.Interval(TimeSpan.FromSeconds(_speed)) .ObserveOnDispatcher() .Select(a => pool.Random()) .ToObservableChangeSet() .Sort(new comparer()) .Bind(out profiles).Subscribe(); }