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


C# IController.GetAllTimeshiftingAndRecordingChannels方法代码示例

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


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

示例1: DoSetChannelStates

    private void DoSetChannelStates(IDictionary<int, ITvCardHandler> cards, ICollection<Channel> channels, ICollection<IUser> allUsers, IController tvController)
    {
      lock (_lock)
      {
        Stopwatch stopwatch = Stopwatch.StartNew();
        try
        {
          //construct list of all cards we can use to tune to the new channel
          Log.Debug("Controller: DoSetChannelStates for {0} channels", channels.Count);

          if (allUsers == null || allUsers.Count == 0)
          {
            return; // no users, no point in continuing.
          }

          IDictionary<int, ChannelState> timeshiftingAndRecordingStates = null;
          ICollection<ITvCardHandler> cardHandlers = cards.Values;
          foreach (Channel ch in channels)
          {
            if (!ch.VisibleInGuide)
            {
              UpdateChannelStateUsers(allUsers, ChannelState.nottunable, ch.IdChannel);
              continue;
            }

            ICollection<IChannel> tuningDetails = CardAllocationCache.GetTuningDetailsByChannelId(ch);
            bool isValidTuningDetails = IsValidTuningDetails(tuningDetails);
            if (!isValidTuningDetails)
            {
              UpdateChannelStateUsers(allUsers, ChannelState.nottunable, ch.IdChannel);
              continue;
            }

            foreach (IChannel tuningDetail in tuningDetails)
            {
              foreach (ITvCardHandler cardHandler in cardHandlers)
              {
                //check if card is enabled
                if (!cardHandler.DataBaseCard.Enabled)
                {
                  //not enabled, so skip the card
                  UpdateChannelStateUsers(allUsers, ChannelState.nottunable, ch.IdChannel);
                  continue;
                }

                if (!cardHandler.Tuner.CanTune(tuningDetail))
                {
                  //card cannot tune to this channel, so skip it
                  UpdateChannelStateUsers(allUsers, ChannelState.nottunable, ch.IdChannel);
                  continue;
                }

                //check if channel is mapped to this card and that the mapping is not for "Epg Only"
                bool isChannelMappedToCard = CardAllocationCache.IsChannelMappedToCard(ch, cardHandler.DataBaseCard);//, channelMapping);
                if (!isChannelMappedToCard)
                {
                  UpdateChannelStateUsers(allUsers, ChannelState.nottunable, ch.IdChannel);
                  continue;
                }

                if (!tuningDetail.FreeToAir && !cardHandler.DataBaseCard.CAM)
                {
                  UpdateChannelStateUsers(allUsers, ChannelState.nottunable, ch.IdChannel);
                  continue;
                }

                //ok card could be used to tune to this channel
                //now we check if its free...                                            
                CheckTransponderAllUsers(ch, allUsers, cardHandler, tuningDetail);
              } //while card end
            } //foreach tuningdetail end              

            //only query once
            if (timeshiftingAndRecordingStates == null)
            {
              Stopwatch stopwatchTimeshiftingAndRecording = Stopwatch.StartNew();
              timeshiftingAndRecordingStates = tvController.GetAllTimeshiftingAndRecordingChannels();
              stopwatchTimeshiftingAndRecording.Stop();
              Log.Info("ChannelStates.GetAllTimeshiftingAndRecordingChannels took {0} msec",
                       stopwatchTimeshiftingAndRecording.ElapsedMilliseconds);
            }
            UpdateRecOrTSChannelStateForUsers(ch, allUsers, timeshiftingAndRecordingStates);
          }

          RemoveAllTunableChannelStates(allUsers);
        }
        catch (ThreadAbortException)
        {
          Log.Info("ChannelState.DoSetChannelStates: thread obsolete and aborted.");
        }
        catch (InvalidOperationException tex)
        {
          Log.Error("ChannelState.DoSetChannelStates: Possible race condition occured setting channel states - {0}", tex);
        }
        catch (Exception ex)
        {
          Log.Error("ChannelState.DoSetChannelStates: An unknown error occured while setting channel states - {0}\n{1}", ex.Message,
                    ex);
        }
        finally
//.........这里部分代码省略.........
开发者ID:nio22,项目名称:MediaPortal-1,代码行数:101,代码来源:ChannelStates.cs


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