private Task LoadData() { try { // *** // *** Disconnect the collections events // *** if (this.Items != null) { this.Items.LoadingComplete -= Items_LoadingComplete; this.Items.LoadingItems -= Items_LoadingItems; } // *** // *** Load the items // *** this.Items = _table.IncludeTotalCount().OrderByDescending(t => t.TimestampUtc).ToIncrementalLoadingCollection(); // *** // *** Connect up to the collection loading to enable and disable the marquee // *** this.Items.LoadingComplete += Items_LoadingComplete; this.Items.LoadingItems += Items_LoadingItems; } catch (Exception ex) { this.EventAggregator.GetEvent <Events.DebugEvent>().Publish(new DebugEventArgs(ex)); } return(Task.FromResult(0)); }
public async Task CountOfAllItems() { var takeTotal = await GoodsTable.IncludeTotalCount().ToEnumerableAsync(); var totalcount = takeTotal as IQueryResultEnumerable <Goods>; countOfAllItems = (int)totalcount.TotalCount; }
public async Task IncludeTotalGenericList() { TestHttpHandler hijack = new TestHttpHandler(); hijack.SetResponseContent("{\"results\":[{\"id\":12,\"String\":\"Hey\"}], \"count\":1}"); IMobileServiceClient service = new MobileServiceClient("http://www.test.com", "secret...", hijack); IMobileServiceTable <StringType> table = service.GetTable <StringType>(); TotalCountList <StringType> people = (TotalCountList <StringType>) await table.IncludeTotalCount().ToListAsync(); Assert.Contains(hijack.Request.RequestUri.ToString(), "StringType"); Assert.Contains(hijack.Request.RequestUri.ToString(), "$inlinecount=allpages"); Assert.AreEqual((long)1, people.TotalCount); Assert.AreEqual(12, people[0].Id); Assert.AreEqual("Hey", people[0].String); }
public static async void popuniKorisnike() { SarajevoTravel.korisnici = new List <Korisnik>(); IMobileServiceTable <TabelaKorisnik> tabela = App.MobileService.GetTable <TabelaKorisnik>(); IMobileServiceTableQuery <TabelaKorisnik> query = tabela.IncludeTotalCount(); IEnumerable <TabelaKorisnik> korisnici = await query.ToEnumerableAsync(); long c = ((ITotalCountProvider)korisnici).TotalCount; if (c != 0) { foreach (var k in korisnici) { Korisnik kor = new Korisnik(k.id, k.ime, k.prezime, k.username, k.password, k.email, k.tipKorisnika); SarajevoTravel.korisnici.Add(kor); } } }
public async static Task <List <T> > LoadAllAsync <T>(this IMobileServiceTable <T> table, int bufferSize = 1000) { var query = table.IncludeTotalCount(); var results = await query.ToEnumerableAsync(); long count = ((ITotalCountProvider)results).TotalCount; if (results != null && count > 0) { var updates = new List <T>(); while (updates.Count < count) { var next = await query.Skip(updates.Count).Take(bufferSize).ToListAsync(); updates.AddRange(next); } return(updates); } return(null); }
public async Task <List <ActivityData> > GetActivityDataAsync() { try { var items = activityData.IncludeTotalCount().OrderByDescending(data => data.date); var temp = await items.Where(data => data.UserId == App.email).ToListAsync(); var result = new List <ActivityData>(temp); return(result); } catch (MobileServiceInvalidOperationException msioe) { Debug.WriteLine(@"Invalid sync operation: {0}", msioe.Message); } catch (Exception e) { Debug.WriteLine(@"Sync error: {0}", e.Message); } return(null); }
public IMobileServiceTableQuery <T> IncludeTotalCount() { return(_table.IncludeTotalCount()); }