Exemplo n.º 1
0
        public async void ListViewScroll(object sender, EventArgs e)
        {
            Down.IsEnabled            = false;
            ArticleListView.IsEnabled = false;
            NewsGrid.IsEnabled        = false;
            await System.Threading.Tasks.Task.Run(async() =>
            {
                /*
                 * Device.BeginInvokeOnMainThread(async() =>
                 * {
                 *  //IsBusy = true;
                 *  //ArticleListView.IsRefreshing = true;
                 *  App.LS.loadingAnimation.Play();
                 *  await Navigation.PushAsync(App.LS);
                 *  App.LS.LoadingText.Text = "Laddar in mera artiklar.";
                 *
                 * });
                 */
                if (argc == 0)
                {
                    PREV  = 0;
                    CURR  = NEXT;
                    NEXT += DBLN;

                    Console.WriteLine("PREV: " + PREV + " CURR: " + CURR + " NEXT: " + NEXT);
                    double height = NewsSV.ContentSize.Height - 10;
                    LoadLocalDB();
                    AddNews(argc);
                }
                Device.BeginInvokeOnMainThread(() =>
                {
                    ArticleListView.ItemsSource = null;
                    ArticleListView.ItemsSource = ArticleList;
                });

                GC.Collect();

                Device.BeginInvokeOnMainThread(async() =>
                {
                    Console.WriteLine("Initiering Klar");

                    //await Navigation.PopAsync();
                    //App.Mainpage.CurrentPage = App.Mainpage.Children[1];
                    await NewsSV.ScrollToAsync(0, ArticleListView.Height - 10, false);
                    //ArticleListView.IsRefreshing = false;
                    //IsBusy = false;
                });
                await System.Threading.Tasks.Task.Delay(5);
            });

            ArticleListView.IsEnabled = true;
            Down.IsEnabled            = true;
            NewsGrid.IsEnabled        = true;
        }
Exemplo n.º 2
0
        // When the user fetches more articles from the server, to be displayed in the Listview.
        public async void ListViewScroll(object sender, EventArgs e)
        {
            Down.IsEnabled            = false;
            ArticleListView.IsEnabled = false;
            NewsGrid.IsEnabled        = false;
            await System.Threading.Tasks.Task.Run(async() =>
            {
                if (argc == 0)
                {
                    PREV  = 0;
                    CURR  = NEXT;
                    NEXT += DBLN;

                    Console.WriteLine("PREV: " + PREV + " CURR: " + CURR + " NEXT: " + NEXT);
                    double height = NewsSV.ContentSize.Height - 10;
                    LoadLocalDB();
                    AddNews(argc);
                }
                Device.BeginInvokeOnMainThread(() =>
                {
                    ArticleListView.ItemsSource = null;
                    ArticleListView.ItemsSource = ArticleList;
                });

                GC.Collect();

                Device.BeginInvokeOnMainThread(async() =>
                {
                    Console.WriteLine("Initiering Klar");
                    await NewsSV.ScrollToAsync(0, ArticleListView.Height - 10, false);
                });
                await System.Threading.Tasks.Task.Delay(5);
            });

            ArticleListView.IsEnabled = true;
            Down.IsEnabled            = true;
            NewsGrid.IsEnabled        = true;
        }