ProjetThe/ProjetTheAlone/ViewModel/VM_DashBoard.cs

60 lines
1.7 KiB
C#
Raw Normal View History

2019-01-19 11:04:17 +01:00
using System;
using System.Collections.Generic;
2019-01-27 10:22:31 +01:00
using System.Collections.Specialized;
2019-01-19 11:04:17 +01:00
using System.Linq;
using System.Text;
using System.Threading.Tasks;
2019-01-27 10:22:31 +01:00
using System.Windows.Controls;
2019-01-19 11:04:17 +01:00
namespace ProjetTheAlone.ViewModel
{
2019-01-27 10:22:31 +01:00
public class VM_DashBoard : TextDefilant
2019-01-19 11:04:17 +01:00
{
2019-01-27 18:50:01 +01:00
int tick = 0;
2019-01-27 10:22:31 +01:00
public StringCollection Alerte
{
get
{
if (Config.Settings1.Default.alerte != null)
return Config.Settings1.Default.alerte;
else
return new StringCollection();
}
set
{
Config.Settings1.Default.alerte = value;
OnPropertyChanged("Alerte");
}
}
public VM_DashBoard(TextBlock tb, string text, int timeMs) : base (tb,text, timeMs)
{
updateAlert();
2019-01-27 18:50:01 +01:00
base.Tick += new TickHandler(onTick);
2019-01-27 10:22:31 +01:00
}
public void updateAlert()
{
string alert = "ALERTE : ";
foreach (string s in Alerte)
alert += $"{s};;";
var anifBen = new Gestion.G_T_beneficiaire(Config.Settings1.Default.schCon).AnnifDuJour();
if (anifBen.Count > 0)
{
alert += "ANNIVERSAIRE DE :";
foreach (Classes.C_T_beneficiaire b in anifBen)
alert += $" {b.B_prenom} {b.B_nom} ;;";
}
base.TextAfficher = alert;
}
2019-01-27 18:50:01 +01:00
public void onTick(object o, EventArgs e)
{
if(++tick > base.TextAfficher.Length)
{
tick = 0;
updateAlert();
}
}
2019-01-19 11:04:17 +01:00
}
}