本文整理汇总了C#中SchedulerServiceAgent.UncancelUpcomingProgram方法的典型用法代码示例。如果您正苦于以下问题:C# SchedulerServiceAgent.UncancelUpcomingProgram方法的具体用法?C# SchedulerServiceAgent.UncancelUpcomingProgram怎么用?C# SchedulerServiceAgent.UncancelUpcomingProgram使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SchedulerServiceAgent
的用法示例。
在下文中一共展示了SchedulerServiceAgent.UncancelUpcomingProgram方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DoCancelCommand
private IMBotMessage DoCancelCommand(IMBotConversation conversation, IList<string> arguments, bool cancel)
{
if (arguments.Count == 0)
{
return new IMBotMessage("Program number is missing.", IMBotMessage.ErrorColor);
}
using (SchedulerServiceAgent tvSchedulerAgent = new SchedulerServiceAgent())
{
UpcomingProgram upcomingRecording;
IMBotMessage result = FindUpcomingRecording(tvSchedulerAgent, conversation, arguments, out upcomingRecording);
if (result == null)
{
StringBuilder replyText = new StringBuilder();
if (cancel)
{
if (upcomingRecording.IsPartOfSeries)
{
tvSchedulerAgent.CancelUpcomingProgram(upcomingRecording.ScheduleId, upcomingRecording.GuideProgramId,
upcomingRecording.Channel.ChannelId, upcomingRecording.StartTime);
replyText.Append("Cancelled ");
}
else
{
tvSchedulerAgent.DeleteSchedule(upcomingRecording.ScheduleId);
replyText.Append("Deleted schedule for ");
}
}
else
{
tvSchedulerAgent.UncancelUpcomingProgram(upcomingRecording.ScheduleId, upcomingRecording.GuideProgramId,
upcomingRecording.Channel.ChannelId, upcomingRecording.StartTime);
replyText.Append("Uncancelled ");
}
Utility.AppendProgramDetails(replyText, upcomingRecording.Channel, upcomingRecording);
replyText.Append(".");
result = new IMBotMessage(replyText.ToString());
}
return result;
}
}
示例2: 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);
//.........这里部分代码省略.........