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


C# TvBusinessLayer.GetConflictingSchedules方法代码示例

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


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

示例1: CreateProgram

    public static void CreateProgram(Program program, int scheduleType, int dialogId)
    {
      Log.Debug("TVProgramInfo.CreateProgram: program = {0}", program.ToString());
      Schedule schedule;
      Schedule saveSchedule = null;
      TvBusinessLayer layer = new TvBusinessLayer();
      if (IsRecordingProgram(program, out schedule, false)) // check if schedule is already existing
      {
        Log.Debug("TVProgramInfo.CreateProgram - series schedule found ID={0}, Type={1}", schedule.IdSchedule,
                  schedule.ScheduleType);
        Log.Debug("                            - schedule= {0}", schedule.ToString());
        //schedule = Schedule.Retrieve(schedule.IdSchedule); // get the correct informations
        if (schedule.IsSerieIsCanceled(schedule.GetSchedStartTimeForProg(program), program.IdChannel))
        {
          //lets delete the cancelled schedule.

          saveSchedule = schedule;
          schedule = new Schedule(program.IdChannel, program.Title, program.StartTime, program.EndTime);

          schedule.PreRecordInterval = saveSchedule.PreRecordInterval;
          schedule.PostRecordInterval = saveSchedule.PostRecordInterval;
          schedule.ScheduleType = (int)ScheduleRecordingType.Once; // needed for layer.GetConflictingSchedules(...)
        }
      }
      else
      {
        Log.Debug("TVProgramInfo.CreateProgram - no series schedule");
        // no series schedule => create it
        schedule = new Schedule(program.IdChannel, program.Title, program.StartTime, program.EndTime);
        schedule.PreRecordInterval = Int32.Parse(layer.GetSetting("preRecordInterval", "5").Value);
        schedule.PostRecordInterval = Int32.Parse(layer.GetSetting("postRecordInterval", "5").Value);
        schedule.ScheduleType = scheduleType;
      }

      // check if this program is conflicting with any other already scheduled recording
      IList conflicts = layer.GetConflictingSchedules(schedule);
      Log.Debug("TVProgramInfo.CreateProgram - conflicts.Count = {0}", conflicts.Count);
      TvServer server = new TvServer();
      bool skipConflictingEpisodes = false;
      if (conflicts.Count > 0)
      {
        TVConflictDialog dlg =
          (TVConflictDialog)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_TVCONFLICT);
        if (dlg != null)
        {
          dlg.Reset();
          dlg.SetHeading(GUILocalizeStrings.Get(879)); // "recording conflict"
          foreach (Schedule conflict in conflicts)
          {
            Log.Debug("TVProgramInfo.CreateProgram: Conflicts = " + conflict);

            GUIListItem item = new GUIListItem(conflict.ProgramName);
            item.Label2 = GetRecordingDateTime(conflict);
            Channel channel = Channel.Retrieve(conflict.IdChannel);
            if (channel != null && !string.IsNullOrEmpty(channel.DisplayName))
            {
              item.Label3 = channel.DisplayName;
            }
            else
            {
              item.Label3 = conflict.IdChannel.ToString();
            }
            item.TVTag = conflict;
            dlg.AddConflictRecording(item);
          }
          dlg.ConflictingEpisodes = (scheduleType != (int)ScheduleRecordingType.Once);
          dlg.DoModal(dialogId);
          switch (dlg.SelectedLabel)
          {
            case 0: // Skip new Recording
              {
                Log.Debug("TVProgramInfo.CreateProgram: Skip new recording");
                return;
              }
            case 1: // Don't record the already scheduled one(s)
              {
                Log.Debug("TVProgramInfo.CreateProgram: Skip old recording(s)");
                foreach (Schedule conflict in conflicts)
                {
                  Program prog =
                    new Program(conflict.IdChannel, conflict.StartTime, conflict.EndTime, conflict.ProgramName, "-", "-",
                                Program.ProgramState.None,
                                DateTime.MinValue, string.Empty, string.Empty, string.Empty, string.Empty, -1,
                                string.Empty, -1);
                  CancelProgram(prog, Schedule.Retrieve(conflict.IdSchedule), dialogId);
                }
                break;
              }
            case 2: // keep conflict
              {
                Log.Debug("TVProgramInfo.CreateProgram: Keep Conflict");
                break;
              }
            case 3: // Skip for conflicting episodes
              {
                Log.Debug("TVProgramInfo.CreateProgram: Skip conflicting episode(s)");
                skipConflictingEpisodes = true;
                break;
              }
            default: // Skipping new Recording
//.........这里部分代码省略.........
开发者ID:sanyaade-embedded-systems,项目名称:MediaPortal-1,代码行数:101,代码来源:TVProgramInfo.cs

示例2: GetConflictingSchedules

      public IList<Schedule> GetConflictingSchedules(Schedule schedule)
      {
          TvBusinessLayer mylayer = new TvBusinessLayer();
          List<Schedule> conflictingSchedules = new List<Schedule>();
          List<Schedule> notViewableSchedules = new List<Schedule>();
          
          mylayer.GetConflictingSchedules(schedule, out conflictingSchedules, out notViewableSchedules);

          Log.Debug("**********DEBUG GetConflictingSchedules ****************");
          Log.Debug("Schedule:");
          Log.Debug(schedule.ProgramName);
          Log.Debug(schedule.StartTime.ToString());
          Log.Debug(schedule.EndTime.ToString());
          Log.Debug(schedule.IdChannel.ToString());
          Log.Debug("");

          Log.Debug("Conflicting Schedules:");
          foreach (Schedule myschedule in conflictingSchedules)
          {
              Log.Debug(myschedule.ProgramName);
              Log.Debug(myschedule.StartTime.ToString());
              Log.Debug(myschedule.EndTime.ToString());
              Log.Debug(myschedule.IdChannel.ToString());
              Log.Debug("");
          }

          Log.Debug("notViewable Schedules:");
          foreach (Schedule myschedule in notViewableSchedules)
          {
              Log.Debug(myschedule.ProgramName);
              Log.Debug(myschedule.StartTime.ToString());
              Log.Debug(myschedule.EndTime.ToString());
              Log.Debug(myschedule.IdChannel.ToString());
              Log.Debug("");
          }

          return conflictingSchedules;
      }
开发者ID:huha001,项目名称:TvWishList,代码行数:38,代码来源:EpgClass.cs


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