fix notification mark as read not updating

This commit is contained in:
william341 2017-02-25 12:36:26 -07:00
parent ed5b654936
commit c4f855f3a5
2 changed files with 8 additions and 0 deletions

View file

@ -68,6 +68,12 @@ namespace ShiftOS.WinForms
};
NotificationDaemon.NotificationRead += (note) =>
{
btnnotifications.Text = "Notifications (" + NotificationDaemon.GetUnreadCount().ToString() + ")";
};
this.LocationChanged += (o, a) =>
{
if (this.Left != 0)

View file

@ -38,12 +38,14 @@ namespace ShiftOS.Engine
public static void MarkRead(int note)
{
var lst = new List<Notification>(GetAllFromFile());
var notes = GetAllFromFile();
if (note >= notes.Length || note < 0)
throw new ArgumentOutOfRangeException("note", new Exception("You cannot mark a notification that does not exist as read."));
notes[note].Read = true;
WriteNotes(notes);
NotificationMade?.Invoke(lst[lst.Count - 1]);
}
public static int GetUnreadCount()