Example #1
0
        async void db()
        {
            ctx = new AutoMgrSvc.AutoMgrDbEntities(new Uri("http://192.168.0.101:23796/Service/AutoMgrDbSvc.svc/"));

            //AutoMgrSvc.inventory inventory = new AutoMgrSvc.inventory();
            //var goods = from g in ctx.goods where g.id < 100 select g;
            //foreach (var gg in goods)
            //{
            //    if (gg.id == 1100)
            //        break;
            //}

            //inventories = new DataServiceCollection<AutoMgrSvc.inventory>();
            //inventories.LoadCompleted += new EventHandler<LoadCompletedEventArgs>(complete);
            //var query = from inv in ctx.inventory select inv;
            //inventories.LoadAsync(query);
            ////inventories.Load(from inv in ctx.inventory select inv);
            ////foreach (var inv in inventories)
            ////{
            ////    int i = inv.id;
            ////}

            goodses = new DataServiceCollection <AutoMgrSvc.goods>();
            //goodses.LoadCompleted += new EventHandler<LoadCompletedEventArgs>(goods_complete);
            var qry = (from goods in ctx.goods.Expand("shelf") select goods).Skip(1).Take(10);
            await goodses.AsyncQuery(qry);

            //goodses.LoadAsync(qry);
            foreach (var goods in goodses)
            {
                int i = goods.id;
            }
        }
Example #2
0
        protected async override Task <IList <object> > LoadMoreItemsOverrideAsync(System.Threading.CancellationToken c, uint count)
        {
            DataServiceCollection <T> results = new DataServiceCollection <T>();
            await results.AsyncQuery(_query.Skip(_skip).Take((int)count));

            System.Diagnostics.Debug.WriteLine("count:{0}, cnt:{1}", count, _cnt);
            //results.LoadCompleted += new EventHandler<LoadCompletedEventArgs>((sender, e) =>
            //{
            //    if (e.Error == null)
            //    {
            //        if (results.Continuation != null)
            //        {
            //            results.LoadNextPartialSetAsync();
            //        }
            //    }
            //});
            //results.LoadAsync(_query);


            //var rtn = from j in results select j;

            _skip        += (int)count;
            _hasMoreItems = results.Count >= count ? true : false;

            _cnt++;

            List <object> aa = new List <object>();

            foreach (var result in results)
            {
                aa.Add(result);
            }

            return(aa);
        }