public LinearRectangleZone(double left, double top, double right, double bottom) : base(left, top, right, bottom) { m_startPosition = ZonePosition.TopLeft; m_direction = ZoneDirection.Horizontal; m_stepX = 1; m_stepY = 1; Init(); }
public LinearRectangleZone(double left, double top, double right, double bottom, ZonePosition startPosition, ZoneDirection direction) : base(left, top, right, bottom) { m_startPosition = startPosition; m_direction = direction; m_stepX = 1; m_stepY = 1; Init(); }
/// <summary> /// The constructor creates a LinearRectangleZone zone. /// </summary> /// <param name="left">The left coordinate of the rectangle defining the region of the zone.</param> /// <param name="top">The top coordinate of the rectangle defining the region of the zone.</param> /// <param name="right">The right coordinate of the rectangle defining the region of the zone.</param> /// <param name="bottom">The bottom coordinate of the rectangle defining the region of the zone.</param> /// <param name="start">The position in the zone to start getting locations - may be any corner /// of the rectangle.</param> /// <param name="direction">The direction to advance first. If ZoneDirection.Horizontal, the locations /// advance horizontally across the zone, moving vertically when wrapping around at the end. If /// ZoneDirection.Vertical, the locations advance vertically up/down the zone, moving horizontally /// when wrapping around at the top/bottom.</param> /// <param name="horizontalStep"></param> /// <param name="verticalStep"></param> public LinearRectangleZone(double left, double top, double right, double bottom, ZonePosition start, ZoneDirection direction, double horizontalStep, double verticalStep) : base(left, top, right, bottom) { m_startPosition = start; m_direction = direction; m_stepX = Math.Abs(horizontalStep); m_stepY = Math.Abs(verticalStep); Init(); }
public DateTime GetCurrentTime(ZoneDirection direction, DateTime now) { DateTime currentTime; var daysToChange = (now.DayOfWeek - _DayOfWeek) % 7 * -1; if (direction == ZoneDirection.After) { daysToChange = (_DayOfWeek - now.DayOfWeek + 7) % 7; } else { daysToChange = -(now.DayOfWeek - _DayOfWeek) % 7; } currentTime = now.AddDays(daysToChange).Date.Add(Time); if (direction == ZoneDirection.After && currentTime < now) { currentTime = currentTime.AddDays(7); } return(currentTime); }