コード例 #1
0
        void listview_ContainerContentChanging(ListViewBase sender, ContainerContentChangingEventArgs args)
        {
            lock (obj)
                if (!IsLoding) //没有在读取中都能进
                {
                    if (args.ItemIndex == listview.Items.Count - 1)
                    {
                        IsLoding = true;
                        Task.Factory.StartNew(async() =>
                        {
                            string json = await HttpRequest.HttpRequst.MainPageRequest(++page, "C402758D1A773C4C70F160A11C1172E1");
                            if (!string.IsNullOrWhiteSpace(json))
                            {
                                await this.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
                                {
                                    getVideoModel = JsonConvert.DeserializeObject <Model.VideoModel>(json);

                                    foreach (Model.VideoModel.Contentlist f in getVideoModel.showapi_res_body.pagebean.contentlist)
                                    {
                                        viewmodel.VideoModel.showapi_res_body.pagebean.contentlist.Add(f);
                                    }
                                    IsLoding = false;
                                });
                            }
                        });
                    }
                }
        }
コード例 #2
0
        private async void DEAm_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                string json = await HttpRequest.HttpRequst.MainPageRequest(1, "C402758D1A773C4C70F160A11C1172E1");

                if (!string.IsNullOrWhiteSpace(json))
                {
                    getVideoModel = JsonConvert.DeserializeObject <Model.VideoModel>(json);
                }
                viewmodel.VideoModel = getVideoModel;
            }
            catch (Exception)
            {
            }
        }
コード例 #3
0
 void WindowVisibilityChangedEventHandler(System.Object sender, Windows.UI.Core.VisibilityChangedEventArgs e)
 {
     Task.Factory.StartNew(async() =>
     {
         try
         {
             string json = await HttpRequest.HttpRequst.MainPageRequest(1, "C402758D1A773C4C70F160A11C1172E1");
             if (!string.IsNullOrWhiteSpace(json))
             {
                 getVideoModel = JsonConvert.DeserializeObject <Model.VideoModel>(json);
             }
             viewmodel.VideoModel = getVideoModel;
         }
         catch (Exception)
         {
         }
     });
     Task.Delay(1000);
 }
コード例 #4
0
 private async Task FirstStep(int page, string sign)
 {
     try
     {
         await Task.Factory.StartNew(async() =>
         {
             string json = await HttpRequest.HttpRequst.MainPageRequest(page, "C402758D1A773C4C70F160A11C1172E1");
             if (!string.IsNullOrWhiteSpace(json))
             {
                 getVideoModel = JsonConvert.DeserializeObject <Model.VideoModel>(json);
             }
             foreach (Model.VideoModel.Contentlist f in getVideoModel.showapi_res_body.pagebean.contentlist)
             {
                 viewmodel.VideoModel.showapi_res_body.pagebean.contentlist.Add(f);
             }
         });
     }
     catch (Exception)
     {
     }
 }
コード例 #5
0
        private async Task Refresh()
        {
            try
            {
                string json = await HttpRequest.HttpRequst.MainPageRequest(1, "C402758D1A773C4C70F160A11C1172E1");

                if (!string.IsNullOrWhiteSpace(json))
                {
                    getVideoModel = JsonConvert.DeserializeObject <Model.VideoModel>(json);
                }
                viewmodel.VideoModel = getVideoModel;
            }
            catch (Exception)
            {
            }
            await Task.Factory.StartNew(async() =>
            {
                progressRing1.Visibility = Visibility.Visible;
                await Task.Delay(100000);
                // progressRing1.Visibility = Visibility.Collapsed;
            });
        }