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


C# SchedulerServiceAgent.SaveSchedule方法代码示例

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


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

示例1: OnMessage


//.........这里部分代码省略.........
                                        schedule = GuideController.CreateRecordOnceSchedule(tvSchedulerAgent,
                                            PluginMain.Navigator.CurrentChannel.ChannelType,
                                            PluginMain.Navigator.CurrentChannel.ChannelId, currentProgram.Title, currentProgram.SubTitle,
                                            currentProgram.EpisodeNumberDisplay, currentProgram.StartTime);
                                        notifyText = String.Format("{0} {1}-{2}",
                                              currentProgram.Title,
                                              currentProgram.StartTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat),
                                              currentProgram.StopTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat));
                                        break;

                                    case 1:
                                        schedule = CreateManualSchedule(currentChannel, 15, out notifyText);
                                        break;

                                    case 2:
                                        schedule = CreateManualSchedule(currentChannel, 30, out notifyText);
                                        break;

                                    case 3:
                                        schedule = CreateManualSchedule(currentChannel, 60, out notifyText);
                                        break;

                                    case 4:
                                        schedule = CreateManualSchedule(currentChannel, 90, out notifyText);
                                        break;

                                    case 5:
                                        schedule = CreateManualSchedule(currentChannel, 2 * 60, out notifyText);
                                        break;
                                }

                                if (schedule != null)
                                {
                                    tvSchedulerAgent.SaveSchedule(schedule);
                                    ShowRecordingNotifyDialog(tvSchedulerAgent, currentChannel, notifyText, TextId.RecordingStarted);
                                }
                            }
                        }
                    }
                }
                return true;
            }

            #endregion

            #region case GUI_MSG_RECORDER_ABOUT_TO_START_RECORDING

            if (message.Message == GUIMessage.MessageType.GUI_MSG_RECORDER_ABOUT_TO_START_RECORDING)
            {
                /*
                        TVRecording rec = message.Object as TVRecording;
                        if (rec == null) return true;
                        if (rec.Channel == Recorder.TVChannelName) return true;
                        if (!Recorder.NeedChannelSwitchForRecording(rec)) return true;

                        _messageBoxVisible = false;
                        _msnWindowVisible = false;     // msn related can be removed
                        GUIWindowManager.IsOsdVisible = false;
                        if (_zapOsdVisible)
                        {
                          GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_WINDOW_DEINIT, _zapWindow.GetID, 0, 0, GetID, 0, null);
                          _zapWindow.OnMessage(msg);
                          _zapOsdVisible = false;
                          GUIWindowManager.IsOsdVisible = false;
                        }
                        if (_isOsdVisible)
开发者ID:jessgade,项目名称:ARGUS-TV-Clients,代码行数:67,代码来源:TvFullScreen.cs

示例2: DoRecordCommand


//.........这里部分代码省略.........
                {
                    sessionPrograms = conversation.Session[SessionKey.Programs] as Session.Programs;
                }

                IProgramSummary program = null;
                Channel channel = null;

                if (sessionPrograms != null)
                {
                    program = sessionPrograms.GetProgramAt(programNumber, out channel);
                    if (program == null)
                    {
                        return new IMBotMessage("Bad program number.", IMBotMessage.ErrorColor);
                    }
                }
                else
                {
                    return new IMBotMessage("No programs.", IMBotMessage.ErrorColor);
                }

                Schedule schedule = tvSchedulerAgent.CreateNewSchedule(GetChannelType(conversation), ScheduleType.Recording);

                bool newEpisodesOnly = arguments.Count > 2 && arguments[2].Equals("new", StringComparison.CurrentCultureIgnoreCase);
                string repeatingText = String.Empty;

                if (repeatingType == RepeatingType.Once)
                {
                    schedule.Name = GuideProgram.CreateProgramTitle(program.Title, program.SubTitle, program.EpisodeNumberDisplay);
                    schedule.Rules.Add(ScheduleRuleType.OnDate, program.StartTime.Date);
                    schedule.Rules.Add(ScheduleRuleType.AroundTime, new ScheduleTime(program.StartTime.TimeOfDay));
                    if (!String.IsNullOrEmpty(program.SubTitle))
                    {
                        schedule.Rules.Add(ScheduleRuleType.SubTitleEquals, program.SubTitle);
                    }
                    else if (!String.IsNullOrEmpty(program.EpisodeNumberDisplay))
                    {
                        schedule.Rules.Add(ScheduleRuleType.EpisodeNumberEquals, program.EpisodeNumberDisplay);
                    }
                    newEpisodesOnly = false;
                }
                else if (repeatingType == RepeatingType.AnyTime)
                {
                    schedule.Name = program.Title + " (Any Time)";
                    repeatingText = " any time";
                }
                else if (repeatingType == RepeatingType.Weekly)
                {
                    schedule.Name = program.Title + " (Weekly)";
                    schedule.Rules.Add(ScheduleRuleType.DaysOfWeek, GetDaysOfWeek(program.StartTime));
                    schedule.Rules.Add(ScheduleRuleType.AroundTime, new ScheduleTime(program.StartTime.TimeOfDay));
                    repeatingText = " weekly";
                }
                else if (repeatingType == RepeatingType.WorkingDays)
                {
                    schedule.Name = program.Title + " (Mon-Fri)";
                    schedule.Rules.Add(ScheduleRuleType.DaysOfWeek, ScheduleDaysOfWeek.WorkingDays);
                    schedule.Rules.Add(ScheduleRuleType.AroundTime, new ScheduleTime(program.StartTime.TimeOfDay));
                    repeatingText = " Mon-Fri";
                }
                else if (repeatingType == RepeatingType.Weekends)
                {
                    schedule.Name = program.Title + " (Sat-Sun)";
                    schedule.Rules.Add(ScheduleRuleType.DaysOfWeek, ScheduleDaysOfWeek.Weekends);
                    schedule.Rules.Add(ScheduleRuleType.AroundTime, new ScheduleTime(program.StartTime.TimeOfDay));
                    repeatingText = " Sat-Sun";
                }
                else if (repeatingType == RepeatingType.Weekly)
                {
                    schedule.Name = program.Title + " (Weekly)";
                    schedule.Rules.Add(ScheduleRuleType.DaysOfWeek, GetDaysOfWeek(program.StartTime));
                    schedule.Rules.Add(ScheduleRuleType.AroundTime, new ScheduleTime(program.StartTime.TimeOfDay));
                    repeatingText = " weekly";
                }
                else
                {
                    schedule.Name = program.Title + " (Daily)";
                    schedule.Rules.Add(ScheduleRuleType.AroundTime, new ScheduleTime(program.StartTime.TimeOfDay));
                    repeatingText = " daily";
                }
                if (newEpisodesOnly)
                {
                    schedule.Rules.Add(ScheduleRuleType.NewEpisodesOnly, true);
                }
                schedule.Rules.Add(ScheduleRuleType.Channels, channel.ChannelId);
                schedule.Rules.Add(ScheduleRuleType.TitleEquals, program.Title);
                tvSchedulerAgent.SaveSchedule(schedule);

                StringBuilder replyText = new StringBuilder();
                replyText.Append("Created schedule to record ");
                Utility.AppendProgramDetails(replyText, channel, program);
                replyText.Append(repeatingText);
                if (newEpisodesOnly)
                {
                    replyText.Append(" (record episodes once)");
                }
                replyText.Append(".");

                return new IMBotMessage(replyText.ToString());
            }
        }
开发者ID:ElRakiti,项目名称:ARGUS-TV,代码行数:101,代码来源:IMCommands.cs

示例3: RecordProgram


//.........这里部分代码省略.........
                                }
                                tvSchedulerAgent.DeleteSchedule(upcomingProgram.ScheduleId);
                                return true;
                            }
                        }
                    }
                }

                if (!hasUpcomingRecording && !hasUpcomingAlert)
                {
                    GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);
                    if (dlg != null)
                    {
                        Schedule newSchedule = null;
                        GuideController.RepeatingType dayRepeatingType;

                        dlg.Reset();
                        dlg.SetHeading(Utility.GetLocalizedText(TextId.SelectScheduleType));
                        dlg.Add(Utility.GetLocalizedText(TextId.Once));
                        dlg.Add(Utility.GetLocalizedText(TextId.EverytimeOnThisChannel));
                        dlg.Add(Utility.GetLocalizedText(TextId.EverytimeOnEveryChannel));
                        dlg.Add(Utility.GetLocalizedText(TextId.EveryWeekAtThisTime));
                        dlg.Add(Utility.GetLocalizedText(TextId.EveryDayAtThisTime));
                        if (guideProgram.StartTime.DayOfWeek == DayOfWeek.Saturday
                            || guideProgram.StartTime.DayOfWeek == DayOfWeek.Sunday)
                        {
                            dayRepeatingType = GuideController.RepeatingType.SatSun;
                            dlg.Add(Utility.GetLocalizedText(TextId.SatSun));
                        }
                        else
                        {
                            dayRepeatingType = GuideController.RepeatingType.MonFri;
                            dlg.Add(Utility.GetLocalizedText(TextId.MonFri));
                        }
                        dlg.DoModal(GUIWindowManager.ActiveWindow);

                        switch (dlg.SelectedLabel)
                        {
                            case 0: //once
                                newSchedule = GuideController.CreateRecordOnceSchedule(tvSchedulerAgent, channel.ChannelType, channel.ChannelId,
                                    guideProgram.Title, guideProgram.SubTitle, guideProgram.EpisodeNumberDisplay, guideProgram.StartTime);
                                break;

                            case 1: //everytime, this channel
                                newSchedule = GuideController.CreateRecordRepeatingSchedule(tvSchedulerAgent, GuideController.RepeatingType.AnyTimeThisChannel,
                                    channel.ChannelType, channel.ChannelId, guideProgram.Title, guideProgram.StartTime, "(" + Utility.GetLocalizedText(TextId.AlwaysThisChannel) + ")");
                                ScheduleRule newEpisodesRule = FindNewEpisodesOnlyRule(newSchedule);
                                if (newEpisodesRule != null)
                                {
                                    newEpisodesRule.Arguments[0] = false;
                                }
                                break;

                            case 2: //everytime, any channel
                                newSchedule = GuideController.CreateRecordRepeatingSchedule(tvSchedulerAgent, GuideController.RepeatingType.AnyTime,
                                    channel.ChannelType, null, guideProgram.Title, guideProgram.StartTime, "(" + Utility.GetLocalizedText(TextId.AlwaysEveryChannel) + ")");
                                ScheduleRule newEpisodesRule2 = FindNewEpisodesOnlyRule(newSchedule);
                                if (newEpisodesRule2 != null)
                                {
                                    newEpisodesRule2.Arguments[0] = false;
                                }
                                break;

                            case 3: //weekly
                                newSchedule = GuideController.CreateRecordRepeatingSchedule(tvSchedulerAgent, GuideController.RepeatingType.Weekly,
                                    channel.ChannelType, channel.ChannelId, guideProgram.Title, guideProgram.StartTime, "(" + Utility.GetLocalizedText(TextId.Weekly) + ")");
                                break;

                            case 4: //daily
                                newSchedule = GuideController.CreateRecordRepeatingSchedule(tvSchedulerAgent, GuideController.RepeatingType.Daily,
                                    channel.ChannelType, channel.ChannelId, guideProgram.Title, guideProgram.StartTime, "(" + Utility.GetLocalizedText(TextId.Daily) + ")");
                                break;

                            case 5: //Mon-Fri or Sat-Sun
                                string repeatingTime = string.Empty;
                                if (dayRepeatingType == GuideController.RepeatingType.MonFri)
                                {
                                    repeatingTime = "(" + Utility.GetLocalizedText(TextId.MonFri) + ")";
                                }
                                else if (dayRepeatingType == GuideController.RepeatingType.SatSun)
                                {
                                    repeatingTime = "(" + Utility.GetLocalizedText(TextId.SatSun) + ")";
                                }

                                newSchedule = GuideController.CreateRecordRepeatingSchedule(tvSchedulerAgent, dayRepeatingType,
                                    channel.ChannelType, channel.ChannelId, guideProgram.Title, guideProgram.StartTime, repeatingTime);
                                break;
                        }

                        if (newSchedule != null)
                        {
                            newSchedule.ScheduleType = scheduleType;
                            tvSchedulerAgent.SaveSchedule(newSchedule);
                            return true;
                        }
                    }
                }
                return false;
            }
        }
开发者ID:Glenn-1990,项目名称:ARGUS-TV-Clients,代码行数:101,代码来源:TvProgramInfo.cs


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