Added NightAlert project for travel kit

This commit is contained in:
2021-06-10 14:39:06 -04:00
commit d38d9e3b7e
308 changed files with 35922 additions and 0 deletions

View File

@@ -0,0 +1,81 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime;
using System.Text;
using System.Threading.Tasks;
namespace NightScout
{
public class MultiAlerter : IAlerter
{
public List<IAlerter> Alerters { get; set; }
public MultiAlerter(IEnumerable<IAlerter> alerters)
{
Alerters = new List<IAlerter>(alerters);
}
public void StartAlert()
{
Alerters.ForEach(a =>
{
try
{
a.StartAlert();
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
});
}
public void StartUrgentAlert()
{
Alerters.ForEach(a =>
{
try
{
a.StartUrgentAlert();
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
});
}
public void StartStaleDataAlert()
{
Alerters.ForEach(a =>
{
try
{
a.StartStaleDataAlert();
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
});
}
public void StopAlerts()
{
Alerters.ForEach(a =>
{
try
{
a.StopAlerts();
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
});
}
}
}