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


C# SchedulerServiceAgent.GetAllUpcomingPrograms方法代码示例

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


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

示例1: ProcessAlerts

        private void ProcessAlerts(DateTime preNotifySecs)
        {
            using (SchedulerServiceAgent tvschedulerAgent = new SchedulerServiceAgent())
            {
                List<UpcomingProgram> upcomingPrograms = new List<UpcomingProgram>(
                    tvschedulerAgent.GetAllUpcomingPrograms(ScheduleType.Alert, false));
                if (upcomingPrograms.Count > 0)
                {
                    DateTime _now = DateTime.Now;
                    foreach (UpcomingProgram program in upcomingPrograms)
                    {
                        if (preNotifySecs > program.StartTime && _now < program.StopTime
                            && !AlreadyNotifiedAlerts.Contains(program.ScheduleId))
                        {
                            NotifyProgram(program);
                            AlreadyNotifiedAlerts.Add(program.ScheduleId);
                            Log.Debug("NotifyManager: AlreadyNotifiedAlerts.Add {0}", program.Title);
                        }
                        else if (_now >= program.StopTime
                            && AlreadyNotifiedConflict.Contains(program.ScheduleId))
                        {
                            Log.Debug("NotifyManager: AlreadyNotifiedAlerts.Remove");
                            AlreadyNotifiedAlerts.Remove(program.ScheduleId);
                        }

                        if (program.StartTime < _nextCheckTimeAlerts && program.StartTime > _now)
                        {
                            _nextCheckTimeAlerts = program.StartTime;
                        }

                        if (program.StopTime < _nextCheckTimeAlerts && program.StopTime > _now)
                        {
                            _nextCheckTimeAlerts = program.StopTime;
                        }
                    }
                }
            }
        }
开发者ID:Rpatrishh,项目名称:ARGUS-TV-Clients,代码行数:38,代码来源:NotifyManager.cs

示例2: DoShowUpcomingCommand

        private IMBotMessage DoShowUpcomingCommand(IMBotConversation conversation, ScheduleType type)
        {
            if (type == ScheduleType.Recording)
            {
                using (ControlServiceAgent tvControlAgent = new ControlServiceAgent())
                {
                    UpcomingRecording[] upcomingRecordings = tvControlAgent.GetAllUpcomingRecordings(UpcomingRecordingsFilter.Recordings, false);

                    StringBuilder replyText = new StringBuilder();

                    if (upcomingRecordings.Length > 0)
                    {
                        int index = 0;
                        foreach (UpcomingRecording upcomingRecording in upcomingRecordings)
                        {
                            if (replyText.Length > 0)
                            {
                                replyText.AppendLine();
                            }

                            PluginService pluginService = null;
                            if (upcomingRecording.CardChannelAllocation != null)
                            {
                                pluginService =
                                    RecorderTunersCache.GetRecorderTunerById(upcomingRecording.CardChannelAllocation.RecorderTunerId);
                            }

                            replyText.AppendFormat("{0,3}» ", ++index);
                            Utility.AppendProgramDetails(replyText, upcomingRecording.Program.Channel, upcomingRecording.Program);
                            replyText.AppendFormat(" [{0}]", pluginService == null ? "-" : pluginService.Name);
                        }

                        conversation.Session[SessionKey.Programs] = new Session.Programs(upcomingRecordings);

                        return new IMBotMessage(replyText.ToString(), true)
                        {
                            Footer = "Use 'cancel', 'uncancel' or 'delete schedule' with <number>."
                        };
                    }
                }
            }
            else
            {
                using (SchedulerServiceAgent tvSchedulerAgent = new SchedulerServiceAgent())
                {
                    UpcomingProgram[] upcomingPrograms = tvSchedulerAgent.GetAllUpcomingPrograms(type, false);

                    StringBuilder replyText = new StringBuilder();

                    if (upcomingPrograms.Length > 0)
                    {
                        int index = 0;
                        foreach (UpcomingProgram upcomingProgram in upcomingPrograms)
                        {
                            if (replyText.Length > 0)
                            {
                                replyText.AppendLine();
                            }
                            replyText.AppendFormat("{0,3}» ", ++index);
                            Utility.AppendProgramDetails(replyText, upcomingProgram.Channel, upcomingProgram);
                        }

                        conversation.Session[SessionKey.Programs] = new Session.Programs(upcomingPrograms);

                        return new IMBotMessage(replyText.ToString(), true)
                        {
                            Footer = "Use 'record', 'cancel', 'uncancel' or 'delete schedule' with <number>."
                        };
                    }
                }
            }
            return new IMBotMessage("There are no upcoming " + type.ToString().ToLowerInvariant() + "s.");
        }
