當前位置: 首頁>>代碼示例>>C#>>正文


C# TvBusinessLayer.GetRecordingTimes方法代碼示例

本文整理匯總了C#中TvDatabase.TvBusinessLayer.GetRecordingTimes方法的典型用法代碼示例。如果您正苦於以下問題:C# TvBusinessLayer.GetRecordingTimes方法的具體用法?C# TvBusinessLayer.GetRecordingTimes怎麽用?C# TvBusinessLayer.GetRecordingTimes使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在TvDatabase.TvBusinessLayer的用法示例。


在下文中一共展示了TvBusinessLayer.GetRecordingTimes方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: GetNextWakeupTime

 public DateTime GetNextWakeupTime(DateTime earliestWakeupTime)
 {
   TvBusinessLayer layer = new TvBusinessLayer();
   Schedule recSchedule = null;
   DateTime scheduleWakeupTime = DateTime.MaxValue;
   DateTime nextWakeuptime = DateTime.MaxValue;
   foreach (Schedule schedule in Schedule.ListAll())
   {
     if (schedule.Canceled != Schedule.MinSchedule) continue;
     List<Schedule> schedules = layer.GetRecordingTimes(schedule);
     if (schedules.Count > 0)
     {
       int i = 0;
       // Take first occurrence of this schedule if not a canceled serie
       while (i < schedules.Count)
       {
         recSchedule = schedules[i];
         if (!recSchedule.IsSerieIsCanceled(recSchedule.StartTime))
           break;
         i++;
       }
       if (recSchedule != null)
       {
         scheduleWakeupTime = recSchedule.StartTime.AddMinutes(-recSchedule.PreRecordInterval);
       }
     }
     if (recSchedule == null)
     {
       // manually determine schedule's wakeup time of no guide data is present
       scheduleWakeupTime = GetWakeupTime(schedule);
     }
     if (scheduleWakeupTime < nextWakeuptime && scheduleWakeupTime >= earliestWakeupTime)
       nextWakeuptime = scheduleWakeupTime;
   }
   return nextWakeuptime;
 }
開發者ID:arangas,項目名稱:MediaPortal-1,代碼行數:36,代碼來源:ScheduledRecordingsWakeupHandler.cs

示例2: CreateProgram


//.........這裏部分代碼省略.........
            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
              {
                Log.Debug("TVProgramInfo.CreateProgram: Default => Skip new recording");
                return;
              }
          }
        }
      }

      if (saveSchedule != null)
      {
        Log.Debug("TVProgramInfo.CreateProgram - UnCancleSerie at {0}", program.StartTime);
        saveSchedule.UnCancelSerie(program.StartTime, program.IdChannel);
        //saveSchedule.UnCancelSerie();
        saveSchedule.Persist();
        currentSchedule = saveSchedule;
      }
      else
      {
        Log.Debug("TVProgramInfo.CreateProgram - create schedule = {0}", schedule.ToString());
        schedule.Persist();

        if (currentSchedule == null || (currentSchedule.ScheduleType > 0 && schedule.ScheduleType != (int)ScheduleRecordingType.Once))
        {
          currentSchedule = schedule;
        }
      }
      if (skipConflictingEpisodes)
      {
        List<Schedule> episodes = layer.GetRecordingTimes(schedule);
        foreach (Schedule episode in episodes)
        {
          if (DateTime.Now > episode.EndTime)
          {
            continue;
          }
          if (episode.IsSerieIsCanceled(episode.StartTime, program.IdChannel))
          {
            continue;
          }
          foreach (Schedule conflict in conflicts)
          {
            if (episode.IsOverlapping(conflict))
            {
              Log.Debug("TVProgramInfo.CreateProgram - skip episode = {0}", episode.ToString());
              CanceledSchedule canceledSchedule = new CanceledSchedule(schedule.IdSchedule, program.IdChannel, episode.StartTime);
              canceledSchedule.Persist();
            }
          }
        }
      }
      server.OnNewSchedule();
    }
開發者ID:sanyaade-embedded-systems,項目名稱:MediaPortal-1,代碼行數:101,代碼來源:TVProgramInfo.cs


注:本文中的TvDatabase.TvBusinessLayer.GetRecordingTimes方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。