예제 #1
0
        private void LoadLocalVideoList()
        {
            fullScreen_Click(null, null);
            Binding videos = new Binding();

            videos.Path = new PropertyPath("DownedVideo");
            AllDramas.SetBinding(ListBox.ItemsSourceProperty, videos);
            App.PlayerModel.VideoStyleType        = "2";
            App.PlayerModel.CurrentDefinitionName = "本地";
            int index = -1;

            for (int i = 0; i < AllDramas.Items.Count; i++)
            {
                DownVideoInfoViewMoel info = AllDramas.Items[i] as DownVideoInfoViewMoel;
                if (info != null && info.VideoId == App.PlayerModel.VideoId)
                {
                    index = i;
                    break;
                }
            }
            if (AllDramas.Items.Count > 0)
            {
                AllDramas.SelectedIndex = index;
            }
        }
예제 #2
0
 private void DramaItem_Loaded(object sender, RoutedEventArgs e)
 {
     if (App.PlayerModel.currentType == PlayerViewModel.PlayType.LoaclType)
     {
         LoadLocalVideoList();
     }
     else
     {
         Binding videos = new Binding();
         videos.Path = new PropertyPath("AllDramas");
         AllDramas.SetBinding(ListBox.ItemsSourceProperty, videos);
         App.PlayerModel.LoadedDramaItem();
     }
     //UrlList.
 }
예제 #3
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();
                    }
                }
            });
        }
예제 #4
0
        private void AllDramas_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (AllDramas.SelectedIndex == -1)
            {
                if (IsDownMode)
                {
                    startDownBtn.IsEnabled = false;
                }
                return;
            }
            if (App.PlayerModel.currentType == PlayerViewModel.PlayType.LoaclType)
            {
                DownVideoInfoViewMoel info = AllDramas.SelectedItem as DownVideoInfoViewMoel;
                if (info == null)
                {
                    return;
                }
                App.PlayerModel.VideoId   = info.VideoId;
                App.PlayerModel.VideoName = info.Name;
                SetLocalMedia(info.LocalDownloadUrl);
                currentDramaIndex = AllDramas.SelectedIndex;
                App.PlayerModel.NextVisibility     = (AllDramas.Items.Count > currentDramaIndex + 1) ? System.Windows.Visibility.Visible : System.Windows.Visibility.Collapsed;
                App.PlayerModel.PreviousVisibility = (currentDramaIndex - 1 >= 0) ? System.Windows.Visibility.Visible : System.Windows.Visibility.Collapsed;
                AllVideos.ScrollIntoView(AllVideos.SelectedItem);
            }

            else
            {
                if (IsDownMode)
                {
                    if (AllDramas.SelectedItems.Count == 0)
                    {
                        startDownBtn.IsEnabled = false;
                    }
                    else if (AllDramas.SelectedItems.Count > 0)
                    {
                        startDownBtn.IsEnabled = true;
                    }
                }
                else
                {
                    if (currentDramaIndex != AllDramas.SelectedIndex)
                    {
                        VideoInfo info = AllDramas.SelectedItem as VideoInfo;
                        if (info == null)
                        {
                            return;
                        }
                        App.PlayerModel.VideoId = info.videoId;
                        App.PlayerModel.ReloadNewVideo();
                        App.PlayerModel.PlayerVideo(info);
                        App.PlayerModel.VideoDownloadUrl = info.downloadUrl;
                        CreateDefinitonList(info.downloadUrl);
                        RelatedVideos.SelectedIndex           = -1;
                        currentDramaIndex                     = AllDramas.SelectedIndex;
                        App.PlayerModel.currentType           = MangGuoTv.ViewModels.PlayerViewModel.PlayType.VideoType;
                        App.PlayerModel.NextVisibility        = (AllDramas.Items.Count > currentDramaIndex + 1) ? System.Windows.Visibility.Visible : System.Windows.Visibility.Collapsed;
                        App.PlayerModel.PreviousVisibility    = (currentDramaIndex - 1 >= 0) ? System.Windows.Visibility.Visible : System.Windows.Visibility.Collapsed;
                        App.PlayerModel.MoreCommentVisibility = Visibility.Collapsed;
                        App.PlayerModel.MoreVideoVisibility   = Visibility.Collapsed;
                    }
                    AllDramas.ScrollIntoView(AllDramas.SelectedItem);
                }
            }
        }