开发者ID:ElRakiti,项目名称:ARGUS-TV,代码行数:73,代码来源:IMCommands.cs

示例3: HandleAlerts

        private void HandleAlerts()
        {
            UpcomingProgram[] upcomingAlerts;
            AddressList alertContactFilter;
            lock (_alertsLock)
            {
                if (_upcomingAlerts == null)
                {
                    using (SchedulerServiceAgent tvSchedulerAgent = new SchedulerServiceAgent())
                    {
                        _upcomingAlerts = tvSchedulerAgent.GetAllUpcomingPrograms(ScheduleType.Alert, false);
                    }
                }
                EnsureAlertContactFilter();
                upcomingAlerts = _upcomingAlerts;
                alertContactFilter = _alertContactFilter;
            }

            bool sentAlert = false;
            foreach (UpcomingProgram upcomingAlert in upcomingAlerts)
            {
                if (upcomingAlert.StopTime > DateTime.Now
                    && upcomingAlert.StartTime.AddMinutes(-_alertMinutes) <= DateTime.Now)
                {
                    if (!IsRecentlyAlerted(upcomingAlert))
                    {
                        if (sentAlert)
                        {
                            // We just sent out an alert, seems this is needed to give the system
                            // some extra time :-(
                            Thread.Sleep(100);
                        }
                        if (BroadcastAlert(alertContactFilter, upcomingAlert))
                        {
                            _recentlyAlerted.Add(upcomingAlert);
                            sentAlert = true;
                        }
                    }
                }
            }
        }
开发者ID:jayrockk,项目名称:ARGUS-TV-Clients,代码行数:41,代码来源:MsnThread.cs

示例4: FindUpcomingRecording

        private static IMBotMessage FindUpcomingRecording(SchedulerServiceAgent tvSchedulerAgent, IMBotConversation conversation, IList<string> arguments, out UpcomingProgram upcomingRecording)
        {
            upcomingRecording = null;

            IProgramSummary program = null;
            Channel channel = null;
            Guid? upcomingProgramId = null;

            int programNumber;
            if (!int.TryParse(arguments[0], out programNumber))
            {
                return new IMBotMessage("Bad program number.", IMBotMessage.ErrorColor);
            }

            Session.Programs sessionPrograms = null;
            if (conversation.Session.ContainsKey(SessionKey.Programs))
            {
                sessionPrograms = conversation.Session[SessionKey.Programs] as Session.Programs;
            }
            if (sessionPrograms != null)
            {
                program = sessionPrograms.GetProgramAt(programNumber, out channel, out upcomingProgramId);
                if (program == null)
                {
                    return new IMBotMessage("Bad program number.", IMBotMessage.ErrorColor);
                }
            }
            else
            {
                return new IMBotMessage("No programs.", IMBotMessage.ErrorColor);
            }

            UpcomingProgram[] upcomingPrograms = tvSchedulerAgent.GetAllUpcomingPrograms(ScheduleType.Recording, true);
            foreach (UpcomingProgram upcomingProgram in upcomingPrograms)
            {
                bool idMatches = upcomingProgramId.HasValue
                    && upcomingProgram.UpcomingProgramId == upcomingProgramId.Value;
                if ((idMatches || upcomingProgram.Title == program.Title)
                    && upcomingProgram.Channel.ChannelId == channel.ChannelId
                    && upcomingProgram.StartTime == program.StartTime)
                {
                    upcomingRecording = upcomingProgram;
                    return null;
                }
            }

            return new IMBotMessage("Program not found in upcoming recordings.", IMBotMessage.ErrorColor);
        }
开发者ID:ElRakiti,项目名称:ARGUS-TV,代码行数:48,代码来源:IMCommands.cs

示例5: HasUpcomingProgram

        internal static bool HasUpcomingProgram(Guid channelId, GuideProgram program, out UpcomingProgram upcomingProgram, ScheduleType scheduleType)
        {
            using (SchedulerServiceAgent SchedulerAgent = new SchedulerServiceAgent())
            {
                upcomingProgram = null;
                Guid upcomingProgramId = program.GetUniqueUpcomingProgramId(channelId);

                List<UpcomingProgram> upcomingPrograms = new List<UpcomingProgram>(
                    SchedulerAgent.GetAllUpcomingPrograms(scheduleType, true));
                foreach (UpcomingProgram upcoming in upcomingPrograms)
                {
                    if (upcoming.UpcomingProgramId == upcomingProgramId)
                    {
                        upcomingProgram = upcoming;
                        return true;
                    }
                }
                return false;
            }
        }
开发者ID:Glenn-1990,项目名称:ARGUS-TV-Clients,代码行数:20,代码来源:TvProgramInfo.cs


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