void _channelFactory_GetChannelsByListSucceed(object sender, HttpFactoryArgs <VodChannelListInfo> args) { _getDataStatusHelp.Clear(); var channelInfos = args.Result.Channels; var channel_count = args.Result.ChannelCount; var page_count = args.Result.PageCount; _isLoadingData = false; _channel_count = channel_count; _page_count = page_count; if (_isLongItem) { foreach (ChannelInfo item in channelInfos) { item.SlotUrl = item.SlotUrl.Substring(0, item.SlotUrl.IndexOf(".jpg")) + "_165.jpg"; ChannelInfos.Add(item); } } else//small { foreach (ChannelInfo item in channelInfos) { ChannelInfos.Add(item); } int currentIndex = 0; for (int i = 0; i < ChannelInfos.Count; i++) { if (currentIndex < i || i == 0) { ObservableCollection <ChannelInfo> tempChannelInfos = new ObservableCollection <ChannelInfo>(); for (int j = 0; j < 3; j++) { currentIndex = i + j; LogManager.Ins.DebugLog(currentIndex + ""); if (currentIndex < channelInfos.Count) { tempChannelInfos.Add(channelInfos[currentIndex]); Debug.WriteLine("添加了" + currentIndex); } } AllOneRow3ChannelInfos.Add(tempChannelInfos); } } Debug.WriteLine("总个数:" + (_isLongItem ? ChannelInfos.Count : AllOneRow3ChannelInfos.Count)); } if (_isLongItem ? ChannelInfos.Count == 0 : AllOneRow3ChannelInfos.Count == 0) { xChannelsListBox.Visibility = Visibility.Collapsed; xNullTextBlock.Text = "暂无节目"; xNullTextBlock.Visibility = Visibility.Visible; } else { xChannelsListBox.Visibility = Visibility.Visible; xNullTextBlock.Visibility = Visibility.Collapsed; } xLoadChannelsGrid.Visibility = Visibility.Collapsed; }
void BeginLoad() { CurrentOrder = orderBar.SelectOrder; xorderButton.Visibility = System.Windows.Visibility.Visible; xorderButton.Content = orderBar.SelectText; _pageIndex = 1; AllOneRow3ChannelInfos.Clear(); ChannelInfos.Clear(); xLoadChannelsGrid.Visibility = Visibility.Visible; _isLoadingData = true; xLogTextBlock.Text = "加载新的数据 _pageIndex:" + _pageIndex + " 电影个数:" + (_isLongItem == true ? ChannelInfos.Count.ToString() : AllOneRow3ChannelInfos.Count.ToString()); _channelFactory.DownLoadDatas(TypeID, _currentSelectedTagInfos, _pageIndex, _channelItemCount, CurrentOrder); }
protected override void OnBackKeyPress(CancelEventArgs e) { if (gridtools.Visibility == System.Windows.Visibility.Visible) { SetTagsBarStatus(false); SetOrderBarStatus(false); e.Cancel = true; return; } xLoadChannelsGrid.Margin = new Thickness(0, 0, 0, 30); xLoadChannelsGrid.Visibility = Visibility.Visible; xLoadingTextBlock.Text = CommonUtils.LoadingTips; AllOneRow3ChannelInfos.Clear(); ChannelInfos.Clear(); base.OnBackKeyPress(e); }
void BeginGetChannles(bool isReStart) { if (isReStart)//重新加载 { xTypeTitleTextBlock.Text = Enum.GetName(typeof(ChannelTypes), TypeID); AllOneRow3ChannelInfos.Clear(); ChannelInfos.Clear(); if (TypeID == (int)ChannelTypes.VIP尊享) { xTypeTitleTextBlock.Foreground = App.Current.Resources["Orange"] as SolidColorBrush; } if (TypeID == 5 || TypeID == 6 || TypeID == 7) { // 体育 新闻 游戏 xChannelsListBox.ItemTemplate = Resources["LongItemTemplate"] as DataTemplate; xChannelsListBox.ItemsSource = ChannelInfos; _isLongItem = true; } else { xChannelsListBox.ItemTemplate = Resources["SmallItemTemplate"] as DataTemplate; xChannelsListBox.ItemsSource = AllOneRow3ChannelInfos; } _pageIndex = 1; } else//翻页 { _pageIndex++; } int leftCount = _channel_count - (_isLongItem ? ChannelInfos.Count : 3 * AllOneRow3ChannelInfos.Count); if (leftCount > 0 || isReStart) { xLoadChannelsGrid.Visibility = Visibility.Visible; xLoadingTextBlock.Text = (isReStart ? CommonUtils.LoadingTips : "剩余" + leftCount + "部片子"); _isLoadingData = true; xLogTextBlock.Text = "加载新的数据 _pageIndex:" + _pageIndex + " 电影个数:" + (_isLongItem == true ? ChannelInfos.Count.ToString() : AllOneRow3ChannelInfos.Count.ToString()); _channelFactory.DownLoadDatas(TypeID, _currentSelectedTagInfos, _pageIndex, _channelItemCount, CurrentOrder); } }