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


C# Schedule.IsOverlapping方法代码示例

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


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

示例1: AssignSchedulesToCard

    private static bool AssignSchedulesToCard(Schedule schedule, List<Schedule>[] cardSchedules,
                                              out List<Schedule> overlappingSchedules)
    {
      overlappingSchedules = new List<Schedule>();
      Log.Info("AssignSchedulesToCard: schedule = " + schedule);
      IList<Card> cards = Card.ListAll();
      bool assigned = false;
      int count = 0;
      foreach (Card card in cards)
      {
        if (card.Enabled && card.canViewTvChannel(schedule.IdChannel))
        {
          // checks if any schedule assigned to this cards overlaps current parsed schedule
          bool free = true;
          foreach (Schedule assignedSchedule in cardSchedules[count])
          {
            Log.Info("AssignSchedulesToCard: card {0}, ID = {1} has schedule = " + assignedSchedule, count, card.IdCard);
            bool hasOverlappingSchedule = schedule.IsOverlapping(assignedSchedule);
            if (hasOverlappingSchedule)
            {
              bool isSameTransponder = (schedule.isSameTransponder(assignedSchedule) && card.supportSubChannels);
              if (!isSameTransponder)
              {
                overlappingSchedules.Add(assignedSchedule);
                Log.Info("AssignSchedulesToCard: overlapping with " + assignedSchedule + " on card {0}, ID = {1}", count,
                         card.IdCard);
                free = false;
                break;
              }
            }
          }
          if (free)
          {
            Log.Info("AssignSchedulesToCard: free on card {0}, ID = {1}", count, card.IdCard);
            cardSchedules[count].Add(schedule);                                                
            assigned = true;
            break;
          }
        }
        count++;
      }
      if (!assigned)
      {
        return false;
      }

      return true;
    }
开发者ID:sekotin,项目名称:MediaPortal-1,代码行数:48,代码来源:BusinessLayer.cs

示例2: AssignSchedulesToCard

      //-------------------------------------------------------------------------------------------------------------        
      // assigns a single schedule to the card
      //------------------------------------------------------------------------------------------------------------- 
      private static bool AssignSchedulesToCard(Schedule schedule, List<Schedule>[] cardSchedules, out Schedule overlappingSchedule,bool Debug)
      {
          overlappingSchedule = null;
          //if (Debug==true)
          //    Log.Debug("AssignSchedulesToCard: schedule = " + schedule.ToString());


#if(TV100)
          IList cards = Card.ListAll();
#elif(TV101 || TV11 || TV12)
          IList<Card> cards = Card.ListAll();
#endif

          bool assigned = false;
          int count = 0;
          foreach (Card card in cards)
          {
              //if (Debug == true)
              //  Log.Debug("Working on card: "+card.IdCard.ToString()+" ID Channel="+schedule.IdChannel.ToString());
              if (card.canViewTvChannel(schedule.IdChannel))
              {
                  // checks if any schedule assigned to this cards overlaps current parsed schedule
                  bool free = true;
                 // if (Debug == true)
                 //   Log.Debug("card can view channel - free=true");
                  foreach (Schedule assignedSchedule in cardSchedules[count])
                  {
                      //if (Debug == true)
                      //    Log.Debug("AssignSchedulesToCard: card {0}, ID = {1} has schedule = " + assignedSchedule, count, card.IdCard);
                      if (schedule.IsOverlapping(assignedSchedule))
                      {
                          //if (Debug == true)
                          //    Log.Debug("schedule is overlapping - checking same transponder");

                          if (!(schedule.isSameTransponder(assignedSchedule) && card.supportSubChannels))
                          {
                              overlappingSchedule = assignedSchedule;
                              if (Debug == true)
                                  Log.Debug("AssignSchedulesToCard: overlapping with " + assignedSchedule + " on card {0}, ID = {1}", card.IdCard);
                              free = false;
                              break;
                          }

                      }
                  }
                  if (free)
                  {
                      if (Debug == true)
                          Log.Debug("AssignSchedulesToCard: free on card "+count.ToString()+", ID = "+ card.IdCard.ToString());
                      cardSchedules[count].Add(schedule);
                      assigned = true;
                      break;
                  }
              }
              count++;
          }
          if (!assigned)
          {
              return false;
          }

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


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