From 5afced5136dab902e97eab02e25c2add3e2652d1 Mon Sep 17 00:00:00 2001 From: william341 Date: Sat, 25 Feb 2017 13:19:53 -0700 Subject: [PATCH] Revert "Revert "fix notification mark as read not updating"" This reverts commit bd41ad18fe55fcd5bcba9fdbd0bb2c86edd01411, reversing changes made to c4f855f3a559195d7b683ec4b96a18c42ce7b5fb. --- ShiftOS.WinForms/WinformsDesktop.cs | 6 ++++++ ShiftOS_TheReturn/NotificationDaemon.cs | 2 ++ 2 files changed, 8 insertions(+) diff --git a/ShiftOS.WinForms/WinformsDesktop.cs b/ShiftOS.WinForms/WinformsDesktop.cs index 957c793..fdb249a 100644 --- a/ShiftOS.WinForms/WinformsDesktop.cs +++ b/ShiftOS.WinForms/WinformsDesktop.cs @@ -68,6 +68,12 @@ namespace ShiftOS.WinForms }; + NotificationDaemon.NotificationRead += (note) => + { + btnnotifications.Text = "Notifications (" + NotificationDaemon.GetUnreadCount().ToString() + ")"; + + }; + this.LocationChanged += (o, a) => { if (this.Left != 0) diff --git a/ShiftOS_TheReturn/NotificationDaemon.cs b/ShiftOS_TheReturn/NotificationDaemon.cs index 5adc026..1737be3 100644 --- a/ShiftOS_TheReturn/NotificationDaemon.cs +++ b/ShiftOS_TheReturn/NotificationDaemon.cs @@ -45,12 +45,14 @@ namespace ShiftOS.Engine public static void MarkRead(int note) { + var lst = new List(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()