annotate 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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
3e1a2131f897 Initial commit. Ping check, scheduling, UI working. SSH check mostly working.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
1 using System;
32
2342e9459444 Fix schedule times not being saved.
Brad Greco <brad@bgreco.net>
parents: 17
diff changeset
2 using System.ComponentModel;
2342e9459444 Fix schedule times not being saved.
Brad Greco <brad@bgreco.net>
parents: 17
diff changeset
3 using System.Xml.Serialization;
0
3e1a2131f897 Initial commit. Ping check, scheduling, UI working. SSH check mostly working.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
4
3e1a2131f897 Initial commit. Ping check, scheduling, UI working. SSH check mostly working.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
5 namespace ServerMonitorApp
3e1a2131f897 Initial commit. Ping check, scheduling, UI working. SSH check mostly working.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
6 {
17
68d7834dc28e More comments.
Brad Greco <brad@bgreco.net>
parents: 12
diff changeset
7 /// <summary>Schedule to control when a check is automatically executed.<summary>
0
3e1a2131f897 Initial commit. Ping check, scheduling, UI working. SSH check mostly working.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
8 public class Schedule
3e1a2131f897 Initial commit. Ping check, scheduling, UI working. SSH check mostly working.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
9 {
17
68d7834dc28e More comments.
Brad Greco <brad@bgreco.net>
parents: 12
diff changeset
10 // Required empty constructor for XML serialization.
0
3e1a2131f897 Initial commit. Ping check, scheduling, UI working. SSH check mostly working.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
11 public Schedule() { }
3e1a2131f897 Initial commit. Ping check, scheduling, UI working. SSH check mostly working.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
12
17
68d7834dc28e More comments.
Brad Greco <brad@bgreco.net>
parents: 12
diff changeset
13 /// <summary>Schedule constructor</summary>
68d7834dc28e More comments.
Brad Greco <brad@bgreco.net>
parents: 12
diff changeset
14 /// <param name="units">The time units to use.</param>
68d7834dc28e More comments.
Brad Greco <brad@bgreco.net>
parents: 12
diff changeset
15 /// <param name="frequency">How frequently to run the check.</param>
68d7834dc28e More comments.
Brad Greco <brad@bgreco.net>
parents: 12
diff changeset
16 /// <param name="startTime">Time of day the check should begin running.</param>
68d7834dc28e More comments.
Brad Greco <brad@bgreco.net>
parents: 12
diff changeset
17 /// <param name="endTime">Time of day the check should stop running.</param>
68d7834dc28e More comments.
Brad Greco <brad@bgreco.net>
parents: 12
diff changeset
18 /// <remarks>
68d7834dc28e More comments.
Brad Greco <brad@bgreco.net>
parents: 12
diff changeset
19 /// If endTime is before startTime, then the endTime is interpreted as being on the next day.
68d7834dc28e More comments.
Brad Greco <brad@bgreco.net>
parents: 12
diff changeset
20 /// For example, if startTime = 17:00 and endTime is 8:00, then the check will start running
68d7834dc28e More comments.
Brad Greco <brad@bgreco.net>
parents: 12
diff changeset
21 /// at 17:00 and stop running at 8:00 the next day.
68d7834dc28e More comments.
Brad Greco <brad@bgreco.net>
parents: 12
diff changeset
22 /// </remarks>
0
3e1a2131f897 Initial commit. Ping check, scheduling, UI working. SSH check mostly working.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
23 public Schedule(FrequencyUnits units, int frequency, TimeSpan startTime, TimeSpan endTime)
3e1a2131f897 Initial commit. Ping check, scheduling, UI working. SSH check mostly working.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
24 {
3e1a2131f897 Initial commit. Ping check, scheduling, UI working. SSH check mostly working.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
25 Units = units;
3e1a2131f897 Initial commit. Ping check, scheduling, UI working. SSH check mostly working.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
26 Frequency = frequency;
3e1a2131f897 Initial commit. Ping check, scheduling, UI working. SSH check mostly working.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
27 StartTime = startTime;
3e1a2131f897 Initial commit. Ping check, scheduling, UI working. SSH check mostly working.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
28 EndTime = endTime;
3e1a2131f897 Initial commit. Ping check, scheduling, UI working. SSH check mostly working.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
29 }
3e1a2131f897 Initial commit. Ping check, scheduling, UI working. SSH check mostly working.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
30
17
68d7834dc28e More comments.
Brad Greco <brad@bgreco.net>
parents: 12
diff changeset
31 /// <summary>How often the check should be executed.</summary>
0
3e1a2131f897 Initial commit. Ping check, scheduling, UI working. SSH check mostly working.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
32 public int Frequency { get; set; }
3e1a2131f897 Initial commit. Ping check, scheduling, UI working. SSH check mostly working.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
33
17
68d7834dc28e More comments.
Brad Greco <brad@bgreco.net>
parents: 12
diff changeset
34 /// <summary>The time units used to interpret the frequency.</summary>
0
3e1a2131f897 Initial commit. Ping check, scheduling, UI working. SSH check mostly working.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
35 public FrequencyUnits Units { get; set; }
3e1a2131f897 Initial commit. Ping check, scheduling, UI working. SSH check mostly working.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
36
17
68d7834dc28e More comments.
Brad Greco <brad@bgreco.net>
parents: 12
diff changeset
37 /// <summary>Time of day the check should begin running.</summary>
32
2342e9459444 Fix schedule times not being saved.
Brad Greco <brad@bgreco.net>
parents: 17
diff changeset
38 [XmlIgnore]
0
3e1a2131f897 Initial commit. Ping check, scheduling, UI working. SSH check mostly working.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
39 public TimeSpan StartTime { get; set; }
3e1a2131f897 Initial commit. Ping check, scheduling, UI working. SSH check mostly working.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
40
17
68d7834dc28e More comments.
Brad Greco <brad@bgreco.net>
parents: 12
diff changeset
41 /// <summary>Time of day the check should stop running.</summary>
32
2342e9459444 Fix schedule times not being saved.
Brad Greco <brad@bgreco.net>
parents: 17
diff changeset
42 [XmlIgnore]
0
3e1a2131f897 Initial commit. Ping check, scheduling, UI working. SSH check mostly working.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
43 public TimeSpan EndTime { get; set; }
3e1a2131f897 Initial commit. Ping check, scheduling, UI working. SSH check mostly working.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
44
32
2342e9459444 Fix schedule times not being saved.
Brad Greco <brad@bgreco.net>
parents: 17
diff changeset
45 /// <summary>Property to serialize StartTime since serializing a TimeSpan does not work by default.</summary>
2342e9459444 Fix schedule times not being saved.
Brad Greco <brad@bgreco.net>
parents: 17
diff changeset
46 [Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
2342e9459444 Fix schedule times not being saved.
Brad Greco <brad@bgreco.net>
parents: 17
diff changeset
47 public long StartTimeTicks
2342e9459444 Fix schedule times not being saved.
Brad Greco <brad@bgreco.net>
parents: 17
diff changeset
48 {
2342e9459444 Fix schedule times not being saved.
Brad Greco <brad@bgreco.net>
parents: 17
diff changeset
49 get { return StartTime.Ticks; }
2342e9459444 Fix schedule times not being saved.
Brad Greco <brad@bgreco.net>
parents: 17
diff changeset
50 set { StartTime = new TimeSpan(value); }
2342e9459444 Fix schedule times not being saved.
Brad Greco <brad@bgreco.net>
parents: 17
diff changeset
51 }
2342e9459444 Fix schedule times not being saved.
Brad Greco <brad@bgreco.net>
parents: 17
diff changeset
52
2342e9459444 Fix schedule times not being saved.
Brad Greco <brad@bgreco.net>
parents: 17
diff changeset
53 /// <summary>Property to serialize EndTime since serializing a TimeSpan does not work by default.</summary>
2342e9459444 Fix schedule times not being saved.
Brad Greco <brad@bgreco.net>
parents: 17
diff changeset
54 [Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
2342e9459444 Fix schedule times not being saved.
Brad Greco <brad@bgreco.net>
parents: 17
diff changeset
55 public long EndTimeTicks
2342e9459444 Fix schedule times not being saved.
Brad Greco <brad@bgreco.net>
parents: 17
diff changeset
56 {
2342e9459444 Fix schedule times not being saved.
Brad Greco <brad@bgreco.net>
parents: 17
diff changeset
57 get { return EndTime.Ticks; }
2342e9459444 Fix schedule times not being saved.
Brad Greco <brad@bgreco.net>
parents: 17
diff changeset
58 set { EndTime = new TimeSpan(value); }
2342e9459444 Fix schedule times not being saved.
Brad Greco <brad@bgreco.net>
parents: 17
diff changeset
59 }
2342e9459444 Fix schedule times not being saved.
Brad Greco <brad@bgreco.net>
parents: 17
diff changeset
60
17
68d7834dc28e More comments.
Brad Greco <brad@bgreco.net>
parents: 12
diff changeset
61 /// <summary>Given the last time a check was scheduled to run, calculates the next time in the future it should run.</summary>
68d7834dc28e More comments.
Brad Greco <brad@bgreco.net>
parents: 12
diff changeset
62 /// <param name="lastScheduledTime">The last time a check was scheduled to run.</param>
0
3e1a2131f897 Initial commit. Ping check, scheduling, UI working. SSH check mostly working.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
63 public DateTime GetNextTime(DateTime lastScheduledTime)
3e1a2131f897 Initial commit. Ping check, scheduling, UI working. SSH check mostly working.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
64 {
3e1a2131f897 Initial commit. Ping check, scheduling, UI working. SSH check mostly working.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
65 return GetNextTime(lastScheduledTime, DateTime.Now);
3e1a2131f897 Initial commit. Ping check, scheduling, UI working. SSH check mostly working.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
66 }
3e1a2131f897 Initial commit. Ping check, scheduling, UI working. SSH check mostly working.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
67
17
68d7834dc28e More comments.
Brad Greco <brad@bgreco.net>
parents: 12
diff changeset
68 /// <summary>Given the last time a check was scheduled to run, calculates the next time after the given date it should run.</summary>
68d7834dc28e More comments.
Brad Greco <brad@bgreco.net>
parents: 12
diff changeset
69 /// <param name="lastScheduledTime">The last time a check was scheduled to run.</param>
68d7834dc28e More comments.
Brad Greco <brad@bgreco.net>
parents: 12
diff changeset
70 /// <param name="minStartTime">The earliest allowed time to return.</param>
68d7834dc28e More comments.
Brad Greco <brad@bgreco.net>
parents: 12
diff changeset
71 /// <remarks>
68d7834dc28e More comments.
Brad Greco <brad@bgreco.net>
parents: 12
diff changeset
72 /// The next execution time of a check cannot necessarily be determined by taking the
68d7834dc28e More comments.
Brad Greco <brad@bgreco.net>
parents: 12
diff changeset
73 /// last execution time and adding the configured number of time units. The computer might
68d7834dc28e More comments.
Brad Greco <brad@bgreco.net>
parents: 12
diff changeset
74 /// have been asleep or the program might have not been running, so the next date might
68d7834dc28e More comments.
Brad Greco <brad@bgreco.net>
parents: 12
diff changeset
75 /// be in the past.
68d7834dc28e More comments.
Brad Greco <brad@bgreco.net>
parents: 12
diff changeset
76 ///
68d7834dc28e More comments.
Brad Greco <brad@bgreco.net>
parents: 12
diff changeset
77 /// To best follow the schedule, we take the last execution time and fast-forward time
68d7834dc28e More comments.
Brad Greco <brad@bgreco.net>
parents: 12
diff changeset
78 /// by adding the configured time interval until we get a resulting time that is in the future.
68d7834dc28e More comments.
Brad Greco <brad@bgreco.net>
parents: 12
diff changeset
79 /// For example, suppose a check is scheduled to run every 5 minutes starting at 7:00.
68d7834dc28e More comments.
Brad Greco <brad@bgreco.net>
parents: 12
diff changeset
80 /// The check last ran at 7:40, and the computer was suspended shortly thereafter and resumed
68d7834dc28e More comments.
Brad Greco <brad@bgreco.net>
parents: 12
diff changeset
81 /// at 8:28. The next execution time is determined by adding 5 minutes to 7:40 until we obtain
68d7834dc28e More comments.
Brad Greco <brad@bgreco.net>
parents: 12
diff changeset
82 /// a time after 8:28, in this case, 8:30.
68d7834dc28e More comments.
Brad Greco <brad@bgreco.net>
parents: 12
diff changeset
83 /// </remarks>
0
3e1a2131f897 Initial commit. Ping check, scheduling, UI working. SSH check mostly working.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
84 public DateTime GetNextTime(DateTime lastScheduledTime, DateTime minStartTime)
3e1a2131f897 Initial commit. Ping check, scheduling, UI working. SSH check mostly working.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
85 {
17
68d7834dc28e More comments.
Brad Greco <brad@bgreco.net>
parents: 12
diff changeset
86 // Start by setting the next time to the last time the check was run.
0
3e1a2131f897 Initial commit. Ping check, scheduling, UI working. SSH check mostly working.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
87 DateTime nextTime = lastScheduledTime;
3e1a2131f897 Initial commit. Ping check, scheduling, UI working. SSH check mostly working.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
88 if (Units == FrequencyUnits.Day)
3e1a2131f897 Initial commit. Ping check, scheduling, UI working. SSH check mostly working.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
89 {
17
68d7834dc28e More comments.
Brad Greco <brad@bgreco.net>
parents: 12
diff changeset
90 // If the check is scheduled only once a day, simply add days until we find a time in the future.
0
3e1a2131f897 Initial commit. Ping check, scheduling, UI working. SSH check mostly working.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
91 while (nextTime < minStartTime)
3e1a2131f897 Initial commit. Ping check, scheduling, UI working. SSH check mostly working.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
92 nextTime = nextTime.AddDays(Frequency).Date.Add(StartTime);
3e1a2131f897 Initial commit. Ping check, scheduling, UI working. SSH check mostly working.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
93 }
3e1a2131f897 Initial commit. Ping check, scheduling, UI working. SSH check mostly working.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
94 else
3e1a2131f897 Initial commit. Ping check, scheduling, UI working. SSH check mostly working.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
95 {
17
68d7834dc28e More comments.
Brad Greco <brad@bgreco.net>
parents: 12
diff changeset
96 // If the last run time was more than a day ago, fast-forward a day at a time to reduce the number of loops.
0
3e1a2131f897 Initial commit. Ping check, scheduling, UI working. SSH check mostly working.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
97 if (nextTime < minStartTime.AddHours(-24))
3e1a2131f897 Initial commit. Ping check, scheduling, UI working. SSH check mostly working.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
98 nextTime = minStartTime.Date.Add(StartTime).AddHours(-24);
17
68d7834dc28e More comments.
Brad Greco <brad@bgreco.net>
parents: 12
diff changeset
99 // Add the configured time interval to the last run time until we obtain a time in the future.
0
3e1a2131f897 Initial commit. Ping check, scheduling, UI working. SSH check mostly working.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
100 while (nextTime < minStartTime)
3e1a2131f897 Initial commit. Ping check, scheduling, UI working. SSH check mostly working.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
101 {
3e1a2131f897 Initial commit. Ping check, scheduling, UI working. SSH check mostly working.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
102 switch (Units)
3e1a2131f897 Initial commit. Ping check, scheduling, UI working. SSH check mostly working.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
103 {
3e1a2131f897 Initial commit. Ping check, scheduling, UI working. SSH check mostly working.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
104 case FrequencyUnits.Second: nextTime = nextTime.AddSeconds(Frequency); break;
3e1a2131f897 Initial commit. Ping check, scheduling, UI working. SSH check mostly working.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
105 case FrequencyUnits.Minute: nextTime = nextTime.AddMinutes(Frequency); break;
3e1a2131f897 Initial commit. Ping check, scheduling, UI working. SSH check mostly working.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
106 case FrequencyUnits.Hour: nextTime = nextTime.AddHours(Frequency); break;
3e1a2131f897 Initial commit. Ping check, scheduling, UI working. SSH check mostly working.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
107 default: throw new InvalidOperationException("Unexpected frequency units: " + Units);
3e1a2131f897 Initial commit. Ping check, scheduling, UI working. SSH check mostly working.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
108 }
3e1a2131f897 Initial commit. Ping check, scheduling, UI working. SSH check mostly working.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
109 }
17
68d7834dc28e More comments.
Brad Greco <brad@bgreco.net>
parents: 12
diff changeset
110 // Now we have the next date and time, but we don't know yet if it is within
68d7834dc28e More comments.
Brad Greco <brad@bgreco.net>
parents: 12
diff changeset
111 // the active times of day the check is allowed to run between.
0
3e1a2131f897 Initial commit. Ping check, scheduling, UI working. SSH check mostly working.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
112 if (StartTime < EndTime)
3e1a2131f897 Initial commit. Ping check, scheduling, UI working. SSH check mostly working.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
113 {
17
68d7834dc28e More comments.
Brad Greco <brad@bgreco.net>
parents: 12
diff changeset
114 // The allowed start and end times are on the same day.
68d7834dc28e More comments.
Brad Greco <brad@bgreco.net>
parents: 12
diff changeset
115 // If the next scheduled time is too early (before the allowed start time),
68d7834dc28e More comments.
Brad Greco <brad@bgreco.net>
parents: 12
diff changeset
116 // wait to run it until the start time happens.
0
3e1a2131f897 Initial commit. Ping check, scheduling, UI working. SSH check mostly working.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
117 if (nextTime.TimeOfDay < StartTime)
3e1a2131f897 Initial commit. Ping check, scheduling, UI working. SSH check mostly working.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
118 nextTime = nextTime.Date + StartTime;
17
68d7834dc28e More comments.
Brad Greco <brad@bgreco.net>
parents: 12
diff changeset
119 // If the next scheduled time is too late (after the allowed end time),
68d7834dc28e More comments.
Brad Greco <brad@bgreco.net>
parents: 12
diff changeset
120 // wait to run it until the start time happens on the following day.
0
3e1a2131f897 Initial commit. Ping check, scheduling, UI working. SSH check mostly working.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
121 else if (nextTime.TimeOfDay > EndTime)
3e1a2131f897 Initial commit. Ping check, scheduling, UI working. SSH check mostly working.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
122 nextTime = nextTime.Date.AddDays(1) + StartTime;
3e1a2131f897 Initial commit. Ping check, scheduling, UI working. SSH check mostly working.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
123 }
3e1a2131f897 Initial commit. Ping check, scheduling, UI working. SSH check mostly working.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
124 else if (nextTime.TimeOfDay > EndTime && nextTime.TimeOfDay < StartTime)
3e1a2131f897 Initial commit. Ping check, scheduling, UI working. SSH check mostly working.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
125 {
17
68d7834dc28e More comments.
Brad Greco <brad@bgreco.net>
parents: 12
diff changeset
126 // The allowed start time is on the day after the allowed end time,
68d7834dc28e More comments.
Brad Greco <brad@bgreco.net>
parents: 12
diff changeset
127 // and the next scheduled time is too early (before the allowed start time).
68d7834dc28e More comments.
Brad Greco <brad@bgreco.net>
parents: 12
diff changeset
128 // Wait to run the check until the allowed start time happens.
0
3e1a2131f897 Initial commit. Ping check, scheduling, UI working. SSH check mostly working.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
129 nextTime = nextTime.Date + StartTime;
3e1a2131f897 Initial commit. Ping check, scheduling, UI working. SSH check mostly working.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
130 }
3e1a2131f897 Initial commit. Ping check, scheduling, UI working. SSH check mostly working.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
131 }
3e1a2131f897 Initial commit. Ping check, scheduling, UI working. SSH check mostly working.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
132 return nextTime;
3e1a2131f897 Initial commit. Ping check, scheduling, UI working. SSH check mostly working.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
133 }
12
d92176c5398a Better display of schedule name.
Brad Greco <brad@bgreco.net>
parents: 8
diff changeset
134
d92176c5398a Better display of schedule name.
Brad Greco <brad@bgreco.net>
parents: 8
diff changeset
135 public override string ToString()
d92176c5398a Better display of schedule name.
Brad Greco <brad@bgreco.net>
parents: 8
diff changeset
136 {
d92176c5398a Better display of schedule name.
Brad Greco <brad@bgreco.net>
parents: 8
diff changeset
137 return string.Format("Every {0} {1}", Frequency, Units.ToString().ToLower() + (Frequency == 1 ? "" : "s"));
d92176c5398a Better display of schedule name.
Brad Greco <brad@bgreco.net>
parents: 8
diff changeset
138 }
0
3e1a2131f897 Initial commit. Ping check, scheduling, UI working. SSH check mostly working.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
139 }
3e1a2131f897 Initial commit. Ping check, scheduling, UI working. SSH check mostly working.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
140
17
68d7834dc28e More comments.
Brad Greco <brad@bgreco.net>
parents: 12
diff changeset
141 /// <summary>Units of time that a check can be scheduled to run in intervals of.</summary>
0
3e1a2131f897 Initial commit. Ping check, scheduling, UI working. SSH check mostly working.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
142 public enum FrequencyUnits { Second, Minute, Hour, Day }
3e1a2131f897 Initial commit. Ping check, scheduling, UI working. SSH check mostly working.
Brad Greco <brad@bgreco.net>
parents:
diff changeset
143 }