public override Span GetOffset(Span span, int amount, Pointer.Type pointer) { var direction = (int)pointer; var newBegin = BuildOffsetTime(span.Start.Value, amount, direction); var newEnd = BuildOffsetTime(span.End.Value, amount, direction); return new Span(newBegin, newEnd); }
protected override Span CurrentSpan(Pointer.Type pointer) { Span thisSpan; if (pointer == Pointer.Type.Future || pointer == Pointer.Type.None) { var saturdayRepeater = new RepeaterDayName(DayOfWeek.Saturday); saturdayRepeater.Now = Now; var thisSaturdaySpan = saturdayRepeater.GetNextSpan(Pointer.Type.Future); thisSpan = new Span( thisSaturdaySpan.Start.Value, thisSaturdaySpan.Start.Value.AddSeconds(WEEKEND_SECONDS)); } else if (pointer == Pointer.Type.Past) { var saturdayRepeater = new RepeaterDayName(DayOfWeek.Saturday); saturdayRepeater.Now = Now; var lastSaturdaySpan = saturdayRepeater.GetNextSpan(Pointer.Type.Past); thisSpan = new Span( lastSaturdaySpan.Start.Value, lastSaturdaySpan.Start.Value.AddSeconds(RepeaterWeekend.WEEKEND_SECONDS)); } else { throw new ArgumentException("Unable to handle pointer " + pointer + ".", "pointer"); } return thisSpan; }
public override Span GetOffset(Span span, int amount, Pointer.Type pointer) { int direction = (pointer == Pointer.Type.Future) ? 1 : -1; return new Span( span.Start.Value.AddMonths(amount * direction), span.End.Value.AddMonths(amount * direction) ); }
public override Span GetOffset(Span span, int amount, Pointer.Type pointer) { var direction = (pointer == Pointer.Type.Future) ? 1 : -1; var weekend = new RepeaterWeekend(); weekend.Now = span.Start; var start = weekend .GetNextSpan(pointer) .Start.Value .AddSeconds((amount - 1) * direction * RepeaterWeek.WEEK_SECONDS); return new Span(start, start.AddSeconds(span.Width)); }
protected override Span CurrentSpan(Pointer.Type pointer) { Span thisWeekSpan; DateTime thisWeekStart; DateTime thisWeekEnd; var now = Now.Value; if (pointer == Pointer.Type.Future) { thisWeekStart = Time.New(now, now.Hour).AddHours(1); var sundayRepeater = new RepeaterDayName(DayOfWeek.Sunday); sundayRepeater.Now = now; var thisSundaySpan = sundayRepeater.GetCurrentSpan(Pointer.Type.Future); thisWeekEnd = thisSundaySpan.Start.Value; thisWeekSpan = new Span(thisWeekStart, thisWeekEnd); } else if (pointer == Pointer.Type.Past) { thisWeekEnd = now; var sundayRepeater = new RepeaterDayName(DayOfWeek.Sunday); sundayRepeater.Now = now; var lastSundaySpan = sundayRepeater.GetNextSpan(Pointer.Type.Past); thisWeekStart = lastSundaySpan.Start.Value; thisWeekSpan = new Span(thisWeekStart, thisWeekEnd); } else if (pointer == Pointer.Type.None) { var sundayRepeater = new RepeaterDayName(DayOfWeek.Sunday); sundayRepeater.Now = now; Span lastSundaySpan = sundayRepeater.GetNextSpan(Pointer.Type.Past); thisWeekStart = lastSundaySpan.Start.Value; thisWeekEnd = thisWeekStart.AddDays(RepeaterWeek.WEEK_DAYS); thisWeekSpan = new Span(thisWeekStart, thisWeekEnd); } else { throw new ArgumentException("Unable to handle pointer " + pointer + ".", "pointer"); } return thisWeekSpan; }
public override Span GetOffset(Span span, int amount, Pointer.Type pointer) { int direction = (pointer == Pointer.Type.Future) ? 1 : -1; return span.Add(direction * amount * RepeaterMinute.MINUTE_SECONDS); }
public override Span GetOffset(Span span, int amount, Pointer.Type pointer) { throw new NotImplementedException(); }
public override Span GetOffset(Span span, int amount, Pointer.Type pointer) { var direction = (pointer == Pointer.Type.Future) ? 1 : -1; return span.Add(direction * amount * RepeaterWeek.WEEK_SECONDS); }