本文整理汇总了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
//.........这里部分代码省略.........