private void TimerEventProcessor(Object myObject, EventArgs myEventArgs)
{
if (timerListEntries != null && timerListEntries.Count > 0)
{
listViewTimer.BeginUpdate();
DateTime now = DateTime.Now;
TimeSpan diff;
foreach (TimerListEntry t in timerListEntries)
{
if (t.lvi != null)
{
diff = t.time.Subtract(now);
if (updateTimer)
t.lvi.SubItems[2].Text = (diff.TotalSeconds > 0 ? diff.ToString("d':'hh':'mm':'ss") : "Finished");
if (diff.TotalSeconds >= 0)
{
if (diff.TotalSeconds < 60 && diff.TotalSeconds > 10)
t.lvi.BackColor = Color.Gold;
if (diff.TotalSeconds < 11)
t.lvi.BackColor = Color.LightSalmon;
if (diff.TotalSeconds < 60.8 && diff.TotalSeconds > 59.2)
{
System.Media.SystemSounds.Hand.Play();
}
if (diff.TotalSeconds < 20.8 && diff.TotalSeconds > 19.2)
{
System.Media.SystemSounds.Beep.Play();
}
}
}
}
listViewTimer.EndUpdate();
}
}