Пример #1
0
        private void RefreshTodoItems()
        {
            if (_isRefreshingItems)
            {
                return;
            }

            this.TaskList.Visibility = ViewStates.Gone;

            _isRefreshingItems = true;
            ((MainActivity)this.Activity).BlockUI();

            _cts0 = new CancellationTokenSource();
            AppController.RefreshTodoItems(_cts0,
                                           _userId,
                                           (items) =>
            {
                items = items
                        .OrderBy(x => (x.CreationDate.GetValueOrDefault().Date.AddDays(x.WillDoIn).Date - DateTime.Now.Date).Days)
                        .ToArray();

                _adapter.Refresh(items);
                this.TaskList.ReloadData();
            },
                                           (error) =>
            {
                Toast.MakeText(this.Activity.ApplicationContext, error, ToastLength.Long).Show();
            },
                                           () =>
            {
                this.TaskList.Visibility = ViewStates.Visible;

                _isRefreshingItems = false;
                ((MainActivity)this.Activity).UnblockUI();
            });
        }
Пример #2
0
        private void RefreshTodoItems()
        {
            if (_isRefreshingItems)
            {
                return;
            }

            this.TaskList.Hidden = true;

            _isRefreshingItems = true;
            ((MainViewController)this.MainViewController).BlockUI();

            _cts0 = new CancellationTokenSource();
            AppController.RefreshTodoItems(_cts0,
                                           _userId,
                                           (items) =>
            {
                items = items
                        .OrderBy(x => (x.CreationDate.GetValueOrDefault().Date.AddDays(x.WillDoIn).Date - DateTime.Now.Date).Days)
                        .ToArray();

                _source.Refresh(items);
                this.TaskList.ReloadData();
            },
                                           (error) =>
            {
                UIToast.MakeText(error, UIToastLength.Long).Show();
            },
                                           () =>
            {
                this.TaskList.Hidden = false;

                _isRefreshingItems = false;
                ((MainViewController)this.MainViewController).UnblockUI();
            });
        }