本文整理汇总了C#中SchedulerServiceAgent.GetScheduleById方法的典型用法代码示例。如果您正苦于以下问题:C# SchedulerServiceAgent.GetScheduleById方法的具体用法?C# SchedulerServiceAgent.GetScheduleById怎么用?C# SchedulerServiceAgent.GetScheduleById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SchedulerServiceAgent
的用法示例。
在下文中一共展示了SchedulerServiceAgent.GetScheduleById方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RecordProgram
internal static bool RecordProgram(Channel channel, GuideProgram guideProgram, ScheduleType scheduleType, bool NeedConfirm)
{
Log.Debug("TVProgammInfo.RecordProgram - channel = {0}, program = {1}", channel.DisplayName, guideProgram.CreateProgramTitle());
using (SchedulerServiceAgent tvSchedulerAgent = new SchedulerServiceAgent())
{
bool hasUpcomingRecording = false;
bool hasUpcomingAlert = false;
if (scheduleType == ScheduleType.Recording)
{
UpcomingRecording upcomingRecording;
if (HasUpcomingRecording(channel.ChannelId, guideProgram, out upcomingRecording))
{
hasUpcomingRecording = true;
if (upcomingRecording.Program.IsCancelled)
{
switch (upcomingRecording.Program.CancellationReason)
{
case UpcomingCancellationReason.Manual:
tvSchedulerAgent.UncancelUpcomingProgram(upcomingRecording.Program.ScheduleId, guideProgram.GuideProgramId, channel.ChannelId, guideProgram.StartTime);
return true;
case UpcomingCancellationReason.AlreadyQueued:
{
GUIDialogOK dlg = (GUIDialogOK)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_OK);
dlg.Reset();
dlg.SetHeading(Utility.GetLocalizedText(TextId.Record));
dlg.SetLine(1, Utility.GetLocalizedText(TextId.ThisProgramIsAlreadyQueued));
dlg.SetLine(2, Utility.GetLocalizedText(TextId.ForRecordingAtAnEarlierTime));
dlg.DoModal(GUIWindowManager.ActiveWindow);
}
break;
case UpcomingCancellationReason.PreviouslyRecorded:
{
GUIDialogOK dlg = (GUIDialogOK)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_OK);
dlg.Reset();
dlg.SetHeading(Utility.GetLocalizedText(TextId.Record));
dlg.SetLine(1, Utility.GetLocalizedText(TextId.ThisProgramWasPreviouslyRecorded));
dlg.DoModal(GUIWindowManager.ActiveWindow);
}
break;
}
}
else
{
if (upcomingRecording.Program.IsPartOfSeries)
{
GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);
if (dlg != null)
{
dlg.Reset();
dlg.SetHeading(Utility.GetLocalizedText(TextId.DeleteProgram));
dlg.Add(Utility.GetLocalizedText(TextId.CancelThisShow));
dlg.Add(Utility.GetLocalizedText(TextId.DeleteEntireSchedule));
dlg.DoModal(GUIWindowManager.ActiveWindow);
if (dlg.SelectedId > 0)
{
switch (dlg.SelectedLabel)
{
case 0: // Cancel
tvSchedulerAgent.CancelUpcomingProgram(upcomingRecording.Program.ScheduleId,
guideProgram.GuideProgramId, channel.ChannelId, guideProgram.StartTime);
return true;
case 1: // Delete
Schedule schedule = tvSchedulerAgent.GetScheduleById(upcomingRecording.Program.ScheduleId);
if (schedule != null)
{
GUIDialogYesNo dlgYesNo = (GUIDialogYesNo)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_YES_NO);
if (dlgYesNo != null)
{
dlgYesNo.SetHeading(Utility.GetLocalizedText(TextId.DeleteEntireSchedule));
dlgYesNo.SetLine(1, "\"" + schedule.Name + "\"");
dlgYesNo.SetLine(2, Utility.GetLocalizedText(TextId.AreYouSure));
dlgYesNo.SetLine(3, String.Empty);
dlgYesNo.SetDefaultToYes(false);
dlgYesNo.DoModal(GUIWindowManager.ActiveWindow);
if (dlgYesNo.IsConfirmed)
{
tvSchedulerAgent.DeleteSchedule(upcomingRecording.Program.ScheduleId);
return true;
}
}
}
break;
}
}
}
}
else
{
if (PluginMain.IsActiveRecording(channel.ChannelId, guideProgram))
{
GUIDialogYesNo dlgYesNo = (GUIDialogYesNo)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_YES_NO);
if (dlgYesNo != null)
{
dlgYesNo.SetHeading(Utility.GetLocalizedText(TextId.StopRecording));
dlgYesNo.SetLine(1, channel.DisplayName);
//.........这里部分代码省略.........
示例2: OnMessage
public override bool OnMessage(GUIMessage message)
{
_needToClearScreen = true;
#region case GUI_MSG_RECORD
if (message.Message == GUIMessage.MessageType.GUI_MSG_RECORD)
{
if (_isDialogVisible)
{
return false;
}
Channel currentChannel = PluginMain.Navigator.CurrentChannel;
GuideProgram currentProgram = PluginMain.GetCurrentProgram(ChannelType.Television);
if (currentChannel != null)
{
ActiveRecording activeRecording;
if (currentProgram == null
|| !PluginMain.IsActiveRecording(currentChannel.ChannelId, currentProgram, out activeRecording))
{
PluginMain.IsChannelRecording(currentChannel.ChannelId, out activeRecording);
}
if (activeRecording != null)
{
_dlgYesNo = (GUIDialogYesNo)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_YES_NO);
_dlgYesNo.SetHeading(1449); // stop recording
_dlgYesNo.SetLine(1, 1450); // are you sure to stop recording?
_dlgYesNo.SetLine(2, activeRecording.Program.Title);
_dialogYesNoVisible = true;
_dlgYesNo.DoModal(GetID);
_dialogYesNoVisible = false;
if (_dlgYesNo.IsConfirmed)
{
using (SchedulerServiceAgent tvSchedulerAgent = new SchedulerServiceAgent())
{
Schedule schedule = tvSchedulerAgent.GetScheduleById(activeRecording.Program.ScheduleId);
if (schedule != null)
{
if (activeRecording.Program.IsPartOfSeries)
{
tvSchedulerAgent.CancelUpcomingProgram(schedule.ScheduleId,
currentProgram == null ? null : (Guid?)currentProgram.GuideProgramId,
currentChannel.ChannelId, activeRecording.Program.StartTime);
}
else
{
tvSchedulerAgent.DeleteSchedule(schedule.ScheduleId);
}
string text = String.Format("{0} {1}-{2}",
activeRecording.Program.Title,
activeRecording.Program.StartTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat),
activeRecording.Program.StopTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat));
ShowRecordingNotifyDialog(tvSchedulerAgent, currentChannel, text, TextId.RecordingStopped);
}
}
}
}
else
{
_dialogMenu = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);
if (_dialogMenu != null)
{
using (SchedulerServiceAgent tvSchedulerAgent = new SchedulerServiceAgent())
{
_dialogMenu.Reset();
_dialogMenu.SetHeading(Utility.GetLocalizedText(TextId.Record));
if (currentProgram != null)
{
_dialogMenu.Add(Utility.GetLocalizedText(TextId.CurrentProgram));
}
_dialogMenu.Add("15 " + Utility.GetLocalizedText(TextId.Minutes));
_dialogMenu.Add("30 " + Utility.GetLocalizedText(TextId.Minutes));
_dialogMenu.Add("1 " + Utility.GetLocalizedText(TextId.Hour));
_dialogMenu.Add("1 " + Utility.GetLocalizedText(TextId.Hour) + " 30 " + Utility.GetLocalizedText(TextId.Minutes));
_dialogMenu.Add("2 " + Utility.GetLocalizedText(TextId.Hours));
_bottomDialogMenuVisible = true;
_dialogMenu.DoModal(GetID);
_bottomDialogMenuVisible = false;
Schedule schedule = null;
string notifyText = String.Empty;
int selectedLabel = _dialogMenu.SelectedLabel;
if (currentProgram == null)
{
selectedLabel++;
}
switch (selectedLabel)
{
case 0:
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,
//.........这里部分代码省略.........
示例3: GetUpcomingRecordingAndSchedule
internal static bool GetUpcomingRecordingAndSchedule(Guid channelId, GuideProgram program, out UpcomingRecording upcomingRecording, out Schedule schedule)
{
schedule = null;
if (HasUpcomingRecording(channelId, program, out upcomingRecording))
{
using (SchedulerServiceAgent tvSchedulerAgent = new SchedulerServiceAgent())
{
schedule = tvSchedulerAgent.GetScheduleById(upcomingRecording.Program.ScheduleId);
return (schedule != null);
}
}
return false;
}