comparison ServerMonitor/Objects/Schedule.cs @ 32:2342e9459444

Fix schedule times not being saved.
author Brad Greco <brad@bgreco.net>
date Sun, 16 Jun 2019 16:55:14 -0400
parents 68d7834dc28e
children 7645122aa7a9
comparison
equal deleted inserted replaced
31:88ca7e4fc023 32:2342e9459444
1 using System; 1 using System;
2 using System.ComponentModel;
3 using System.Xml.Serialization;
2 4
3 namespace ServerMonitorApp 5 namespace ServerMonitorApp
4 { 6 {
5 /// <summary>Schedule to control when a check is automatically executed.<summary> 7 /// <summary>Schedule to control when a check is automatically executed.<summary>
6 public class Schedule 8 public class Schedule
31 33
32 /// <summary>The time units used to interpret the frequency.</summary> 34 /// <summary>The time units used to interpret the frequency.</summary>
33 public FrequencyUnits Units { get; set; } 35 public FrequencyUnits Units { get; set; }
34 36
35 /// <summary>Time of day the check should begin running.</summary> 37 /// <summary>Time of day the check should begin running.</summary>
38 [XmlIgnore]
36 public TimeSpan StartTime { get; set; } 39 public TimeSpan StartTime { get; set; }
37 40
38 /// <summary>Time of day the check should stop running.</summary> 41 /// <summary>Time of day the check should stop running.</summary>
42 [XmlIgnore]
39 public TimeSpan EndTime { get; set; } 43 public TimeSpan EndTime { get; set; }
44
45 /// <summary>Property to serialize StartTime since serializing a TimeSpan does not work by default.</summary>
46 [Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
47 public long StartTimeTicks
48 {
49 get { return StartTime.Ticks; }
50 set { StartTime = new TimeSpan(value); }
51 }
52
53 /// <summary>Property to serialize EndTime since serializing a TimeSpan does not work by default.</summary>
54 [Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
55 public long EndTimeTicks
56 {
57 get { return EndTime.Ticks; }
58 set { EndTime = new TimeSpan(value); }
59 }
40 60
41 /// <summary>Given the last time a check was scheduled to run, calculates the next time in the future it should run.</summary> 61 /// <summary>Given the last time a check was scheduled to run, calculates the next time in the future it should run.</summary>
42 /// <param name="lastScheduledTime">The last time a check was scheduled to run.</param> 62 /// <param name="lastScheduledTime">The last time a check was scheduled to run.</param>
43 public DateTime GetNextTime(DateTime lastScheduledTime) 63 public DateTime GetNextTime(DateTime lastScheduledTime)
44 { 64 {