public Recurrence(RecurrenceType type, uint value) { if (type == RecurrenceType.Single && value != 0) { throw new ArgumentException( $"Type is {type.ToString()}, so value cannot be {value}."); } this.type = type; this.value = value; }
public static string GetRecurrenceMessage(RecurrenceType type, int hours) { string message = string.Empty; switch (type) { case RecurrenceType.Hourly: { message = string.Format("Every {0} hour(s)", hours); break; } case RecurrenceType.Daily: case RecurrenceType.Weekly: case RecurrenceType.Monthly: { message = type.ToString(); break; } } return(message); }