Пример #1
0
        void LoadMoreItems(uint count, int baseIndex)
        {
            BackgroundWorker worker = new BackgroundWorker();

            //worker.RunWorkerAsync ();
            worker.DoWork += (o, ae) =>
            {
                DataServiceQuery <Order> query = northwindEntity.Orders.Expand("Customer");
                query = query.Skip <Order>(baseIndex).Take <Order>(50) as DataServiceQuery <Order>;
                IAsyncResult ar    = query.BeginExecute(null, null);
                var          items = query.EndExecute(ar);
                var          list  = items.ToList();

                Android.OS.Handler mainHandler = new Android.OS.Handler(Android.OS.Looper.MainLooper);
                Java.Lang.Runnable myRunnable  = new Java.Lang.Runnable(() =>
                {
                    GridSource.LoadItems(list);
                });
                mainHandler.Post(myRunnable);
            };

            worker.RunWorkerCompleted += (o, ae) =>
            {
                IsBusy = false;
            };

            IsBusy = true;
            worker.RunWorkerAsync();
        }
Пример #2
0
        void LoadMoreItems(uint count, int baseIndex)
        {
            BackgroundWorker worker = new BackgroundWorker();

            worker.DoWork += (o, ae) => {
                DataServiceQuery <Order> query = northwindEntity.Orders.Expand("Customer");
                query = query.Skip <Order> (baseIndex).Take <Order> (15) as DataServiceQuery <Order>;
                IAsyncResult ar    = query.BeginExecute(null, null);
                var          items = query.EndExecute(ar);
                var          list  = items.ToList();

                DispatchQueue.MainQueue.DispatchAsync(new Action(() => {
                    GridSource.LoadItems(list);
                }));
            };

            worker.RunWorkerCompleted += (o, ae) => {
                IsBusy = false;
                UIView.Animate(2, () => {
                    for (int i = 5; i < 0; i--)
                    {
                        LoaderBorder.Alpha = i - 0.1f;
                    }

                    LoaderBorder.Hidden = true;
                });
                this.LoaderIndicator.StopAnimating();
                this.LoaderIndicator.HidesWhenStopped = true;
                this.LoaderLable.Hidden = true;
            };

            IsBusy = true;
            {
                this.LoaderLable.Hidden = false;
                LoaderBorder.Hidden     = false;
                UIView.Animate(2, () => {
                    this.LoaderIndicator.StartAnimating();
                });
            }
            worker.RunWorkerAsync();
        }
Пример #3
0
        void LoadMoreItems(uint count, int baseIndex)
        {
            BackgroundWorker worker = new BackgroundWorker();

            worker.DoWork += (o, ae) =>
            {
                DataServiceQuery <Order> query = northwindEntity.Orders.Expand("Customer");
                query = query.Skip <Order>(baseIndex).Take <Order>(50) as DataServiceQuery <Order>;
                IAsyncResult ar    = query.BeginExecute(null, null);
                var          items = query.EndExecute(ar);
                var          list  = items.ToList();
                Application.Current.Dispatcher.Invoke(new Action(() => { GridSource.LoadItems(list); }));
            };

            worker.RunWorkerCompleted += (o, ae) =>
            {
                IsBusy = false;
            };

            IsBusy = true;
            worker.RunWorkerAsync();
        }