当前位置: 首页>>代码示例>>C#>>正文


C# TvBusinessLayer.GetTVGuideChannelsForGroup方法代码示例

本文整理汇总了C#中TvDatabase.TvBusinessLayer.GetTVGuideChannelsForGroup方法的典型用法代码示例。如果您正苦于以下问题:C# TvBusinessLayer.GetTVGuideChannelsForGroup方法的具体用法?C# TvBusinessLayer.GetTVGuideChannelsForGroup怎么用?C# TvBusinessLayer.GetTVGuideChannelsForGroup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TvDatabase.TvBusinessLayer的用法示例。


在下文中一共展示了TvBusinessLayer.GetTVGuideChannelsForGroup方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetChannelListByGroup

    private List<Channel> GetChannelListByGroup()
    {
      int idGroup = TVHome.Navigator.CurrentGroup.IdGroup;

      if (_tvGroupChannelListCache == null)
      {
        _tvGroupChannelListCache = new Dictionary<int, List<Channel>>();
      }

      List<Channel> channels = null;
      if (_tvGroupChannelListCache.TryGetValue(idGroup, out channels))  //already in cache ? then return it.      
      {
        Log.Debug("TvMiniGuide: GetChannelListByGroup returning cached version of channels.");
        return channels;
      }
      else //not in cache, fetch it and update cache, then return.
      {
        TvBusinessLayer layer = new TvBusinessLayer();
        List<Channel> tvChannelList = layer.GetTVGuideChannelsForGroup(idGroup);

        if (tvChannelList != null)
        {
          Log.Debug("TvMiniGuide: GetChannelListByGroup caching channels from DB.");
          _tvGroupChannelListCache.Add(idGroup, tvChannelList);
          return tvChannelList;
        }
      }
      return new List<Channel>();
    }
开发者ID:MediaPortal,项目名称:MediaPortal-1,代码行数:29,代码来源:TvMiniGuide.cs

示例2: UpdateChannelStatesForUsers

    private void UpdateChannelStatesForUsers()
    {
      TvBusinessLayer layer = new TvBusinessLayer();

      //System.Diagnostics.Debugger.Launch();
      // this section makes sure that all users are updated in regards to channel states.      
      ChannelStates channelStates = new ChannelStates(layer, this);

      if (channelStates != null)
      {
        IList<ChannelGroup> groups = ChannelGroup.ListAll();

        // populating _tvChannelListGroups is only done once as is therefor cached.
        if (_tvChannelListGroups == null)
        {
          foreach (ChannelGroup group in groups)
          {
            // we will only update user created groups, since it will often have fewer channels than "all channels"
            // going into "all channels" group in mini EPG will always be slower.
            if (group.GroupName.Equals(TvConstants.TvGroupNames.AllChannels))
              continue;

            if (_tvChannelListGroups == null)
            {
              _tvChannelListGroups = layer.GetTVGuideChannelsForGroup(group.IdGroup);
            }
            else
            {
              IList<Channel> tvChannelList = layer.GetTVGuideChannelsForGroup(group.IdGroup);

              foreach (Channel ch in tvChannelList)
              {
                bool exists = _tvChannelListGroups.Exists(delegate(Channel c) { return c.IdChannel == ch.IdChannel; });
                if (!exists)
                {
                  _tvChannelListGroups.Add(ch);
                }
              }
            }
          }
        }

        channelStates.SetChannelStates(_cards, _tvChannelListGroups, true, this);
      }
    }
开发者ID:npcomplete111,项目名称:MediaPortal-1,代码行数:45,代码来源:TVController.cs

示例3: GetChannels

    protected override void GetChannels(bool refresh)
    {
      if (refresh || _channelList == null)
      {
        if (_channelList != null)
        {
          if (_channelList.Count < _channelCount)
          {
            _previousChannelCount = _channelList.Count;
          }
          else
          {
            _previousChannelCount = _channelCount;
          }
        }
        _channelList = new List<GuideChannel>();
      }

      if (_channelList.Count == 0)
      {
        try
        {
          if (TVHome.Navigator.CurrentGroup != null)
          {
            TvBusinessLayer layer = new TvBusinessLayer();
            IList<Channel> channels = layer.GetTVGuideChannelsForGroup(TVHome.Navigator.CurrentGroup.IdGroup);
            foreach (Channel chan in channels)
            {
              GuideChannel tvGuidChannel = new GuideChannel();
              tvGuidChannel.channel = chan;

              if (tvGuidChannel.channel.VisibleInGuide && tvGuidChannel.channel.IsTv)
              {
                if (_showChannelNumber)
                {

                  if (_byIndex)
                  {
                    tvGuidChannel.channelNum = _channelList.Count + 1;
                  }
                  else
                  {
                    tvGuidChannel.channelNum = chan.ChannelNumber;
                  }
                }
                tvGuidChannel.strLogo = GetChannelLogo(tvGuidChannel.channel.DisplayName);
                _channelList.Add(tvGuidChannel);
              }
            }
          }
        }
        catch { }

        if (_channelList.Count == 0)
        {
          GuideChannel tvGuidChannel = new GuideChannel();
          tvGuidChannel.channel = new Channel(false, true, 0, DateTime.MinValue, false,
                                              DateTime.MinValue, 0, true, "", GUILocalizeStrings.Get(911), 10000);
          for (int i = 0; i < 10; ++i)
          {
            _channelList.Add(tvGuidChannel);
          }
        }
      }
    }
开发者ID:doskabouter,项目名称:MediaPortal-1,代码行数:65,代码来源:TvGuideBase.cs

示例4: GetAllChannelStatesForGroup

    /// <summary>
    /// Fetches all channel states for a specific group
    /// </summary>
    /// <param name="idGroup"></param>    
    /// <param name="user"></param>        
    public Dictionary<int, ChannelState> GetAllChannelStatesForGroup(int idGroup, IUser user)
    {
      if (idGroup < 1)
      {
        return null;
      }

      if (user == null)
      {
        return null;
      }

      TvBusinessLayer layer = new TvBusinessLayer();
      IList<Channel> tvChannelList = layer.GetTVGuideChannelsForGroup(idGroup);

      if (tvChannelList == null || tvChannelList.Count == 0)
        return null;

      Dictionary<int, ChannelState> channelStatesList = new Dictionary<int, ChannelState>();
      ChannelStates channelStates = new ChannelStates(layer, this);

      if (channelStates != null)
      {
        channelStatesList = channelStates.GetChannelStates(_cards, tvChannelList, ref user, true, this);
      }

      return channelStatesList;
    }
开发者ID:npcomplete111,项目名称:MediaPortal-1,代码行数:33,代码来源:TVController.cs


注:本文中的TvDatabase.TvBusinessLayer.GetTVGuideChannelsForGroup方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。