Esempio n. 1
0
        private void channelList_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            var value = channelList.SelectedItem as ProgramInfo;

            if (value != null)
            {
                int id    = value.ChannelId;
                int index = -1;
                if (!ChannelUtils.JudgeSingle(_dataSource))
                {
                    index = ChannelUtils.CreateProgramIndex(value.Index, _dataSource);
                }
                StartToPlay(id, index);
            }
            channelList.SelectedItem = null;
        }
Esempio n. 2
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("加入下载失败");
     }
 }
Esempio n. 3
0
        private void listView_ItemClick(object sender, ItemClickEventArgs e)
        {
            var value = e.ClickedItem as ProgramInfo;

            if (value != null)
            {
                PlayInfoHelp obj;
                if (ChannelUtils.JudgeSingle(_dataSource))
                {
                    obj = new PlayInfoHelp(_dataSource, -1);
                }
                else
                {
                    var index = ChannelUtils.CreateProgramIndex(value.Index, _dataSource);
                    obj = new PlayInfoHelp(_dataSource, index);
                }
                StartToPlay(obj);
            }
        }