コード例 #1
0
        public override async Task <IEnumerable <Trip> > GetItemsAsync(int skip          = 0, int take = 100,
                                                                       bool forceRefresh = false)
        {
            await InitializeStoreAsync().ConfigureAwait(false);

            if (forceRefresh)
            {
                await SyncAsync().ConfigureAwait(false);
            }

            var items = await Table.Skip(skip).Take(take).OrderByDescending(s => s.RecordedTimeStamp).ToEnumerableAsync().ConfigureAwait(false);

            foreach (var item in items)
            {
                item.Photos = new List <Photo>();
                var photos = await photoStore.GetTripPhotos(item.Id).ConfigureAwait(false);

                foreach (var photo in photos)
                {
                    item.Photos.Add(photo);
                }
            }

            return(items);
        }
コード例 #2
0
        public override async Task <IEnumerable <Trip> > GetItemsAsync(int skip          = 0, int take = 100,
                                                                       bool forceRefresh = false)
        {
            if (!initialized)
            {
                await InitializeStoreAsync();
            }
            if (photoStore == null)
            {
                photoStore = Utils.ServiceLocator.Instance.Resolve <IPhotoStore>();
            }

            foreach (var trip in Trips)
            {
                if (trip.Photos == null)
                {
                    trip.Photos = new List <Photo>();
                }
                trip.Photos.Clear();
                foreach (var photo in await photoStore.GetTripPhotos(trip.Id))
                {
                    trip.Photos.Add(photo);
                }
            }

            return(Trips.OrderByDescending(s => s.RecordedTimeStamp));
        }