本文整理汇总了C#中SchedulerServiceAgent.GetCurrentAndNextForChannel方法的典型用法代码示例。如果您正苦于以下问题:C# SchedulerServiceAgent.GetCurrentAndNextForChannel方法的具体用法?C# SchedulerServiceAgent.GetCurrentAndNextForChannel怎么用?C# SchedulerServiceAgent.GetCurrentAndNextForChannel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SchedulerServiceAgent
的用法示例。
在下文中一共展示了SchedulerServiceAgent.GetCurrentAndNextForChannel方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TuneLiveStream
private void TuneLiveStream(Channel channel)
{
Log.Debug("ChannelNavigator: TuneLiveStream(), channel = {0}", channel.DisplayName);
if (channel != null)
{
using (SchedulerServiceAgent tvSchedulerAgent = new SchedulerServiceAgent())
{
LiveStream liveStream = _liveStream;
CurrentAndNextProgram currentAndNext = tvSchedulerAgent.GetCurrentAndNextForChannel(channel.ChannelId, true, _liveStream);//null);
_currentChannel = channel;
_doingChannelChange = true;
RenderBlackImage();
if (liveStream != null)
{
try
{
g_Player.PauseGraph();
g_Player.OnZapping(0x80);
result = this.ControlAgent.TuneLiveStream(channel, ref liveStream);
Log.Debug("ChannelNavigator: First try to re-tune the existing TV stream (staying on the same card), result = {0}", result);
if (result == LiveStreamResult.Succeeded)
{
if (_isAnalog)
g_Player.OnZapping(-1);
double duration = g_Player.Duration;
if (g_Player.Duration < 0.0)
result = LiveStreamResult.UnknownError;
else
{
g_Player.SeekAbsolute(duration);
g_Player.ContinueGraph();
}
}
else if (result == LiveStreamResult.NoRetunePossible)// not mapped to card, card in use by recorder or other user ---> start new stream
{
// Now re-try the new channel with a new stream.
Log.Debug("ChannelNavigator: Seems a re-tune has failed, stop the current stream and start a new one");
SilentlyStopLiveStream(liveStream);
result = StartAndPlayNewLiveStream(channel, liveStream);
}
}
catch
{
result = LiveStreamResult.UnknownError;
Log.Error("ChannelNavigator: TuneLiveStream error");
}
}
else
{
result = StartAndPlayNewLiveStream(channel,liveStream);
}
_doingChannelChange = false;
if (result == LiveStreamResult.Succeeded)
{
_lastChannelChangeFailed = false;
StopRenderBlackImage();
}
else
{
_lastChannelChangeFailed = true;
SilentlyStopLiveStream(liveStream);
ChannelTuneFailedNotifyUser(result, channel);
}
}
}
}
示例2: RefreshCurrentAndNext
private static void RefreshCurrentAndNext(Channel channel, bool forceUpdate)
{
TimeSpan ts = DateTime.Now - _programUpdateTimer;
if (ts.TotalMilliseconds < 1000 && !forceUpdate)
{
return;
}
_programUpdateTimer = DateTime.Now;
lock (_refreshCurrAndNextLock)
{
using (GuideServiceAgent tvGuideAgent = new GuideServiceAgent())
using (SchedulerServiceAgent tvSchedulerAgent = new SchedulerServiceAgent())
{
CurrentAndNextProgram currentAndNext = tvSchedulerAgent.GetCurrentAndNextForChannel(channel.ChannelId, false, null);
if (currentAndNext != null)
{
if (currentAndNext.Current != null)
{
_currentProgram = tvGuideAgent.GetProgramById(currentAndNext.Current.GuideProgramId);
}
else
{
_currentProgram = null;
}
if (currentAndNext.Next != null)
{
_nextProgram = tvGuideAgent.GetProgramById(currentAndNext.Next.GuideProgramId);
}
else
{
_nextProgram = null;
}
}
else
{
_nextProgram = null;
_currentProgram = null;
}
}
}
}