namespace Interval_Timer
{
/// <summary>
/// Description of MainForm.
/// </summary>
public partial class MainForm : Form
{
public MainForm()
{
//
// The InitializeComponent() call is required for Windows Forms designer support.
//
InitializeComponent();
//
// TODO: Add constructor code after the InitializeComponent() call.
//
}
public class Interval
{
DateTime LeftBound { get; set; }
DateTime RightBound { get; set; }
public Interval(DateTime left, DateTime right)
{
LeftBound = left;
RightBound = right;
}
}
List<Interval> intervals = new List<Interval>
{
new Interval(DateTime.Parse("08:15:00"), DateTime.Parse("09:00:00")),
new Interval(DateTime.Parse("09:05:00"), DateTime.Parse("09:50:00")),
new Interval(DateTime.Parse("10:00:00"), DateTime.Parse("10:45:00")),
new Interval(DateTime.Parse("10:50:00"), DateTime.Parse("11:35:00")),
new Interval(DateTime.Parse("11:45:00"), DateTime.Parse("12:30:00")),
new Interval(DateTime.Parse("12:35:00"), DateTime.Parse("13:20:00")),
new Interval(DateTime.Parse("13:25:00"), DateTime.Parse("14:10:00")),
new Interval(DateTime.Parse("14:15:00"), DateTime.Parse("15:00:00")),
new Interval(DateTime.Parse("15:05:00"), DateTime.Parse("15:50:00")),
new Interval(DateTime.Parse("15:55:00"), DateTime.Parse("16:40:00")),
new Interval(DateTime.Parse("16:45:00"), DateTime.Parse("17:30:00")),
new Interval(DateTime.Parse("17:35:00"), DateTime.Parse("18:20:00")),
new Interval(DateTime.Parse("18:25:00"), DateTime.Parse("19:10:00")),
new Interval(DateTime.Parse("19:15:00"), DateTime.Parse("20:00:00")),
new Interval(DateTime.Parse("20:05:00"), DateTime.Parse("20:50:00")),
new Interval(DateTime.Parse("20:55:00"), DateTime.Parse("08:10:00")),
};
void Timer1Tick(object sender, EventArgs e)
{
}
}
public class Color
{
public Color CheckInterval(DateTime now, List<Interval> timeTable)
{
Color color = Color.Green;
foreach (Interval interval in timeTable)
{
if (now > interval.LeftBound && now < interval.RightBound)
{
color = Color.Red;
break;
}
}
return color;
}
}
}