Ejemplo n.º 1
0
        private async void BeginGetPlayInfo()
        {
            if (_playInfo != null &&
                _playInfo.ChannelDetailInfo != null &&
                _playInfo.ChannelDetailInfo.ProgramInfos != null)
            {
                var historyWatch = await LocalRecentFactory.Instance.GetRecord(_playInfo.ChannelVID);

                if (historyWatch != null &&
                    ChannelUtils.JudgeProgreamIndex(_playInfo.ProgramIndex, historyWatch.ProgramIndex, _playInfo.ChannelDetailInfo))
                {
                    _playMessage.StartPosition = historyWatch.Pos;
                }

                var vvid = Guid.NewGuid().ToString();
                _dacPlayInfo.vvid  = vvid;
                _playMessage.Title = ChannelUtils.CreateChannelTitle(_playInfo.ProgramIndex, _playInfo.ChannelDetailInfo, false);
                _playInfoFactory.DownLoadDatas(ChannelUtils.CreateChannelId(_playInfo.ProgramIndex, _playInfo.ChannelDetailInfo), vvid);
            }
            else
            {
                if (PlayErrorAction != null)
                {
                    PlayErrorAction("无法获取影片播放地址");
                }
            }
        }
Ejemplo n.º 2
0
        protected override void SavePlayHistory(int duration, int position)
        {
            var parentId   = _playInfo.ChannelDetailInfo.Id;
            var parentName = _playInfo.ChannelDetailInfo.Title;
            var image      = _playInfo.ChannelDetailInfo.ImageUri;
            var subId      = ChannelUtils.CreateChannelId(_playInfo.ProgramIndex, _playInfo.ChannelDetailInfo);
            var subName    = ChannelUtils.CreateChannelTitle(_playInfo.ProgramIndex, _playInfo.ChannelDetailInfo, true);
            var index      = ChannelUtils.CreateComonIndex(_playInfo.ProgramIndex, _playInfo.ChannelDetailInfo);

            if (parentId <= 0)
            {
                return;
            }

            var localInfo = new CloudDataInfo();

            localInfo.ProgramIndex = index;
            localInfo.ImageUri     = image;
            localInfo.Id           = parentId;
            localInfo.Name         = parentName;
            localInfo.SubId        = subId;
            localInfo.SubName      = subName;
            localInfo.VideoType    = 3;
            localInfo.Pos          = position;
            localInfo.Duration     = duration;

            LocalRecentFactory.Instance.InsertLocalRecord(localInfo);
        }
Ejemplo n.º 3
0
 private void downloadBar_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         if (PersonalFactory.Instance.Logined)
         {
             var downinfos = new List <DownloadInfo>(_downloadList.Count);
             foreach (var downInfo in _downloadList)
             {
                 var index = ChannelUtils.CreateProgramIndex(downInfo.Index, _dataSource);
                 downInfo.IsSelected    = false;
                 downInfo.IsDownloading = true;
                 var down = new DownloadInfo()
                 {
                     TypeId        = _dataSource.Type,
                     ParentId      = _dataSource.Id,
                     ParentName    = _dataSource.Title,
                     ProgramIndex  = downInfo.Index,
                     ChannelId     = downInfo.ChannelId,
                     ImageUri      = _dataSource.ImageUri,
                     DownloadState = DownloadState.Await,
                     Title         = ChannelUtils.CreateChannelTitle(index, _dataSource, false)
                 };
                 down.LocalFileName = string.Format("{0}.mp4", down.Title);
                 downinfos.Add(down);
             }
             DownloadViewModel.Instance.AddDownloads(downinfos);
             if (_downloadList.Count > 0)
             {
                 TileUtils.CreateToastNotifications("已加入下载,请到个人中心查看");
             }
             _downloadList.Clear();
             downloadBar.Visibility = Visibility.Collapsed;
         }
         else
         {
             TileUtils.CreateToastNotifications("请先至个人中心登录");
         }
         bottomBar.IsOpen = false;
     }
     catch
     {
         TileUtils.CreateToastNotifications("加入下载失败");
     }
 }