/// <summary> /// Mark the hours that have been selected /// </summary> /// <param name="hours"></param> /// <param name="logonTime"></param> private static void MarkHours(bool[] hours, LogonTime logonTime) { // hour offset, from GMT var offset = logonTime.TimeZoneOffSet; // day offset in the array var dayOffset = (int)logonTime.DayOfWeek * 24; // iterate through each of the hours of the day for (int i = 0; i < 24; i++) { // is the hour between what we're looking for if (logonTime.BeginTime.Hour <= i && i < logonTime.EndTime.Hour) { // figure out which location to mark var index = dayOffset + i + offset; if (index < 0) { index = hours.Count() + index; } else if (index > hours.Count()) { index = index - hours.Count(); } hours[index] = true; } } }
/// <summary> /// Mark the hours that have been selected /// </summary> /// <param name="hours"></param> /// <param name="logonTime"></param> private static void MarkHours(bool[] hours, LogonTime logonTime) { // hour offset, from GMT var offset = logonTime.TimeZoneOffSet; // day offset in the array var dayOffset = (int) logonTime.DayOfWeek*24; // iterate through each of the hours of the day for (int i = 0; i < 24; i++) { // is the hour between what we're looking for if (logonTime.BeginTime.Hour <= i && i < logonTime.EndTime.Hour) { // figure out which location to mark var index = dayOffset + i + offset; if (index < 0) { index = hours.Count() + index; } else if (index > hours.Count()) { index = index - hours.Count(); } hours[index] = true; } } }