void listFactory_HttpSucessed(object sender, HttpFactoryArgs <LiveArgs> e)
        {
            LiveListGroup group = null;
            IEnumerable <LiveChannelInfo> list = e.Result.Channels;

            if (_isClickMore)
            {
                CloseTips();
                group = _viewModel.Groups[_groupIndex];
                list  = list.Skip(_colCount * 2);
            }
            else
            {
                group = CreateGroup(e.Result.GroupName);
            }

            if (_groupIndex == 0)
            {
                this.DefaultViewModel["SatelliteSource"] = group.ItemsGroup;
            }
            else
            {
                this.DefaultViewModel["LocalTVSource"] = group.ItemsGroup;
            }

            CreateItems(group, list);
            if (!_isClickMore)
            {
                GetLiveList();
            }
        }
        LiveListGroup CreateGroup(string groupName)
        {
            var group = new LiveListGroup();

            group.GroupName  = groupName;
            group.ItemsGroup = new ObservableCollection <LiveListItem>();
            _viewModel.Groups.Add(group);
            return(group);
        }
Esempio n. 3
0
        void listFactory_HttpSucessed(object sender, HttpFactoryArgs <LiveArgs> e)
        {
            var page = CommonUtils.GetCurrentPage() as LiveChannelPage;

            if (page == null)
            {
                return;
            }
            page.LoadingTipVisibility = Visibility.Collapsed;

            LiveListGroup group = null;

            //if (Tag.ToString() == LiveType.Recommend.CreateString())
            //    group = page.ViewModel.Groups[0];
            if (Tag.ToString() == LiveType.Sports.CreateString())
            {
                group = page.ViewModel.Groups[2];
            }
            else
            {
                group = page.ViewModel.Groups[3];
            }

            var newCount = e.Result.Channels.Count;

            group.ItemsGroup.PerformanceClear();

            for (var i = 0; i < newCount; i++)
            {
                group.ItemsGroup.Add(new LiveListItem()
                {
                    ChannelInfo = e.Result.Channels[i]
                });
            }

            if (newCount <= 0)
            {
                group.ItemsGroup.Add(new LiveListItem()
                {
                    ChannelInfo = new LiveChannelInfo(LiveType.Sports)
                    {
                        Id = 0, Title = string.Format("暂无{0}节目", group.GroupName), StartTime = DateTime.Now.AddDays(1)
                    }
                });
            }
        }
        void CreateItems(LiveListGroup group, IEnumerable <LiveChannelInfo> items)
        {
            bool hasReuslt = false;

            foreach (var live in items)
            {
                hasReuslt = true;
                var item = new LiveListItem()
                {
                    ChannelInfo = live
                };
                group.ItemsGroup.Add(item);
            }
            if (!hasReuslt)
            {
                group.ItemsGroup.Add(new LiveListItem()
                {
                    ChannelInfo = new LiveChannelInfo(LiveType.Sports)
                    {
                        Id = 0, Title = string.Format("暂无{0}节目", group.GroupName), StartTime = DateTime.Now.AddDays(1)
                    }
                });
            }
        }
Esempio n. 5
0
 void CreateItems(LiveListGroup group, IEnumerable<LiveChannelInfo> items)
 {
     bool hasReuslt = false;
     foreach (var live in items)
     {
         hasReuslt = true;
         var item = new LiveListItem() { ChannelInfo = live };
         group.ItemsGroup.Add(item);
     }
     if (!hasReuslt)
         group.ItemsGroup.Add(new LiveListItem() { ChannelInfo = new LiveChannelInfo(LiveType.Sports) { Id = 0, Title = string.Format("暂无{0}节目", group.GroupName), StartTime = DateTime.Now.AddDays(1) } });
 }
Esempio n. 6
0
 LiveListGroup CreateGroup(string groupName)
 {
     var group = new LiveListGroup();
     group.GroupName = groupName;
     group.ItemsGroup = new ObservableCollection<LiveListItem>();
     _viewModel.Groups.Add(group);
     return group;
 }