mirror of
https://git.alee14.me/shiftos-archive/ShiftOS_TheReturn.git
synced 2025-01-23 02:12:14 +00:00
Fire event when note is marked read
This commit is contained in:
parent
ed5b654936
commit
569ad6fd7a
3 changed files with 16 additions and 0 deletions
|
@ -23,9 +23,14 @@ namespace ShiftOS.WinForms.Applications
|
|||
{
|
||||
SetupUI();
|
||||
};
|
||||
onRead += () =>
|
||||
{
|
||||
SetupUI();
|
||||
};
|
||||
}
|
||||
|
||||
Action<Notification> onMade = null;
|
||||
Action onRead = null;
|
||||
|
||||
public void SetupUI()
|
||||
{
|
||||
|
@ -227,6 +232,7 @@ namespace ShiftOS.WinForms.Applications
|
|||
{
|
||||
SetupUI();
|
||||
NotificationDaemon.NotificationMade += onMade;
|
||||
NotificationDaemon.NotificationRead += onRead;
|
||||
}
|
||||
|
||||
public void OnSkinLoad()
|
||||
|
@ -236,6 +242,7 @@ namespace ShiftOS.WinForms.Applications
|
|||
public bool OnUnload()
|
||||
{
|
||||
NotificationDaemon.NotificationMade -= onMade;
|
||||
NotificationDaemon.NotificationRead -= onRead;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -68,6 +68,13 @@ namespace ShiftOS.WinForms
|
|||
|
||||
};
|
||||
|
||||
NotificationDaemon.NotificationRead += () =>
|
||||
{
|
||||
//Soon this will pop a balloon note.
|
||||
btnnotifications.Text = "Notifications (" + NotificationDaemon.GetUnreadCount().ToString() + ")";
|
||||
|
||||
};
|
||||
|
||||
this.LocationChanged += (o, a) =>
|
||||
{
|
||||
if (this.Left != 0)
|
||||
|
|
|
@ -35,6 +35,7 @@ namespace ShiftOS.Engine
|
|||
NotificationMade?.Invoke(lst[lst.Count - 1]);
|
||||
}
|
||||
|
||||
public static event Action NotificationRead;
|
||||
|
||||
public static void MarkRead(int note)
|
||||
{
|
||||
|
@ -44,6 +45,7 @@ namespace ShiftOS.Engine
|
|||
|
||||
notes[note].Read = true;
|
||||
WriteNotes(notes);
|
||||
NotificationRead?.Invoke();
|
||||
}
|
||||
|
||||
public static int GetUnreadCount()
|
||||
|
|
Loading…
Reference in a new issue