Exemplo n.º 1
0
 public void AddEvenement(Evenement e)
 {
     if (this.user == null)
     {
         throw new Exception("User account is not loaded");
     }
     if (e.DateDebut.Month == this.MonthData.Month.Month && e.DateDebut.Year == this.MonthData.Month.Year)
     {
         this.MonthData.AddEvenement(new DateTime(e.DateDebut.Year, e.DateDebut.Month, e.DateDebut.Day), e);
         MainWindow.CalendarField.UpdateCalendar();
         MainWindow.TachesEventsField.Update();
     }
     else
     {
         CalendarInfo ci = new CalendarInfo(this.currentUserDataPath + $"\\MonthData{e.DateDebut.Month}-{e.DateDebut.Year}.json", new DateTime(e.DateDebut.Year, e.DateDebut.Month, 1));
         ci.AddEvenement(new DateTime(e.DateDebut.Year, e.DateDebut.Month, e.DateDebut.Day), e);
         ci.StoreData();
     }
     foreach (Notif n in e.Alarms)
     {
         OtherThread.sendData(ConvertToNotification(n, "evenment", e.DateDebut, e.Title));
     }
 }
Exemplo n.º 2
0
 public void AddTache(Tache t)
 {
     if (this.user == null)
     {
         throw new Exception("User account is not loaded");
     }
     if (t.dateDebut.Month == this.MonthData.Month.Month && t.dateDebut.Year == this.MonthData.Month.Year)
     {
         this.MonthData.AddTache(new DateTime(t.dateDebut.Year, t.dateDebut.Month, t.dateDebut.Day), t);
         MainWindow.CalendarField.UpdateCalendar();
         MainWindow.TachesEventsField.Update();
     }
     else
     {
         CalendarInfo ci = new CalendarInfo(this.currentUserDataPath + $"\\MonthData{t.dateDebut.Month}-{t.dateDebut.Year}.json", new DateTime(t.dateDebut.Year, t.dateDebut.Month, 1));
         ci.AddTache(new DateTime(t.dateDebut.Year, t.dateDebut.Month, t.dateDebut.Day), t);
         ci.StoreData();
     }
     foreach (Notif n in t.Alarms)
     {
         OtherThread.sendData(ConvertToNotification(n, "tache", t.dateDebut, t.title));
     }
 }