本文整理汇总了C#中Occurrence类的典型用法代码示例。如果您正苦于以下问题:C# Occurrence类的具体用法?C# Occurrence怎么用?C# Occurrence使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Occurrence类属于命名空间,在下文中一共展示了Occurrence类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Group
public Group(Group parent)
{
Parent = parent;
Members = new ArrayList();
this.GroupType = GroupType.None;
Occurrence = Occurrence.Required;
}
示例2: Group
/// <summary>
/// Initialises a new Content Model Group.
/// </summary>
/// <param name = "parent">The parent model group.</param>
public Group(Group parent)
{
m_parent = parent;
Members = new ArrayList();
m_groupType = GroupType.None;
m_occurrence = Occurrence.Required;
}
示例3: CheckAllOccurrencesDestinationSlots
private bool CheckAllOccurrencesDestinationSlots(Occurrence currentOccurrence, Slot currentDestinationSlot, Occurrence editedOccurrence)
{
var currentApp = currentOccurrence.Appointment as Appointment;
var offsetOfTheOccurrence = currentApp.Start - currentOccurrence.Start;
var destSlotOfMasterApp = OffsetSlot(currentDestinationSlot, offsetOfTheOccurrence);
var occurrences = currentApp.GetOccurrences(scheduleView.VisibleRange.Start, scheduleView.VisibleRange.End);
destinationSlot = null;
foreach (var occ in occurrences)
{
var occurrenceDestinationSlot = OffsetSlot(destSlotOfMasterApp, occ.Start - currentApp.Start);
var appsInOccurrenceDestinationSlot = scheduleView.AppointmentsSource
.OfType<IAppointment>()
.Where((IAppointment a) => a != occ.Appointment)
.All((IAppointment a) => !ConflictChecking.AreOverlapping(a, occurrenceDestinationSlot, editedOccurrence));
if (!appsInOccurrenceDestinationSlot)
{
ShowErrorWindow();
return true;
}
}
return false;
}
示例4: Group
/// <summary>
/// Initializes a new Content Model Group.
/// </summary>
/// <param name="parent">The parent model group.</param>
public Group(Group parent)
{
_parent = parent;
_members = new ArrayList();
_type = GroupType.None;
_occurrence = Occurrence.Required;
}
示例5: AreOverlapping
public static bool AreOverlapping(IAppointment appointment, Slot slot, Occurrence draggedOccurrence)
{
//check whether the dragged appointment goes over an appointment or an occurrence
if (appointment.RecurrenceRule == null)
return (appointment.IntersectsWith(slot) && AreIntersected(appointment.Resources.OfType<IResource>(), slot.Resources.OfType<IResource>()));
else
return CheckOccurrences(appointment, slot, draggedOccurrence);
}
示例6: CheckOccurrences
public static bool CheckOccurrences(IAppointment app, Slot slot, Occurrence draggedOccurrence)
{
var occurrences = app.GetOccurrences(slot.Start, slot.End).Where(p => !p.Equals(draggedOccurrence));
var realOccurrences = new List<Occurrence>();
foreach (var occ in occurrences)
{
if (occurrences != null)
{
if (occ.IntersectsWith(slot) && AreIntersected(occ.Appointment.Resources.OfType<IResource>(), slot.Resources.OfType<IResource>()))
{
realOccurrences.Add(occ);
}
}
}
return realOccurrences.Count() > 0;
}
示例7: GetEventString
private string GetEventString(Occurrence o, IEvent evt)
{
// Get a string that represents our event
string summary = o.Period.StartTime.ToString("d") + " - " + evt.Summary;
if (evt.IsAllDay)
summary += " (All Day)";
else
{
string startTime = _ConvertToLocalTime ?
o.Period.StartTime.Local.ToString("t") :
o.Period.StartTime.ToString("t") + " " + o.Period.StartTime.TimeZoneName;
string endTime = _ConvertToLocalTime ?
o.Period.EndTime.Local.ToString("t") :
o.Period.EndTime.ToString("t") + " " + o.Period.EndTime.TimeZoneName;
summary += " (" + startTime + " to " + endTime + ")";
}
return summary;
}
示例8: Task
/// <summary>
/// Creates a new task for the <see cref="TaskScheduler"/> with a time-based <see cref="Schedule"/>.
/// </summary>
/// <param name="owner">specifies the owner of this task.</param>
/// <param name="minute">specifies at which minute this task should run (-1 = every minute).</param>
/// <param name="hour">specifies at which hour this task should run (-1 = every hour).</param>
/// <param name="day">specifies at which day of the week this task should run (-1 = every day).</param>
/// <param name="occurrence">specifies when the task's schedule should occur.</param>
/// <param name="expires">specifies when the task's schedule should expire.</param>
/// <param name="forceRun">specifies whether a schedule should be triggered forcefully in case system was down when schedule was due (true).</param>
/// <param name="wakeup">specifies whether the system should be woken up from standby for this task's schedule (false).</param>
public Task(string owner, int minute, int hour, int day, Occurrence occurrence, DateTime expires, bool forceRun, bool wakeup)
{
_owner = owner;
_schedule.Minute = minute;
_schedule.Hour = hour;
_schedule.Day = day;
_schedule.Type = ScheduleType.TimeBased;
_occurrence = occurrence;
_expires = expires;
_forceRun = forceRun;
if (wakeup && (occurrence == Occurrence.EveryStartUp || occurrence == Occurrence.EveryWakeUp))
throw new ArgumentException("wakeup setting cannot be used together with Occurrence " + _occurrence);
_wakeup = wakeup;
}
示例9: GetOccurrences
/// <summary>
/// Gets the occurrences.
/// </summary>
/// <param name="startTime">The start time.</param>
/// <param name="endTime">The end time.</param>
/// <remarks> Вычисляет все экземпляры рекурсивного события в соотв с паттерном рекурсии. С учетом exception event.
/// </remarks>
/// <returns></returns>
public override List<Occurrence> GetOccurrences(iCalDateTime startTime, iCalDateTime endTime)
{
//Очищаем кеш повторений
ClearEvaluation();
List<Occurrence> retVal = base.GetOccurrences(startTime, endTime);
if(RecurrenceException != null)
{
foreach (McEvent exception in RecurrenceException)
{
if (exception.Recurrence_ID != null)
{
//Start = RecurrenceId, Duration = Parent event duration
Occurrence exceptionOccur = new Occurrence(null, new Period(exception.Recurrence_ID, this.Duration));
//remove exception from orig occurrences list
if (retVal.Contains(exceptionOccur))
{
retVal.Remove(exceptionOccur);
}
}
}
}
return retVal;
}
示例10: GetOccurrenceText
/// <summary>
/// Gets the occurrence text.
/// </summary>
/// <param name="occurrence">The occurrence.</param>
/// <returns></returns>
private static string GetOccurrenceText( Occurrence occurrence )
{
string occurrenceText = string.Empty;
if ( occurrence.Period.Duration <= new TimeSpan( 0, 0, 1 ) )
{
// no or very short duration. Probably a schedule for starting something that doesn't care about duration, like Metrics
occurrenceText = string.Format( "{0}", occurrence.Period.StartTime.Value.ToString( "g" ) );
}
else if ( occurrence.Period.StartTime.Value.Date.Equals( occurrence.Period.EndTime.Value.Date ) )
{
// same day for start and end time
occurrenceText = string.Format( "{0} - {1} to {2} ( {3} hours) ", occurrence.Period.StartTime.Value.Date.ToShortDateString(), occurrence.Period.StartTime.Value.TimeOfDay.ToTimeString(), occurrence.Period.EndTime.Value.TimeOfDay.ToTimeString(), occurrence.Period.Duration.TotalHours.ToString( "#0.00" ) );
}
else
{
// spans over midnight
occurrenceText = string.Format( "{0} to {1} ( {2} hours) ", occurrence.Period.StartTime.Value.ToString( "g" ), occurrence.Period.EndTime.Value.ToString( "g" ), occurrence.Period.Duration.TotalHours.ToString( "#0.00" ) );
}
return occurrenceText;
}
示例11: WriteOccurrence
public virtual void WriteOccurrence(Occurrence toSave)
{
var lines = new[]{toSave.AsWriteable() };
Paths.AppendAllLines(this.OccurrencesPath,lines);
}
示例12: IsOccurrenceOf
public static bool IsOccurrenceOf(this DateTime date, DayOfWeek day, Occurrence occurrence)
{
if (day != date.DayOfWeek)
{
return false;
}
try
{
var compare = date.AddMonths(-1).GetOccurrenceOfNextMonth(day, occurrence);
return compare.Date == date.Date;
}
catch
{
return false;
}
}
示例13: Group
public Group(Group parent)
{
Parent = parent;
this.GroupType = GroupType.None;
Occurrence = Occurrence.Required;
this.members = new ArrayList();
this.symbols = new Set<string>();
}
示例14: GetOccurrenceOfNextMonth
public static DateTime GetOccurrenceOfNextMonth(this DateTime from, DayOfWeek day, Occurrence occurrence)
{
DateTime relevantMonthEnd;
if (occurrence > 0)
{
relevantMonthEnd = from.GetFirstOfNextMonth(day);
occurrence -= 1;
}
else
{
relevantMonthEnd = from.GetLastOfNextMonth(day);
occurrence += 1;
}
MonthOfYear monthToScan = relevantMonthEnd.MonthOfYear();
DateTime foundDate = relevantMonthEnd.AddWeeks((int)occurrence);
if (foundDate.MonthOfYear() == monthToScan)
{
return foundDate;
}
string errorMessage = String.Format("Cannot get the {0} {1} of {2}", occurrence, day, monthToScan);
throw new ArgumentOutOfRangeException(errorMessage);
}
示例15: GetNearestOccurrence
public static DateTime GetNearestOccurrence(this DateTime from, DayOfWeek day, Occurrence occurrence)
{
var nextSuitableDate = from.GetOccurrenceOfNextMonth(day, occurrence);
var previousSuitableDate = from.AddMonths(-1).GetOccurrenceOfNextMonth(day, occurrence);
return CalculateClosest(previousSuitableDate, from, nextSuitableDate);
}