本文整理汇总了C#中My24HourTimerWPF.TimeLine.IsDateTimeWithin方法的典型用法代码示例。如果您正苦于以下问题:C# TimeLine.IsDateTimeWithin方法的具体用法?C# TimeLine.IsDateTimeWithin怎么用?C# TimeLine.IsDateTimeWithin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类My24HourTimerWPF.TimeLine
的用法示例。
在下文中一共展示了TimeLine.IsDateTimeWithin方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: getOnlyPertinentTimeFrame
public List<TimeLine> getOnlyPertinentTimeFrame(TimeLine[] ArraytOfFreeSpots, TimeLine myTimeLine)
{
/*
* Name: Jerome Biotidara
* Description: Function only takes a TImeLine and Array Of TimeLine FreeSpots. It returns a List Of TimeLine In whcih each elements exist within the range of TimeLine
*/
List<TimeLine> PertinentTimeLine = new List<TimeLine>();
List<TimeLine> OutLiers = new List<TimeLine>();
foreach (TimeLine MyFreeTimeLine in ArraytOfFreeSpots)
{
if (myTimeLine.IsTimeLineWithin(MyFreeTimeLine))
{
PertinentTimeLine.Add(MyFreeTimeLine);
}
else
{
OutLiers.Add(MyFreeTimeLine);
}
}
foreach (TimeLine Outlier in OutLiers)//this can be embedded in the preceeding foreach loop above in the else branch
{
if (myTimeLine.IsDateTimeWithin(Outlier.Start))
{
PertinentTimeLine.Add(new TimeLine(Outlier.Start, myTimeLine.End));
}
else
{
if (myTimeLine.IsDateTimeWithin(Outlier.End))
{
PertinentTimeLine.Add(new TimeLine(myTimeLine.Start, Outlier.End));
}
else
{
if (Outlier.IsTimeLineWithin(myTimeLine))
{
PertinentTimeLine.Add(Outlier);
}
}
}
}
return PertinentTimeLine;
//return new List<TimeLine>();
}
示例2: PinToEnd
virtual public TimeLine PinToEnd(TimeLine MyTimeLine, List<SubCalendarEvent> MySubCalendarEventList)
{
/*
*Name: Jerome Biotidara
*Description: This funciton is only called when the Timeline can fit the total timeline ovcupied by the Subcalendarevent. essentially it tries to pin itself to the last available spot
*/
TimeSpan SubCalendarTimeSpan = new TimeSpan();
foreach (SubCalendarEvent MySubCalendarEvent in MySubCalendarEventList)
{
SubCalendarTimeSpan.Add(MySubCalendarEvent.ActiveSlot.BusyTimeSpan);// you might be able to combine the implementing for lopp with this in order to avoid several loops
}
if (SubCalendarTimeSpan > MyTimeLine.TimelineSpan)
{
throw new Exception("Oh oh check PinSubEventsToEnd Subcalendar is longer than timeline");
}
if (!MyTimeLine.IsDateTimeWithin(Start))
{
throw new Exception("Oh oh Calendar event isn't within Timeline range. Check PinSubEventsToEnd :(");
}
DateTime ReferenceTime = new DateTime();
if (End > MyTimeLine.End)
{
ReferenceTime = MyTimeLine.End;
}
else
{
ReferenceTime = End;
}
List<BusyTimeLine> MyActiveSlot = new List<BusyTimeLine>();
foreach (SubCalendarEvent MySubCalendarEvent in MySubCalendarEventList)
{
MySubCalendarEvent.PinToEndAndIncludeInTimeLine(MyTimeLine, this);//hack you need to handle cases where you cant shift subcalevent
}
return MyTimeLine;
}
示例3: stitchUnRestrictedSubCalendarEvent
List<mTuple<bool, SubCalendarEvent>> stitchUnRestrictedSubCalendarEvent(TimeLine FreeBoundary, List<mTuple<bool, SubCalendarEvent>> restrictedSnugFitAvailable, Dictionary<TimeSpan, Dictionary<string, mTuple<bool, SubCalendarEvent>>> PossibleEntries, Dictionary<TimeSpan, mTuple<int, TimeSpanWithStringID>> CompatibleWithList,double Occupancy)
{
TimeLine[] AllFreeSpots = FreeBoundary.getAllFreeSlots();
int TotalEventsForThisTImeLine = 0;
foreach (KeyValuePair<TimeSpan, mTuple<int, TimeSpanWithStringID>> eachKeyValuePair in CompatibleWithList)
{
TotalEventsForThisTImeLine += eachKeyValuePair.Value.Item1;
}
CompatibleWithList.Clear();
DateTime EarliestReferenceTIme = FreeBoundary.Start;
List<mTuple<bool, SubCalendarEvent>> FrontPartials = new System.Collections.Generic.List<mTuple<bool, SubCalendarEvent>>();
List<mTuple<bool, SubCalendarEvent>> EndPartials = new System.Collections.Generic.List<mTuple<bool, SubCalendarEvent>>();
Dictionary<DateTime, List<mTuple<bool, SubCalendarEvent>>> FrontPartials_Dict = new System.Collections.Generic.Dictionary<DateTime, System.Collections.Generic.List<mTuple<bool, SubCalendarEvent>>>();
Dictionary<DateTime, List<mTuple<bool, SubCalendarEvent>>> EndPartials_Dict = new System.Collections.Generic.Dictionary<DateTime, System.Collections.Generic.List<mTuple<bool, SubCalendarEvent>>>();
Dictionary<TimeSpan, Dictionary<string, mTuple<bool, SubCalendarEvent>>> PossibleEntries_Cpy = new Dictionary<TimeSpan, Dictionary<string, mTuple<bool, SubCalendarEvent>>>();
Dictionary<string, Dictionary<string, SubCalendarEvent>> CalendarIDAndNonPartialSubCalEvents = new Dictionary<string, Dictionary<string, SubCalendarEvent>>();//List of non partials for current Reference StartTime To End of FreeBoundary. Its gets updated with Partials once the earliest reference time passes the partial event start time
foreach (KeyValuePair<TimeSpan, Dictionary<string, mTuple<bool, SubCalendarEvent>>> eachKeyValuePair in PossibleEntries)//populates PossibleEntries_Cpy. I need a copy to maintain all references to PossibleEntries
{
Dictionary<string, mTuple<bool, SubCalendarEvent>> NewDictEntry = new Dictionary<string, mTuple<bool, SubCalendarEvent>>();
foreach (KeyValuePair<string, mTuple<bool, SubCalendarEvent>> KeyValuePair0 in eachKeyValuePair.Value)
{
mTuple<bool, SubCalendarEvent> MyEvent = KeyValuePair0.Value;
if (MyEvent.Item2.ID == "469_471")
{
;
}
bool isInrestrictedSnugFitAvailable = false;
if (CompatibleWithList.ContainsKey(eachKeyValuePair.Key))
{
++CompatibleWithList[eachKeyValuePair.Key].Item1;
}
else
{
CompatibleWithList.Add(eachKeyValuePair.Key, new mTuple<int, TimeSpanWithStringID>(1, new TimeSpanWithStringID(KeyValuePair0.Value.Item2.ActiveDuration, KeyValuePair0.Value.Item2.ActiveDuration.Ticks.ToString())));
}
foreach (mTuple<bool, SubCalendarEvent> eachMtuple in restrictedSnugFitAvailable)//checks if event is in restricted list
{
if (eachMtuple.Item2.ID == MyEvent.Item2.ID)
{
isInrestrictedSnugFitAvailable = true;
break;
}
}
if (!isInrestrictedSnugFitAvailable)
{
NewDictEntry.Add(KeyValuePair0.Value.Item2.ID, KeyValuePair0.Value);
if (FreeBoundary.IsDateTimeWithin(KeyValuePair0.Value.Item2.getCalendarEventRange.Start))
{
FrontPartials.Add(KeyValuePair0.Value);
}
else
{
if (FreeBoundary.IsDateTimeWithin(KeyValuePair0.Value.Item2.getCalendarEventRange.End))
{
EndPartials.Add(KeyValuePair0.Value);
}
else
{
string CalLevel0ID=KeyValuePair0.Value.Item2.SubEvent_ID.getLevelID(0);
if (CalendarIDAndNonPartialSubCalEvents.ContainsKey(CalLevel0ID))
{
CalendarIDAndNonPartialSubCalEvents[CalLevel0ID].Add(KeyValuePair0.Value.Item2.ID, KeyValuePair0.Value.Item2);
}
else
{
//CalendarIDAndNonPartialSubCalEvents.Add(CalLevel0ID, new List<SubCalendarEvent>() { KeyValuePair0.Value.Item2 });
CalendarIDAndNonPartialSubCalEvents.Add(CalLevel0ID, new Dictionary<string, SubCalendarEvent>());
CalendarIDAndNonPartialSubCalEvents[CalLevel0ID].Add(KeyValuePair0.Value.Item2.ID, KeyValuePair0.Value.Item2);
}
}
}
}
}
if (NewDictEntry.Count > 0)
{ PossibleEntries_Cpy.Add(eachKeyValuePair.Key, NewDictEntry); }
}
FrontPartials = FrontPartials.OrderBy(obj => obj.Item2.getCalendarEventRange.Start).ToList();
EndPartials = EndPartials.OrderBy(obj => obj.Item2.getCalendarEventRange.End).ToList();
foreach (mTuple<bool, SubCalendarEvent> eachmTuple in FrontPartials)//populates FrontPartials_Dict in ordered manner since FrontPartials is ordered
{
if (FrontPartials_Dict.ContainsKey(eachmTuple.Item2.getCalendarEventRange.Start))
{
FrontPartials_Dict[eachmTuple.Item2.getCalendarEventRange.Start].Add(eachmTuple);
}
//.........这里部分代码省略.........