示例#1
0
 /// <summary>
 /// Method for Pull to refresh
 /// </summary>
 void RefreshTable(object sender, EventArgs e)
 {
     RefreshControl.BeginRefreshing();
     RefreshDeviceList();
     TableView.ReloadData();
     RefreshControl.EndRefreshing();
 }
示例#2
0
        void updateMusicAssets()
        {
            Log.Debug("Load Content");

            if (allAssets?.Count == 0 && ContentClient.Shared.AvContent.Count > 0)
            {
                allAssets = ContentClient.Shared.AvContent [UserRoles.General].Where(m => m.HasId && m.HasRemoteAssetUri)
                            .Select(s => AssetPersistenceManager.Shared.GetMusicAsset(s))
                            .ToList();
            }
            else
            {
                var newAssets = ContentClient.Shared.AvContent [UserRoles.General].Where(m => m.HasId && m.HasRemoteAssetUri && !allAssets.Any(ma => ma.Id == m.Id))
                                .Select(s => AssetPersistenceManager.Shared.GetMusicAsset(s));

                allAssets.AddRange(newAssets);

                allAssets.RemoveAll(ma => !ContentClient.Shared.AvContent [UserRoles.General].Any(a => a.Id == ma.Id));
            }

            allAssets?.Sort((x, y) => y.Music.Timestamp.CompareTo(x.Music.Timestamp));

            BeginInvokeOnMainThread(() =>
            {
                TableView.ReloadData();

                if (RefreshControl?.Refreshing ?? false)
                {
                    RefreshControl.EndRefreshing();
                }
            });
        }
        private async Task RefreshAsync()
        {
            if (_isLoading)
            {
                return;
            }
            _isLoading = true;
            if (RefreshControl != null)
            {
                RefreshControl.BeginRefreshing();
            }
            try
            {
                await EventService.GetInstance().SyncAsync();

                EventItems.Clear();
                EventItems.AddRange(await EventService.GetInstance().GetItems());
                TableView.ReloadData();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            finally
            {
                _isLoading = false;
                if (RefreshControl != null)
                {
                    RefreshControl.EndRefreshing();
                }
            }
        }
 public void RefreshTable(UIAlertView loading = null)
 {
     if (NetworkAvailable())
     {
         _parser.UpdatePublications(publications => InvokeOnMainThread(() => {
             TableView.Source = new PublicationsViewSource(publications, NavigationController);
             TableView.ReloadData();
             if (loading != null)
             {
                 loading.DismissWithClickedButtonIndex(0, true);
             }
         }), state => InvokeOnMainThread(() => {
             var alert = new UIAlertView("Error".t(), "ErrorMessage".t(), null, "Ok", null);
             //alert.Clicked += (sender, e) => UIApplication.SharedApplication.PerformSelector(new Selector("terminateWithSuccess"), null, 0f);
             alert.Show();
         }));
     }
     else
     {
         var publications = _parser.Publications;
         TableView.Source = new PublicationsViewSource(publications, NavigationController);
         TableView.ReloadData();
         if (loading != null)
         {
             loading.DismissWithClickedButtonIndex(0, true);
         }
     }
     RefreshControl.EndRefreshing();
 }
        private async Task RefreshAsync()
        {
            RefreshControl.BeginRefreshing();
            await _service.RefreshDataAsync();

            RefreshControl.EndRefreshing();
            TableView.ReloadData();
        }
示例#6
0
        public async void UpdateTable()
        {
            RefreshControl.BeginRefreshing();
            feed = await FeedManager.Get();

            feed.Sort((p1, p2) => p2.Created.CompareTo(p1.Created));
            TableView.ReloadData();
            RefreshControl.EndRefreshing();
        }
        private async Task Refresh()
        {
            RefreshControl.BeginRefreshing();
            await Task.Delay(200);

            RefreshControl.EndRefreshing();
            TableView.Source = new ToDoDataSource(this);
            TableView.ReloadData();
        }
示例#8
0
 async void RefreshControl_ValueChanged(object sender, EventArgs e)
 {
     if (await Refresh())
     {
         RefreshControl.AttributedTitle = new NSAttributedString(String.Format("Last Updated" + ":{0:g}", DateTime.Now));
     }
     RefreshControl.EndRefreshing();
     TableView.ReloadData();
 }
        async void RefreshControl_ValueChanged()
        {
            await ViewModel.ExecuteLoadPastTripsCommandAsync();

            InvokeOnMainThread(delegate
            {
                TableView.ReloadData();
                RefreshControl.EndRefreshing();
            });
        }
示例#10
0
        /// <summary>
        /// Invoke this method to signal that a reload has completed, this will update the UI accordingly.
        /// </summary>
        public void ReloadComplete()
        {
            if (!reloading)
            {
                return;
            }

            reloading = false;

            RefreshControl.EndRefreshing();
        }
示例#11
0
        void FetchPosts()
        {
            new FeedManager().loadFeeds((_, posts) => {
                this.posts = posts as Post[];

                TableView.ReloadData();
                RefreshControl.EndRefreshing();
            }, (response, data) => {
                RefreshControl.EndRefreshing();
                System.Console.WriteLine("failed to load posts, show some error message");
            });
        }
示例#12
0
        async Task RefreshAcquaintances()
        {
            // ! flag to indicate how this refresh command was instantiated.
            bool triggeredByPullToRefresh = false;

            // Store the original offset of the TableView.
            var originalOffset = new CGPoint(TableView.ContentOffset.X, TableView.ContentOffset.Y);

            // If
            if (RefreshControl.Refreshing)
            {
                triggeredByPullToRefresh = true;
            }

            try
            {
                // If this refresh has not been started by a pull-to-refresh UI action, then we need to manually set the tableview offset to SHOW the refresh indicator.
                if (!triggeredByPullToRefresh)
                {
                    TableView.SetContentOffset(new CGPoint(originalOffset.X, originalOffset.Y - RefreshControl.Frame.Size.Height), true);
                }

                // Starts animating the refreshing indicator, and sets its Refreshing property to true.
                RefreshControl.BeginRefreshing();

                // request the TableViewSource to load acquaintances
                await _AcquaintanceTableViewSource.LoadAcquaintances();

                // Tell the TableView to update its UI (reload the cells) because the TableViewSource has updated.
                TableView.ReloadData();
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine($"Error getting acquaintances: {ex.Message}");

                // present an alert about the failure
                using (var alert = new UIAlertView("Error getting acquaintances", "Ensure you have a network connection, and that a valid backend service URL is present in the app settings.", null, "OK"))
                {
                    alert.Show();
                }
            }
            finally
            {
                // Starts animating the refreshing indicator, and sets its Refreshing property to false.
                RefreshControl.EndRefreshing();

                // If this refresh has not been started by a pull-to-refresh UI action, then we need to manually set the tableview offset to HIDE the refresh indicator.
                if (!triggeredByPullToRefresh)
                {
                    TableView.SetContentOffset(originalOffset, true);
                }
            }
        }
 void RefreshStatistics(object sender, EventArgs args)
 {
     RefreshControl.BeginRefreshing();
     FetchMostRecentData((totalJoulesConsumed, error) => {
         InvokeOnMainThread(delegate {
             SimulatedBurntEnergy = new Random().Next(0, 300000);
             ConsumedEnergy       = totalJoulesConsumed;
             NetEnergy            = consumedEnergy - simulatedBurntEnergy;
             RefreshControl.EndRefreshing();
         });
     });
 }
示例#14
0
        void handleAvContentChanged(object sender, UserRoles e)
        {
            BeginInvokeOnMainThread(() =>
            {
                TableView.ReloadData();

                if (RefreshControl?.Refreshing ?? false)
                {
                    RefreshControl.EndRefreshing();
                }
            });
        }
示例#15
0
        async void HandleValueChanged(object sender, EventArgs e)
        {
            var handle = Insights.TrackTime("TimeLoadMovieList");

            handle.Start();
            dataSource.movies.Add(await PotatoesManager.Instance.GetMoviesOpening());
            dataSource.movies.Add(await PotatoesManager.Instance.GetMoviesBoxOffice());
            dataSource.movies.Add(await PotatoesManager.Instance.GetMoviesTheater());
            handle.Stop();

            TableView.ReloadData();
            RefreshControl.EndRefreshing();
        }
示例#16
0
        /// <summary>
        /// Invoke this method to signal that a reload has completed, this will update the UI accordingly.
        /// </summary>
        public void ReloadComplete()
        {
            if (!reloading)
            {
                return;
            }

            reloading = false;

#if !__TVOS__
            RefreshControl.EndRefreshing();
#endif
        }
        public override void ViewDidLoad( )
        {
            base.ViewDidLoad( );

            TableView.Source = new DynamicSource( );

            RefreshControl.ValueChanged += async(sender, e) =>
            {
                await Task.Delay(1000);

                RefreshControl.EndRefreshing( );
            };
        }
示例#18
0
        async void GetData()
        {
            RefreshControl.BeginRefreshing();
            await FillData();

            TableView.ReloadData();
            TableView.BeginUpdates();
            TableView.EndUpdates();
            if (RefreshControl != null && RefreshControl.Refreshing)
            {
                RefreshControl.EndRefreshing();
            }
        }
        private async Task Refresh()
        {
            if (!RefreshControl.Refreshing)
            {
                RefreshControl.BeginRefreshing();
                TableView.SetContentOffset(new CGPoint(0, TableView.ContentOffset.Y - RefreshControl.Frame.Size.Height), true);
            }

            await MatchesPresenter.InitAsync();

            TableView.ReloadData();

            RefreshControl.EndRefreshing();
        }
示例#20
0
        async void GetData()
        {
            RefreshControl.BeginRefreshing();
            await MenuHelper.FillData();

            Usuarios = MenuHelper.Comunidad;
            TableView.ReloadData();
            TableView.BeginUpdates();
            TableView.EndUpdates();
            if (RefreshControl != null && RefreshControl.Refreshing)
            {
                RefreshControl.EndRefreshing();
            }
        }
        private async Task Refresh()
        {
            if (_isLoading)
            {
                return;
            }
            _isLoading = true;
            InvokeOnMainThread(() => RefreshControl.BeginRefreshing());
            var item = await Detail.GetDetail(ID, LanguageHelper.PrefLang);

            List = item.List;
            InvokeOnMainThread(() => { CollectionView.ReloadData(); RefreshControl.EndRefreshing(); });
            _isLoading = false;
        }
示例#22
0
        private async Task Refresh()
        {
            if (_isLoading)
            {
                return;
            }
            _isLoading = true;
            InvokeOnMainThread(() => RefreshControl.BeginRefreshing());
            _page = 0;
            var item = await Home.GetList(_page ++, LanguageHelper.PrefLang);

            List     = item.List.ToList();
            _hasMore = _page < item.MaxPage;
            InvokeOnMainThread(() => { TableView.ReloadData(); RefreshControl.EndRefreshing(); });
            _isLoading = false;
        }
示例#23
0
 public override void ViewDidLoad()
 {
     base.ViewDidLoad();
     this.TableView.Source = new MyDataSource(this);
     if (!isIos6)
     {
         return;
     }
     this.RefreshControl            = new UIRefreshControl();
     RefreshControl.AttributedTitle = new NSAttributedString("Pull down to refresh...");
     RefreshControl.ValueChanged   += delegate {
         reloadData();
         RefreshControl.AttributedTitle = new NSAttributedString(String.Format("Last Updated: {0:g}", DateTime.Now));
         RefreshControl.EndRefreshing();
     };
 }
        public async override void ViewDidLoad()
        {
            base.ViewDidLoad();


            viewModel = ServiceContainer.Resolve <ExpensesViewModel>();

            viewModel.IsBusyChanged = (busy) =>
            {
                if (busy)
                {
                    RefreshControl.BeginRefreshing();
                }
                else
                {
                    RefreshControl.EndRefreshing();
                }
            };


            this.RefreshControl = new UIRefreshControl();

            RefreshControl.ValueChanged += async(sender, args) =>
            {
                if (viewModel.IsBusy)
                {
                    return;
                }

                await viewModel.ExecuteSyncExpensesCommand();

                TableView.ReloadData();
            };

            TableView.Source = new ExpensesSource(viewModel, this);
            NavigationItem.RightBarButtonItem = new UIBarButtonItem(UIBarButtonSystemItem.Add, delegate
            {
                NavigationController.PushViewController(new ExpenseViewController(null), true);
            });

            await Authenticate();

            await viewModel.ExecuteSyncExpensesCommand();

            TableView.ReloadData();
        }
示例#25
0
        async void GetData()
        {
            RefreshControl.BeginRefreshing();
            ContPag = 0;
            await MenuHelper.GetMuroPosts(ContPag, 5);

            allPosts = MenuHelper.AllPost;
            TableView.ReloadData();
            this.TableView.BeginUpdates();
            this.TableView.EndUpdates();
            await MenuHelper.FillTable();

            if (RefreshControl != null && RefreshControl.Refreshing)
            {
                RefreshControl.EndRefreshing();
            }
        }
        async Task RefreshAsync()
        {
            // only activate the refresh control if the feature is available
            if (useRefreshControl)
            {
                RefreshControl.BeginRefreshing();
            }

            await todoService.RefreshDataAsync();

            if (useRefreshControl)
            {
                RefreshControl.EndRefreshing();
            }

            TableView.ReloadData();
        }
示例#27
0
 void ShowLoading(bool ShowLoader)
 {
     if (ShowLoader)
     {
         UIView.Animate(0.4, 0, UIViewAnimationOptions.CurveEaseIn, delegate {
             LoadingText.Alpha     = 0;
             LoadingErrorImg.Alpha = 0;
         }, delegate { LoadingSpinner.StartAnimating(); });
     }
     else
     {
         UIView.Animate(0.4, 0, UIViewAnimationOptions.CurveEaseOut, delegate {
             LoadingText.Alpha     = 0;
             LoadingErrorImg.Alpha = 0;
         }, delegate { LoadingSpinner.StopAnimating(); RefreshControl.EndRefreshing(); });
     }
 }
示例#28
0
        public void IfEmpty(bool endOfSequence)
        {
            RefreshControl?.EndRefreshing();

            if (endOfSequence || !TableSource.IsEmpty())
            {
                RemoveAnyExistingTableViewBackground();

                if (TableSource.IsEmpty())
                {
                    if (TableViewEmptyBackground != null)
                    {
                        PlaceBackgroundView(TableViewEmptyBackground);
                    }
                }
            }
        }
示例#29
0
        private async Task RefreshAsync()
        {
            RefreshControl.BeginRefreshing();
            SavedLocations = new List <SavedLocation>();

            using (var connection = new SQLite.SQLiteConnection(pathToDatabase))
            {
                var query = connection.Table <SavedLocation>();

                foreach (SavedLocation mapItem in query)
                {
                    SavedLocations.Add(mapItem);
                    TableView.ReloadData();
                }
            }
            RefreshControl.EndRefreshing();
            TableView.ReloadData();
        }
        private async Task RefreshAsync()
        {
            // start of RefreshAsync method
            if (todoService.User == null)
            {
                await QSTodoService.DefaultService.Authenticate(this);

                if (todoService.User == null)
                {
                    Console.WriteLine("couldn't login!!");
                    return;
                }
            }
            // rest of RefreshAsync method
            RefreshControl.BeginRefreshing();
            await todoService.RefreshDataAsync();

            RefreshControl.EndRefreshing();

            TableView.ReloadData();
        }