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


C# SchedulerServiceAgent.GetCurrentAndNextForChannel方法代码示例

本文整理汇总了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);
                    }
                }
            }
        }
开发者ID:Rpatrishh,项目名称:ARGUS-TV-Clients,代码行数:72,代码来源:ChannelNavigator.cs

示例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;
                    }
                }
            }
        }
开发者ID:dot-i,项目名称:ARGUS-TV-Clients,代码行数:42,代码来源:PluginMain.cs


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