Added NightAlert project for travel kit
This commit is contained in:
81
NightScout/Alerters/MultiAlerter.cs
Normal file
81
NightScout/Alerters/MultiAlerter.cs
Normal 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);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user