Esempio n. 1
0
 public void LoadRrelatedVideo()
 {
     System.Diagnostics.Debug.WriteLine("获取剧集花絮 url:" + CommonData.GetVideoRrelated + "&videoId=" + VideoId);
     HttpHelper.httpGet(CommonData.GetVideoRrelated + "&videoId=" + VideoId, (ar) =>
     {
         string result = HttpHelper.SyncResultTostring(ar);
         if (result != null)
         {
             VideoInfoResult videosResult = null;
             try
             {
                 videosResult = JsonConvert.DeserializeObject <VideoInfoResult>(result);
             }
             catch (Exception ex)
             {
                 System.Diagnostics.Debug.WriteLine("LoadChannelCompleted   json 解析错误" + ex.Message);
                 App.JsonError(result);
             }
             if (videosResult == null)
             {
                 JsonError(result);
             }
             else if (videosResult.err_code == HttpHelper.rightCode)
             {
                 if (CallbackManager.currentPage != null)
                 {
                     CallbackManager.currentPage.Dispatcher.BeginInvoke(() =>
                     {
                         AllRelateds = videosResult.data;
                     });
                 }
             }
         }
         else
         {
             //App.ShowToast("获取数据失败,请检查网络或重试");
         }
     });
 }
Esempio n. 2
0
        public void LoadedDramaItem()
        {
            string videoListUrl = CommonData.GetVideoListUrl + "&videoId=" + VideoId + "&pageCount=" + DramaPageCount;

            System.Diagnostics.Debug.WriteLine("获取剧集列表 url:" + videoListUrl);
            HttpHelper.httpGet(videoListUrl, (ar) =>
            {
                string result = HttpHelper.SyncResultTostring(ar);
                if (result != null)
                {
                    VideoInfoResult videosResult = null;
                    try
                    {
                        videosResult = JsonConvert.DeserializeObject <VideoInfoResult>(result);
                    }
                    catch (Exception ex)
                    {
                        System.Diagnostics.Debug.WriteLine("LoadChannelCompleted   json 解析错误" + ex.Message);
                    }

                    if (videosResult == null)
                    {
                        JsonError(result);
                    }
                    else if (videosResult.err_code == HttpHelper.rightCode)
                    {
                        if (CallbackManager.currentPage != null)
                        {
                            CallbackManager.currentPage.Dispatcher.BeginInvoke(() =>
                            {
                                if (DramaPageCount > 1)
                                {
                                    foreach (VideoInfo video in videosResult.data)
                                    {
                                        AllDramas.Add(video);
                                    }
                                    if (VideoStyleType == "1")
                                    {
                                        App.PlayerModel.MoreVideoVisibility = Visibility.Collapsed;
                                    }
                                    else if (VideoStyleType == "2")
                                    {
                                        if (AllDramas.Count == 30 * DramaPageCount)
                                        {
                                            App.PlayerModel.MoreVideoVisibility = Visibility.Visible;
                                        }
                                        else
                                        {
                                            App.PlayerModel.MoreVideoVisibility = Visibility.Collapsed;
                                        }
                                    }
                                    dramaPageCount++;
                                }
                                else
                                {
                                    AllDramas         = videosResult.data;
                                    PlayerInfo player = CallbackManager.currentPage as PlayerInfo;
                                    if (player != null)
                                    {
                                        player.LoadDramaSeletedItem(videoId);
                                    }
                                }
                            });
                        }
                    }
                }
                else
                {
                    if (CommonData.NetworkStatus != "None")
                    {
                        LoadedDramaItem();
                    }
                }
            });
        }