GetNowAndNext() public method

public GetNowAndNext ( List aEpgChannelList ) : NowAndNext>.Dictionary
aEpgChannelList List
return NowAndNext>.Dictionary
示例#1
0
    private Dictionary<int, NowAndNext> GetNowAndNext(List<Channel> tvChannelList, DateTime nextEPGupdate)
    {
      Dictionary<int, NowAndNext> getNowAndNextSegment = new Dictionary<int, NowAndNext>();
      Dictionary<int, NowAndNext> getNowAndNext = new Dictionary<int, NowAndNext>();
      int idGroup = TVHome.Navigator.CurrentGroup.IdGroup;

      TvBusinessLayer layer = new TvBusinessLayer();
      if (_listNowNext.TryGetValue(idGroup, out getNowAndNext))
      {
        bool updateNow = (DateTime.Now >= nextEPGupdate);
        if (updateNow)
        {
          getNowAndNext = new Dictionary<int, NowAndNext>();
          List<List<Channel>> tvChannelListSegments = SplitChannelList(tvChannelList, 100);
          foreach (List<Channel> tvChannelListSegment in tvChannelListSegments)
          {
            getNowAndNextSegment = layer.GetNowAndNext(tvChannelListSegment);
            getNowAndNext = getNowAndNext.Concat(getNowAndNextSegment).ToDictionary(x => x.Key, x => x.Value);
          }

          _listNowNext[idGroup] = getNowAndNext;
        }
      }
      else
      {
        getNowAndNext = new Dictionary<int, NowAndNext>();
        List<List<Channel>> tvChannelListSegments = SplitChannelList(tvChannelList, 100);
        foreach (List<Channel> tvChannelListSegment in tvChannelListSegments)
        {
          getNowAndNextSegment = layer.GetNowAndNext(tvChannelListSegment);
          getNowAndNext = getNowAndNext.Concat(getNowAndNextSegment).ToDictionary(x => x.Key, x => x.Value);
        }
        _listNowNext.Add(idGroup, getNowAndNext);
      }
      return getNowAndNext;
    }