本文整理汇总了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;
}
示例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;
}