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


C# TvBusinessLayer.SearchMinimalPrograms方法代码示例

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


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

示例1: PopulateListviewWithUpcomingEpisodes

    private void PopulateListviewWithUpcomingEpisodes(Program lastSelectedProgram)
    {
      int itemToSelect = -1;
      lstUpcomingEpsiodes.Clear();
      TvBusinessLayer layer = new TvBusinessLayer();
      DateTime dtDay = DateTime.Now;

      // build a list of all upcoming instances of program from EPG data based on program name alone
      List<Program> episodes = (List<Program>)layer.SearchMinimalPrograms(dtDay, dtDay.AddDays(28), initialProgram.Title, null);

      // now if schedule is time based then build a second list for that schedule based on start time (see below)
      IList<Program> actualUpcomingEps = new List<Program>();      
      if (currentSchedule != null)
      {
        int scheduletype = currentSchedule.ScheduleType;        

        switch (scheduletype)
        {
          case (int)ScheduleRecordingType.Weekly:
            actualUpcomingEps = Program.RetrieveWeekly(initialProgram.StartTime, initialProgram.EndTime, initialProgram.IdChannel);
            break;

          case (int)ScheduleRecordingType.Weekends:
            actualUpcomingEps = Program.RetrieveWeekends(initialProgram.StartTime, initialProgram.EndTime, initialProgram.IdChannel);
            break;

          case (int)ScheduleRecordingType.WorkingDays:
            actualUpcomingEps = Program.RetrieveWorkingDays(initialProgram.StartTime, initialProgram.EndTime, initialProgram.IdChannel);
            break;

          case (int)ScheduleRecordingType.Daily:
          actualUpcomingEps = Program.RetrieveDaily(initialProgram.StartTime, initialProgram.EndTime, initialProgram.IdChannel);
          break;
        }
       
        // now if we have a time based schedule then loop through that and if entry does not exist
        // in the original list then add it
        // an entry will exist in the second list but not first if the program name is different
        // in reality this will probably be a series that has finished
        // eg. we have set a schedule for channel X for Monday 21:00 to 22:00 which happens to be when 
        // program A is on.   The series for program A finishes and now between 21:00 and 22:00 on 
        // channel X is program B.   A time based schedule does not take the program name into account
        // therefore program B will get recorded.
        if (actualUpcomingEps.Count > 0)
        {
          for (int i = actualUpcomingEps.Count - 1; i >= 0; i--)
          {
            Program ep = actualUpcomingEps[i];

            if (!episodes.Contains(ep))
            {
              episodes.Add(ep);
            }
          }
          episodes.Sort((x, y) => (x.StartTime.CompareTo(y.StartTime))); //resort list locally on starttime
        }

      }
      bool updateCurrentProgram = true;
      anyUpcomingEpisodesRecording = false;
      int activeRecordings = 0;
      for (int i = 0; i < episodes.Count; i++)
      {        
        Program episode = episodes[i];
        GUIListItem item = new GUIListItem();
        item.Label = TVUtil.GetDisplayTitle(episode);
        item.OnItemSelected += item_OnItemSelected;
        string logo = Utils.GetCoverArt(Thumbs.TVChannel, episode.ReferencedChannel().DisplayName);
        if (string.IsNullOrEmpty(logo))                      
        {
          item.Label = String.Format("{0} {1}", episode.ReferencedChannel().DisplayName, TVUtil.GetDisplayTitle(episode));
          logo = "defaultVideoBig.png";
        }

        bool isActualUpcomingEps = actualUpcomingEps.Contains(episode) ;
        bool isRecPrg = isActualUpcomingEps;
        Schedule recordingSchedule = currentSchedule;

        // appears a little odd but seems to work
        // if episode is not in second (time based) list then override isRecPrg by actually
        // checking if episode is due to be recorded (if it is in second (time based) list then
        // it is going to be recorded
        if (!isActualUpcomingEps)
        {
            isRecPrg = (episode.IsRecording || episode.IsRecordingOncePending || episode.IsRecordingSeriesPending || 
                        episode.IsPartialRecordingSeriesPending) && IsRecordingProgram(episode, out recordingSchedule, true);
        }
        if (isRecPrg)
        {          
          if (!recordingSchedule.IsSerieIsCanceled(recordingSchedule.GetSchedStartTimeForProg(episode), episode.IdChannel))
          {
            bool hasConflict = recordingSchedule.ReferringConflicts().Count > 0;
            bool isPartialRecording = false;
            bool isSeries = (recordingSchedule.ScheduleType != (int)ScheduleRecordingType.Once);

            //check for partial recordings.
            if (isActualUpcomingEps && currentSchedule != null)
            {
              isPartialRecording = Schedule.IsPartialRecording(currentSchedule, episode);
            }
//.........这里部分代码省略.........
开发者ID:sanyaade-embedded-systems,项目名称:MediaPortal-1,代码行数:101,代码来源:TVProgramInfo.cs

示例2: GetRecordingTimes

      //-------------------------------------------------------------------------------------------------------------        
      // gets the recording time of a schedule
      //-------------------------------------------------------------------------------------------------------------
      public List<Schedule> GetRecordingTimes(Schedule rec, int days)
      {
          TvBusinessLayer layer = new TvBusinessLayer();
          List<Schedule> recordings = new List<Schedule>();

          DateTime dtDay = DateTime.Now;
          if (rec.ScheduleType == (int)ScheduleRecordingType.Once)
          {
              recordings.Add(rec);
              return recordings;
          }

          if (rec.ScheduleType == (int)ScheduleRecordingType.Daily)
          {
              for (int i = 0; i < days; ++i)
              {
                  Schedule recNew = rec.Clone();
                  recNew.ScheduleType = (int)ScheduleRecordingType.Once;
                  recNew.StartTime = new DateTime(dtDay.Year, dtDay.Month, dtDay.Day, rec.StartTime.Hour, rec.StartTime.Minute,
                                                  0);
                  if (rec.EndTime.Day > rec.StartTime.Day)
                  {
                      dtDay = dtDay.AddDays(1);
                  }
                  recNew.EndTime = new DateTime(dtDay.Year, dtDay.Month, dtDay.Day, rec.EndTime.Hour, rec.EndTime.Minute, 0);
                  if (rec.EndTime.Day > rec.StartTime.Day)
                  {
                      dtDay = dtDay.AddDays(-1);
                  }
                  recNew.Series = true;
                  if (recNew.StartTime >= DateTime.Now)
                  {
                      if (rec.IsSerieIsCanceled(recNew.StartTime))
                      {
                          recNew.Canceled = recNew.StartTime;
                      }
                      recordings.Add(recNew);
                  }
                  dtDay = dtDay.AddDays(1);
              }
              return recordings;
          }

          if (rec.ScheduleType == (int)ScheduleRecordingType.WorkingDays)
          {

#if (TV100 || TV101 || TV12)
              for (int i = 0; i < days; ++i)
              {
                  if (dtDay.DayOfWeek != DayOfWeek.Saturday && dtDay.DayOfWeek != DayOfWeek.Sunday)
#elif(TV11)
              WeekEndTool weekEndTool = Setting.GetWeekEndTool();
              for (int i = 0; i < days; ++i)
              {
                  if (weekEndTool.IsWorkingDay(dtDay.DayOfWeek))  
#endif             
                  {
                      Schedule recNew = rec.Clone();
                      recNew.ScheduleType = (int)ScheduleRecordingType.Once;
                      recNew.StartTime = new DateTime(dtDay.Year, dtDay.Month, dtDay.Day, rec.StartTime.Hour, rec.StartTime.Minute,
                                                      0);
                      if (rec.EndTime.Day > rec.StartTime.Day)
                      {
                          dtDay = dtDay.AddDays(1);
                      }
                      recNew.EndTime = new DateTime(dtDay.Year, dtDay.Month, dtDay.Day, rec.EndTime.Hour, rec.EndTime.Minute, 0);
                      if (rec.EndTime.Day > rec.StartTime.Day)
                      {
                          dtDay = dtDay.AddDays(-1);
                      }
                      recNew.Series = true;
                      if (rec.IsSerieIsCanceled(recNew.StartTime))
                      {
                          recNew.Canceled = recNew.StartTime;
                      }
                      if (recNew.StartTime >= DateTime.Now)
                      {
                          recordings.Add(recNew);
                      }
                  }
                  dtDay = dtDay.AddDays(1);
              }
              return recordings;
          }

          if (rec.ScheduleType == (int)ScheduleRecordingType.Weekends)
          {
#if(TV100)
              IList progList = layer.SearchMinimalPrograms(dtDay, dtDay.AddDays(days), rec.ProgramName,rec.ReferencedChannel());
              foreach (Program prog in progList)
              {
                  if ((rec.IsRecordingProgram(prog, false)) &&
                      (prog.StartTime.DayOfWeek == DayOfWeek.Saturday || prog.StartTime.DayOfWeek == DayOfWeek.Sunday))
#elif(TV101 || TV12)
              IList<Program> progList = layer.SearchMinimalPrograms(dtDay, dtDay.AddDays(days), rec.ProgramName,rec.ReferencedChannel());
              foreach (Program prog in progList)
              {
//.........这里部分代码省略.........
开发者ID:huha001,项目名称:TvWishList,代码行数:101,代码来源:EpgClass.cs

示例3: GetRecordingTimes

    public List<Schedule> GetRecordingTimes(Schedule rec, int days)
    {
      TvBusinessLayer layer = new TvBusinessLayer();
      List<Schedule> recordings = new List<Schedule>();

      DateTime dtDay = DateTime.Now;
      if (rec.ScheduleType == (int)ScheduleRecordingType.Once)
      {
        recordings.Add(rec);
        return recordings;
      }

      if (rec.ScheduleType == (int)ScheduleRecordingType.Daily)
      {
        for (int i = 0; i < days; ++i)
        {
          Schedule recNew = rec.Clone();
          recNew.ScheduleType = (int)ScheduleRecordingType.Once;
          recNew.StartTime = new DateTime(dtDay.Year, dtDay.Month, dtDay.Day, rec.StartTime.Hour, rec.StartTime.Minute,
                                          0);
          if (rec.EndTime.Day > rec.StartTime.Day)
          {
            dtDay = dtDay.AddDays(1);
          }
          recNew.EndTime = new DateTime(dtDay.Year, dtDay.Month, dtDay.Day, rec.EndTime.Hour, rec.EndTime.Minute, 0);
          if (rec.EndTime.Day > rec.StartTime.Day)
          {
            dtDay = dtDay.AddDays(-1);
          }
          recNew.Series = true;
          if (recNew.StartTime >= DateTime.Now)
          {
            if (rec.IsSerieIsCanceled(recNew.StartTime))
            {
              recNew.Canceled = recNew.StartTime;
            }
            recordings.Add(recNew);
          }
          dtDay = dtDay.AddDays(1);
        }
        return recordings;
      }

      if (rec.ScheduleType == (int)ScheduleRecordingType.WorkingDays)
      {
        for (int i = 0; i < days; ++i)
        {
          if (WeekEndTool.IsWorkingDay(dtDay.DayOfWeek))
          {
            Schedule recNew = rec.Clone();
            recNew.ScheduleType = (int)ScheduleRecordingType.Once;
            recNew.StartTime = new DateTime(dtDay.Year, dtDay.Month, dtDay.Day, rec.StartTime.Hour, rec.StartTime.Minute,
                                            0);
            if (rec.EndTime.Day > rec.StartTime.Day)
            {
              dtDay = dtDay.AddDays(1);
            }
            recNew.EndTime = new DateTime(dtDay.Year, dtDay.Month, dtDay.Day, rec.EndTime.Hour, rec.EndTime.Minute, 0);
            if (rec.EndTime.Day > rec.StartTime.Day)
            {
              dtDay = dtDay.AddDays(-1);
            }
            recNew.Series = true;
            if (rec.IsSerieIsCanceled(recNew.StartTime))
            {
              recNew.Canceled = recNew.StartTime;
            }
            if (recNew.StartTime >= DateTime.Now)
            {
              recordings.Add(recNew);
            }
          }
          dtDay = dtDay.AddDays(1);
        }
        return recordings;
      }

      if (rec.ScheduleType == (int)ScheduleRecordingType.Weekends)
      {
        IList<Program> progList = layer.SearchMinimalPrograms(dtDay, dtDay.AddDays(days), rec.ProgramName,
                                                              rec.ReferencedChannel());

        foreach (Program prog in progList)
        {
          if ((rec.IsRecordingProgram(prog, false)) &&
              (WeekEndTool.IsWeekend(prog.StartTime.DayOfWeek)))
          {
            Schedule recNew = rec.Clone();
            recNew.ScheduleType = (int)ScheduleRecordingType.Once;
            recNew.StartTime = prog.StartTime;
            recNew.EndTime = prog.EndTime;
            recNew.Series = true;

            if (rec.IsSerieIsCanceled(recNew.StartTime))
            {
              recNew.Canceled = recNew.StartTime;
            }
            recordings.Add(recNew);
          }
        }
//.........这里部分代码省略.........
开发者ID:sekotin,项目名称:MediaPortal-1,代码行数:101,代码来源:BusinessLayer.cs

示例4: getWeeklyEveryTimeOnThisChannelSchedules

    /// <summary>
    /// Gets the Weekly every time on this channel schedules.
    /// </summary>
    /// <param name="schedulesList">The schedules list.</param>
    /// <returns></returns>
    private void getWeeklyEveryTimeOnThisChannelSchedules(IList<Schedule> schedulesList, IList<Schedule> refFillList)
    {
      TvBusinessLayer layer = new TvBusinessLayer();
      foreach (Schedule schedule in schedulesList)
      {
        ScheduleRecordingType scheduleType = (ScheduleRecordingType)schedule.ScheduleType;
        if (schedule.Canceled != Schedule.MinSchedule) continue;
        if (scheduleType != ScheduleRecordingType.WeeklyEveryTimeOnThisChannel) continue;
        Channel channel = Channel.Retrieve(schedule.IdChannel);
        IList<Program> programsList = layer.SearchMinimalPrograms(DateTime.Now, DateTime.Now.AddMonths(1),
                                                                  schedule.ProgramName, channel);
        if (programsList != null)
        {
          foreach (Program program in programsList)
          {
            if (program.StartTime.DayOfWeek == schedule.StartTime.DayOfWeek)
            {
              Schedule incomingSchedule = schedule.Clone();
              incomingSchedule.IdChannel = program.IdChannel;
              incomingSchedule.ProgramName = program.Title;
              incomingSchedule.StartTime = program.StartTime;
              incomingSchedule.EndTime = program.EndTime;

              incomingSchedule.PreRecordInterval = schedule.PreRecordInterval;
              incomingSchedule.PostRecordInterval = schedule.PostRecordInterval;
              refFillList.Add(incomingSchedule);
            }
          }
        } //foreach (Program _program in _programsList)
      } //foreach (Schedule _Schedule in schedulesList)
      layer = null;
      foreach (Schedule sched in refFillList) schedulesList.Remove(sched);
    }
开发者ID:Eddie-Jee,项目名称:MediaPortal-1,代码行数:38,代码来源:ConflictsManager.cs


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