private async void channelDetailFactory_Successed(object sender, HttpFactoryArgs <ChannelDetailInfo> e)
        {
            _dataSource = e.Result;

            if (_dataSource.IsNumber)
            {
                channelList.GridCellSize = new Size(154, 147);
            }
            else
            {
                channelList.GridCellSize = new Size(154, 195);
            }

            if (_dataSource.ProgramInfos == null)
            {
                TileUtils.CreateBasicToast("该节目信息不存在!");
                NavigationService.GoBack();
                return;
            }

            if (!_dataSource.IsNumber && _dataSource.ProgramInfos.Count == 1)
            {
                _dataSource.ProgramInfos[0].Title = string.Format("{0} 全一集", _dataSource.ProgramInfos[0].Title);
            }
            DataContext = _dataSource;

            channelList.ItemsSource  = _dataSource.ProgramInfos;
            downloadList.ItemsSource = _dataSource.ProgramInfos;

            await UpdateDownloadState();

            loadingTip.Visibility = Visibility.Collapsed;
            //ShareUtils.ShareInfo = new PlayShareInfo(_dataSource.Id, _dataSource.Title, _dataSource.ImageUri);
        }
        /// <summary>
        /// 更改一条收藏
        /// </summary>
        /// <param name="id"></param>
        /// <param name="channelDetailInfo"></param>
        /// <returns></returns>
        public bool UpdateRecord(int id, ChannelDetailInfo channelDetailInfo)
        {
            var query = from toUpdate in _dataContext.Table_DBFavourInfo
                        where toUpdate.ID == id
                        select toUpdate;
            int i = 0;

            foreach (var u in query)
            {
                u.ActorTag = channelDetailInfo.ActTags;
                u.ImageUrl = channelDetailInfo.ImgUrl;
                u.Mark     = channelDetailInfo.Mark;
                u.Title    = channelDetailInfo.Title;
                u.VID      = channelDetailInfo.VID;
                u.Content  = channelDetailInfo.Content;
                i++;
            }
            _dataContext.SubmitChanges();
            if (i > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #3
0
        public static bool AddTask(ChannelDetailInfo channelDetailInfo, ProgramInfo programInfo)
        {
            MediaFileDownload downloader = new MediaFileDownload();
            string            index      = (programInfo != null) ? programInfo.Index.ToString() : string.Empty;
            string            channelVid = (programInfo != null) ? programInfo.ChannelVID.ToString() : string.Empty;

            downloader.Tag = channelDetailInfo.VID.ToString() + "|" + index + "|" + channelVid;
            if (DownFactory.IsExistVid(downloader.Tag as string))
            {
                return(false);
            }
            Utils.MediaFileDownload.Add(downloader);
            int    rate     = (int)channelDetailInfo.Mark;
            string subTitle = string.Empty;

            if (channelDetailInfo.TypeID != 1 && programInfo != null)
            {
                subTitle = "(第" + (programInfo.Index + 1).ToString() + "集)";
            }
            DownFactory.InsertRecord(downloader.Tag as string, channelDetailInfo.ImgUrl, channelDetailInfo.Title, "", downloader.PathName, 0, 0, (int)DownloadStatus.Downloading, rate);
            DownInfo info = new DownInfo(downloader.Tag as string, channelDetailInfo.ImgUrl, "正在下载:0M", 0, channelDetailInfo.Title, subTitle, "/PPTVForWP7;component/Images/Pause.png", rate, String.Empty);

            MyDownloading.Add(info);

            foreach (MediaFileDownload down in Utils.MediaFileDownload.DownloadQueue)
            {
                down.DownloadStatusChange   += OnDownloadStatusChange;
                down.DownloadProgressChange += OnDownloadProgressChange;
            }

            return(true);
        }
 public SmallProgramListDataSource(ChannelDetailInfo channel_detail_info, bool isReservered = false)
 {
     IdReservered       = isReservered;
     _channelDetailInfo = channel_detail_info;
     Controls.SmallProgramItem._count = _channelDetailInfo.ProgramInfos.Count;
     if (isReservered == false)
     {
         int currentIndex = 0;
         for (int i = 0; i < _channelDetailInfo.ProgramInfos.Count; i++)
         {
             if (currentIndex < i || i == 0)
             {
                 List <ProgramInfo> _programInfoBy5InOne = new List <ProgramInfo>();
                 for (int j = 0; j < 5; j++)
                 {
                     currentIndex = i + j;
                     if (currentIndex < _channelDetailInfo.ProgramInfos.Count)
                     {
                         _programInfoBy5InOne.Add(_channelDetailInfo.ProgramInfos[currentIndex]);
                     }
                 }
                 _programInfos.Add(_programInfoBy5InOne);
             }
         }
     }
     else
     {
         int currentIndex = _channelDetailInfo.ProgramInfos.Count - 1;
         for (int i = _channelDetailInfo.ProgramInfos.Count - 1; i > 0; i--)
         {
             if (currentIndex > i || i == _channelDetailInfo.ProgramInfos.Count - 1)
             {
                 List <ProgramInfo> _programInfoBy5InOne = new List <ProgramInfo>();
                 for (int j = 0; j < 5; j++)
                 {
                     currentIndex = i - j;
                     if (currentIndex >= 0)
                     {
                         _programInfoBy5InOne.Add(_channelDetailInfo.ProgramInfos[currentIndex]);
                     }
                 }
                 _programInfos.Add(_programInfoBy5InOne);
             }
         }
         if (currentIndex != 0)
         {
             for (int i = currentIndex - 1; i >= 0; i--)
             {
                 List <ProgramInfo> _programInfoBy5InOne = new List <ProgramInfo>();
                 if (i >= 0)
                 {
                     _programInfoBy5InOne.Add(_channelDetailInfo.ProgramInfos[i]);
                 }
                 _programInfos.Add(_programInfoBy5InOne);
             }
         }
     }
 }
Beispiel #5
0
 /// <summary>
 /// 生成频道分集索引,不适配倒序情况
 /// </summary>
 /// <param name="programIndex"></param>
 /// <param name="channelInfo"></param>
 /// <returns></returns>
 public static int CreateComonIndex(int programIndex, ChannelDetailInfo channelInfo)
 {
     if (programIndex < 0 ||
         programIndex >= channelInfo.ProgramInfos.Count)
     {
         return(programIndex);
     }
     return(channelInfo.ProgramInfos[programIndex].Index);
 }
Beispiel #6
0
 /// <summary>
 /// 判断是否是单集
 /// </summary>
 /// <param name="channelInfo"></param>
 /// <returns></returns>
 public static bool JudgeSingle(ChannelDetailInfo channelInfo)
 {
     if (channelInfo.ProgramInfos.Count == 1 &&
         channelInfo.ProgramInfos[0].ChannelId == channelInfo.Id)
     {
         return(true);
     }
     return(false);
 }
Beispiel #7
0
        /// <summary>
        /// 生成频道Id
        /// </summary>
        /// <param name="programIndex"></param>
        /// <param name="channelInfo"></param>
        /// <returns></returns>
        public static int CreateChannelId(int programIndex, ChannelDetailInfo channelInfo)
        {
            if (programIndex < 0 ||
                programIndex >= channelInfo.ProgramInfos.Count)
            {
                programIndex = 0;
            }

            return(channelInfo.ProgramInfos[programIndex].ChannelId);
        }
        private void RequestDatas()
        {
            _dataSource = null;
            DataContext = null;

            channelList.ItemsSource  = null;
            downloadList.ItemsSource = null;
            loadingTip.Visibility    = Visibility.Visible;

            _downloadList.Clear();
            _channelDetailFactory.DownLoadDatas(_id);
        }
Beispiel #9
0
 /// <summary>
 /// 判断分集索引是否相等,适配倒序情况
 /// </summary>
 /// <param name="sourceIndex"></param>
 /// <param name="programIndex"></param>
 /// <param name="channelInfo"></param>
 /// <returns></returns>
 public static bool JudgeProgreamIndex(int sourceIndex, int programIndex, ChannelDetailInfo channelInfo)
 {
     if (programIndex < 0 ||
         programIndex >= channelInfo.ProgramInfos.Count)
     {
         programIndex = 0;
     }
     if (programIndex != channelInfo.ProgramInfos[programIndex].Index)
     {
         return(sourceIndex == channelInfo.ProgramInfos[programIndex].Index);
     }
     return(sourceIndex == -1 ? true : sourceIndex == programIndex);
 }
Beispiel #10
0
        /// <summary>
        /// 生成频道分集索引,适配倒序情况
        /// </summary>
        /// <param name="sourceIndex"></param>
        /// <param name="channelInfo"></param>
        /// <returns></returns>
        public static int CreateProgramIndex(int programIndex, ChannelDetailInfo channelInfo)
        {
            if (programIndex < 0 ||
                programIndex >= channelInfo.ProgramInfos.Count)
            {
                programIndex = 0;
            }

            if (programIndex != channelInfo.ProgramInfos[programIndex].Index)
            {
                return(channelInfo.ProgramInfos.Count - programIndex - 1);
            }
            return(programIndex);
        }
Beispiel #11
0
 private void BeginSetChannelToVideoHub(ChannelDetailInfo channelDetailInfo)
 {
     if (channelDetailInfo != null)
     {
         if (!string.IsNullOrEmpty(channelDetailInfo.ImgUrl))
         {
             //WebClient clientByImage = new WebClient();
             //clientByImage.OpenReadCompleted += new OpenReadCompletedEventHandler(clientByImage_OpenReadCompleted);
             //clientByImage.OpenReadAsync(new Uri(channelDetailInfo.ImgUrl, UriKind.RelativeOrAbsolute));
             PPTVData.HttpWebClient webClient = new PPTVData.HttpWebClient();
             webClient.OpenReadCompleted += new PPTVData.OpenReadCompletedEventHandler(webClient_OpenReadCompleted);
             webClient.OpenReadAsync(channelDetailInfo.ImgUrl);
         }
     }
 }
Beispiel #12
0
        void _channelDetailFactory_GetChannelDetailByVIDSucceed(object sender, HttpFactoryArgs <ChannelDetailInfo> args)
        {
            detailDownloaded = true;
            _getDataStatusHelp.Clear();
            var channelDetailInfo = args.Result;

            xLoadGrid.Visibility = Visibility.Collapsed;

            if (DetailPageHelp.ChannelDetailInfoForPrograms.VID == -1)
            {
                ApplicationBar.Buttons.Add(Utils.CommonUtils.CreateFavAppBar(VID, _dbFavourFactory, OnAddToFavClick));
                if (channelDetailInfo.TypeID == (int)PPTVForWP7.Utils.ChannelTypes.电视剧 ||
                    channelDetailInfo.TypeID == (int)PPTVForWP7.Utils.ChannelTypes.动漫 ||
                    channelDetailInfo.TypeID == (int)PPTVForWP7.Utils.ChannelTypes.综艺)
                {
                    ApplicationBar.Buttons.Add(Utils.PursuitUtils.CreatePursuitAppBar(VID, OnPursuit_Click));
                }
            }

            DetailPageHelp.ChannelDetailInfoForPrograms = channelDetailInfo;
            foreach (ProgramInfo info in DetailPageHelp.ChannelDetailInfoForPrograms.ProgramInfos)
            {
                info.IsDown = DownPage.DownFactory.IsExistVid(DetailPageHelp.ChannelDetailInfoForPrograms.VID.ToString() + "|" + info.Index.ToString() + "|" + info.ChannelVID.ToString()) ? Visibility.Visible : Visibility.Collapsed;
            }
            channelDetailInfo.IsDown = DownPage.DownFactory.IsExistVid(DetailPageHelp.ChannelDetailInfoForPrograms.VID.ToString() + "||") ? Visibility.Visible : Visibility.Collapsed;

            _channelDetailInfoOfOriginal = DetailPageHelp.ChannelDetailInfoForPrograms.Clone();
            DetailPageHelp.ChannelDetailInfoForDownload = DetailPageHelp.ChannelDetailInfoForPrograms.Clone();

            xChannelTitleTextBlock.Text = channelDetailInfo.Title;
            TitleTicker();
            xActTextBlock.Text     = channelDetailInfo.ActTags;
            xCatalogTextBlock.Text = channelDetailInfo.CatalogTags;
            xYearTextBlock.Text    = channelDetailInfo.YearTags;
            xChannelImage.Source   = Utils.Utils.GetImage(channelDetailInfo.ImgUrl);
            xMarkTextBlock.Text    = channelDetailInfo.Mark.ToString("0.0");
            var duration = TimeSpan.FromMinutes(channelDetailInfo.Duration);

            xDurationTextBlock.Text = duration.Hours == 0 ?
                                      string.Format("{0}分钟", duration.Minutes) :
                                      string.Format("{0}小时{1}分钟", duration.Hours, duration.Minutes);

            InitChannelProgramItem();
            InitDownloadProgramItem();
        }
Beispiel #13
0
 /// <summary>
 /// 新增一条收藏
 /// </summary>
 /// <param name="channelDetailInfo"></param>
 /// <returns></returns>
 public bool InsertRecord(ChannelDetailInfo channelDetailInfo)
 {
     try
     {
         DBFavourInfo dbFavourInfo = GetRowByVID(channelDetailInfo.VID);
         if (dbFavourInfo != null)
         {
             return(false);
         }
         dbFavourInfo = new DBFavourInfo(channelDetailInfo);
         _dataContext.Table_DBFavourInfo.InsertOnSubmit(dbFavourInfo);
         _dataContext.SubmitChanges();
         return(true);
     }
     catch (Exception exception)
     {
         string message = exception.Message;
         return(false);
     }
 }
Beispiel #14
0
        private void channelDetailFactory_Successed(object sender, HttpFactoryArgs <ChannelDetailInfo> e)
        {
            _dataSource = e.Result;

            if (_dataSource.ProgramInfos == null)
            {
                TileUtils.CreateToastNotifications("该节目信息不存在!");
                GoBack(this, new RoutedEventArgs());
                return;
            }
            if (!_dataSource.IsNumber && _dataSource.ProgramInfos.Count == 1)
            {
                _dataSource.ProgramInfos[0].Title = string.Format("{0} 全一集", _dataSource.ProgramInfos[0].Title);
            }
            imgOrder.Visibility         = e.Result.ProgramInfos.Count == 1 ? Visibility.Collapsed : Visibility.Visible;
            DataContext                 = _dataSource;
            channelListView.ItemsSource = _dataSource.ProgramInfos;
            ShareUtils.ShareInfo        = new PlayShareInfo(_dataSource.Id, _dataSource.Title, _dataSource.ImageUri);
            CloseWaitToolTips();
        }
Beispiel #15
0
 /// <summary>
 /// 生成下一集的索引,匹配倒序情况
 /// </summary>
 /// <param name="programIndex"></param>
 /// <param name="channelInfo"></param>
 /// <returns></returns>
 public static int CreateNextIndex(int programIndex, ChannelDetailInfo channelInfo)
 {
     if (programIndex < 0 ||
         programIndex >= channelInfo.ProgramInfos.Count)
     {
         return(-1);
     }
     if (programIndex != channelInfo.ProgramInfos[programIndex].Index)
     {
         return(--programIndex);
     }
     else
     {
         ++programIndex;
     }
     if (programIndex >= channelInfo.ProgramInfos.Count)
     {
         return(-1);
     }
     return(programIndex);
 }
Beispiel #16
0
        private void LoadDatas(int vid)
        {
            CloseWaitToolTips();
            _downloadList.Clear();

            BottomAppBar.IsOpen    = false;
            downloadBar.Visibility = Visibility.Collapsed;

            btnPlayList.IsChecked       = true;
            btnDownload.IsChecked       = false;
            channelListView.Visibility  = Visibility.Visible;
            downloadListView.Visibility = Visibility.Collapsed;

            _dataSource = null;
            DataContext = null;
            channelListView.ItemsSource  = null;
            downloadListView.ItemsSource = null;

            if (loadingTip.Visibility == Visibility.Collapsed)
            {
                OpenWaitToolTips();
                _channelDetailFactory.DownLoadDatas(vid);
            }
        }
Beispiel #17
0
        /// <summary>
        /// 生成频道名称:主集名称 第几集
        /// </summary>
        /// <param name="programIndex"></param>
        /// <param name="channelInfo"></param>
        /// <returns></returns>
        public static string CreateChannelTitle(int programIndex, ChannelDetailInfo channelInfo, bool noNumberShow)
        {
            if (JudgeSingle(channelInfo))
            {
                return(channelInfo.Title);
            }

            if (programIndex < 0 ||
                programIndex >= channelInfo.ProgramInfos.Count)
            {
                programIndex = 0;
            }

            if (!noNumberShow)
            {
                return(channelInfo.IsNumber ? string.Format("{0} 第{1}集", channelInfo.Title, channelInfo.ProgramInfos[programIndex].Title) :
                       string.Format("{0} {1}", channelInfo.Title, channelInfo.ProgramInfos[programIndex].Title));
            }
            else
            {
                return(channelInfo.IsNumber ? string.Format("{0} 第{1}集", channelInfo.Title, channelInfo.ProgramInfos[programIndex].Title) :
                       string.Format("{0} {1} 第{2}集", channelInfo.Title, channelInfo.ProgramInfos[programIndex].Title, programIndex + 1));
            }
        }
Beispiel #18
0
 public SingleProgram(ChannelDetailInfo info)
 {
     ChannelDetailInfo = info;
     Title             = info.Title;
     IsDown            = info.IsDown;
 }
Beispiel #19
0
 public LongProgramListDataSource(ChannelDetailInfo channel_detail_info, bool isReservered = false)
 {
     IdReservered       = isReservered;
     _channelDetailInfo = channel_detail_info;
     _channelDetailInfo.ProgramInfos.Reverse();
 }
Beispiel #20
0
 private void OnGetChannelDetailSucceeded(object sender, ChannelDetailInfo channelDetailInfo)
 {
     _channelDetailInfo = channelDetailInfo;
 }