# HG changeset patch # User Brad Greco # Date 1560718514 14400 # Node ID 2342e9459444ae398b76c37dfda6972b4521bf96 # Parent 88ca7e4fc0233016b91d94075f24ffbb8c5893ff Fix schedule times not being saved. diff -r 88ca7e4fc023 -r 2342e9459444 ServerMonitor/Objects/Schedule.cs --- a/ServerMonitor/Objects/Schedule.cs Sun Jun 16 16:54:46 2019 -0400 +++ b/ServerMonitor/Objects/Schedule.cs Sun Jun 16 16:55:14 2019 -0400 @@ -1,4 +1,6 @@ using System; +using System.ComponentModel; +using System.Xml.Serialization; namespace ServerMonitorApp { @@ -33,11 +35,29 @@ public FrequencyUnits Units { get; set; } /// Time of day the check should begin running. + [XmlIgnore] public TimeSpan StartTime { get; set; } /// Time of day the check should stop running. + [XmlIgnore] public TimeSpan EndTime { get; set; } + /// Property to serialize StartTime since serializing a TimeSpan does not work by default. + [Browsable(false), EditorBrowsable(EditorBrowsableState.Never)] + public long StartTimeTicks + { + get { return StartTime.Ticks; } + set { StartTime = new TimeSpan(value); } + } + + /// Property to serialize EndTime since serializing a TimeSpan does not work by default. + [Browsable(false), EditorBrowsable(EditorBrowsableState.Never)] + public long EndTimeTicks + { + get { return EndTime.Ticks; } + set { EndTime = new TimeSpan(value); } + } + /// Given the last time a check was scheduled to run, calculates the next time in the future it should run. /// The last time a check was scheduled to run. public DateTime GetNextTime(DateTime lastScheduledTime)