コード例 #1
0
 private void InitializeObservable()
 {
     IsExistsMoreStationsAndBusStops = true;
     IsExistsMoreStations = true;
     IsExistsMoreBusStops = true;
     stationsAndBusStopsScheduler = new Subject<Unit>();
     stationsScheduler = new Subject<Unit>();
     busStopsScheduler = new Subject<Unit>();
     readerSubject = new Subject<StationViewModel>();
     readerSubject
         .BufferWithCount(20)
         .Zip(stationsAndBusStopsScheduler, (l, _) => l)
         .Subscribe(s => s.ForEach(
             i => StationsAndBusStops.Add(i)),
             () => IsExistsMoreStationsAndBusStops = false);
     readerSubject
         .Where(v => !v.IsBusStop)
         .BufferWithCount(20)
         .Zip(stationsScheduler, (l, _) => l)
         .Subscribe(s => s.ForEach(
             i => Stations.Add(i)),
             () => IsExistsMoreStations = false);
     readerSubject
         .Where(v => v.IsBusStop)
         .BufferWithCount(20)
         .Zip(busStopsScheduler, (l, _) => l)
         .Subscribe(s => s.ForEach(
             i => BusStops.Add(i)),
             () => IsExistsMoreBusStops = false);
 }