diff --git a/ShiftOS.WinForms/Applications/Notifications.Designer.cs b/ShiftOS.WinForms/Applications/Notifications.Designer.cs
new file mode 100644
index 0000000..d9a8388
--- /dev/null
+++ b/ShiftOS.WinForms/Applications/Notifications.Designer.cs
@@ -0,0 +1,73 @@
+namespace ShiftOS.WinForms.Applications
+{
+ partial class Notifications
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Component Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.lblnotifications = new System.Windows.Forms.Label();
+ this.fllist = new System.Windows.Forms.FlowLayoutPanel();
+ this.SuspendLayout();
+ //
+ // lblnotifications
+ //
+ this.lblnotifications.AutoSize = true;
+ this.lblnotifications.Dock = System.Windows.Forms.DockStyle.Top;
+ this.lblnotifications.Location = new System.Drawing.Point(0, 0);
+ this.lblnotifications.Name = "lblnotifications";
+ this.lblnotifications.Padding = new System.Windows.Forms.Padding(10);
+ this.lblnotifications.Size = new System.Drawing.Size(85, 33);
+ this.lblnotifications.TabIndex = 0;
+ this.lblnotifications.Tag = "header1";
+ this.lblnotifications.Text = "Notifications";
+ //
+ // fllist
+ //
+ this.fllist.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.fllist.Location = new System.Drawing.Point(0, 33);
+ this.fllist.Name = "fllist";
+ this.fllist.Size = new System.Drawing.Size(437, 487);
+ this.fllist.TabIndex = 1;
+ //
+ // Notifications
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.Controls.Add(this.fllist);
+ this.Controls.Add(this.lblnotifications);
+ this.Name = "Notifications";
+ this.Size = new System.Drawing.Size(437, 520);
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.Label lblnotifications;
+ private System.Windows.Forms.FlowLayoutPanel fllist;
+ }
+}
diff --git a/ShiftOS.WinForms/Applications/Notifications.cs b/ShiftOS.WinForms/Applications/Notifications.cs
new file mode 100644
index 0000000..aa8ba71
--- /dev/null
+++ b/ShiftOS.WinForms/Applications/Notifications.cs
@@ -0,0 +1,54 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Drawing;
+using System.Data;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+using ShiftOS.Engine;
+
+namespace ShiftOS.WinForms.Applications
+{
+ [DefaultTitle("Notifications")]
+ [Launcher("Notifications", true, "al_notifications", "Utilities")]
+ public partial class Notifications : UserControl, IShiftOSWindow
+ {
+ public Notifications()
+ {
+ InitializeComponent();
+ onMade = (note) =>
+ {
+ SetupUI();
+ };
+ }
+
+ Action onMade = null;
+
+ public void SetupUI()
+ {
+
+ }
+
+ public void OnLoad()
+ {
+ SetupUI();
+ NotificationDaemon.NotificationMade += onMade;
+ }
+
+ public void OnSkinLoad()
+ {
+ }
+
+ public bool OnUnload()
+ {
+ NotificationDaemon.NotificationMade -= onMade;
+ return true;
+ }
+
+ public void OnUpgrade()
+ {
+ }
+ }
+}
diff --git a/ShiftOS.WinForms/Applications/Notifications.resx b/ShiftOS.WinForms/Applications/Notifications.resx
new file mode 100644
index 0000000..1af7de1
--- /dev/null
+++ b/ShiftOS.WinForms/Applications/Notifications.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/ShiftOS.WinForms/Resources/Shiftorium.txt b/ShiftOS.WinForms/Resources/Shiftorium.txt
index af30613..9c116be 100644
--- a/ShiftOS.WinForms/Resources/Shiftorium.txt
+++ b/ShiftOS.WinForms/Resources/Shiftorium.txt
@@ -5,6 +5,18 @@
Description: "Some basic commands for the terminal that'll help you out in the multi-user domain.",
Dependencies: null
},
+ {
+ Name: "AL Notifications",
+ Cost: 125,
+ Dependencies: "app_launcher",
+ Description: "Want to open the Notifications application from within the App Launcher? This upgrade is for you."
+ },
+ {
+ Name: "Panel Notifications",
+ Cost: 150,
+ Description: "It's good to know what time it is, but how about knowing how many notifications you have? After all, notifications are a great way to tell what's going on! This upgrade adds a button that displays how many notifications you have. If you click it, you will open the Notifications app!",
+ Dependencies: "desktop_clock_widget"
+ },
{
Name: "Audio Volume",
Cost: 50,
diff --git a/ShiftOS.WinForms/ShiftOS.WinForms.csproj b/ShiftOS.WinForms/ShiftOS.WinForms.csproj
index 1b6b2d7..45c1a47 100644
--- a/ShiftOS.WinForms/ShiftOS.WinForms.csproj
+++ b/ShiftOS.WinForms/ShiftOS.WinForms.csproj
@@ -124,6 +124,12 @@
NameChanger.cs
+
+ UserControl
+
+
+ Notifications.cs
+
UserControl
@@ -268,6 +274,9 @@
NameChanger.cs
+
+ Notifications.cs
+
Pong.cs
diff --git a/ShiftOS.WinForms/WinformsDesktop.Designer.cs b/ShiftOS.WinForms/WinformsDesktop.Designer.cs
index 23f4665..0585199 100644
--- a/ShiftOS.WinForms/WinformsDesktop.Designer.cs
+++ b/ShiftOS.WinForms/WinformsDesktop.Designer.cs
@@ -53,6 +53,7 @@ namespace ShiftOS.WinForms
private void InitializeComponent()
{
this.desktoppanel = new System.Windows.Forms.Panel();
+ this.btnnotifications = new System.Windows.Forms.Button();
this.lbtime = new System.Windows.Forms.Label();
this.panelbuttonholder = new System.Windows.Forms.FlowLayoutPanel();
this.sysmenuholder = new System.Windows.Forms.Panel();
@@ -66,6 +67,7 @@ namespace ShiftOS.WinForms
// desktoppanel
//
this.desktoppanel.BackColor = System.Drawing.Color.Green;
+ this.desktoppanel.Controls.Add(this.btnnotifications);
this.desktoppanel.Controls.Add(this.lbtime);
this.desktoppanel.Controls.Add(this.panelbuttonholder);
this.desktoppanel.Controls.Add(this.sysmenuholder);
@@ -75,6 +77,22 @@ namespace ShiftOS.WinForms
this.desktoppanel.Size = new System.Drawing.Size(1296, 24);
this.desktoppanel.TabIndex = 0;
//
+ // btnnotifications
+ //
+ this.btnnotifications.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
+ this.btnnotifications.AutoSize = true;
+ this.btnnotifications.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
+ this.btnnotifications.BackColor = System.Drawing.Color.Transparent;
+ this.btnnotifications.FlatAppearance.BorderSize = 0;
+ this.btnnotifications.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
+ this.btnnotifications.Location = new System.Drawing.Point(1066, -2);
+ this.btnnotifications.Name = "btnnotifications";
+ this.btnnotifications.Size = new System.Drawing.Size(136, 24);
+ this.btnnotifications.TabIndex = 3;
+ this.btnnotifications.Text = "Notifications (0)";
+ this.btnnotifications.UseVisualStyleBackColor = false;
+ this.btnnotifications.Click += new System.EventHandler(this.btnnotifications_Click);
+ //
// lbtime
//
this.lbtime.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
@@ -156,6 +174,7 @@ namespace ShiftOS.WinForms
private System.Windows.Forms.MenuStrip menuStrip1;
private System.Windows.Forms.ToolStripMenuItem apps;
private System.Windows.Forms.FlowLayoutPanel panelbuttonholder;
+ private System.Windows.Forms.Button btnnotifications;
}
}
diff --git a/ShiftOS.WinForms/WinformsDesktop.cs b/ShiftOS.WinForms/WinformsDesktop.cs
index 2bb2715..ded68ba 100644
--- a/ShiftOS.WinForms/WinformsDesktop.cs
+++ b/ShiftOS.WinForms/WinformsDesktop.cs
@@ -119,6 +119,9 @@ namespace ShiftOS.WinForms
lbtime.Top = LoadedSkin.DesktopPanelClockFromRight.Y;
}
}
+
+ btnnotifications.Left = lbtime.Left - btnnotifications.Width - 2;
+ btnnotifications.Top = (desktoppanel.Height - btnnotifications.Height) / 2;
};
time.Start();
@@ -229,6 +232,8 @@ namespace ShiftOS.WinForms
desktoppanel.Visible = Shiftorium.UpgradeInstalled("desktop");
lbtime.Visible = Shiftorium.UpgradeInstalled("desktop_clock_widget");
+ btnnotifications.Visible = Shiftorium.UpgradeInstalled("panel_notifications");
+
//skinning
lbtime.ForeColor = LoadedSkin.DesktopPanelClockColor;
@@ -529,6 +534,11 @@ namespace ShiftOS.WinForms
{
return this.Size;
}
+
+ private void btnnotifications_Click(object sender, EventArgs e)
+ {
+ AppearanceManager.SetupWindow(new Applications.Notifications());
+ }
}
[ShiftOS.Engine.Scripting.Exposed("desktop")]
diff --git a/ShiftOS_TheReturn/NotificationDaemon.cs b/ShiftOS_TheReturn/NotificationDaemon.cs
new file mode 100644
index 0000000..3a2e96a
--- /dev/null
+++ b/ShiftOS_TheReturn/NotificationDaemon.cs
@@ -0,0 +1,91 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Newtonsoft.Json;
+using ShiftOS.Objects.ShiftFS;
+
+namespace ShiftOS.Engine
+{
+ public static class NotificationDaemon
+ {
+ public static Notification[] GetAllFromFile()
+ {
+ Notification[] notes = { };
+ if (Utils.FileExists(Paths.GetPath("notifications.dat")))
+ {
+ notes = JsonConvert.DeserializeObject(Utils.ReadAllText(Paths.GetPath("notifications.dat")));
+ }
+ return notes;
+ }
+
+ internal static void WriteNotes(Notification[] notes)
+ {
+ Utils.WriteAllText(Paths.GetPath("notifications.dat"), JsonConvert.SerializeObject(notes, Formatting.Indented));
+ }
+
+ public static event Action NotificationMade;
+
+ public static void AddNotification(NotificationType note, object data)
+ {
+ var lst = new List(GetAllFromFile());
+ lst.Add(new Engine.Notification(note, data));
+ WriteNotes(lst.ToArray());
+ NotificationMade?.Invoke(lst[lst.Count - 1]);
+ }
+
+
+ public static void MarkRead(int note)
+ {
+ 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);
+ }
+ }
+
+ public struct Notification
+ {
+ public Notification(NotificationType t, object data)
+ {
+ Type = t;
+ Data = data;
+ Read = false;
+ Timestamp = DateTime.Now;
+ }
+
+ public bool Read { get; internal set; }
+ public NotificationType Type { get; private set; }
+ public object Data { get; private set; }
+ public DateTime Timestamp { get; private set; }
+ }
+
+ public enum NotificationType : byte
+ {
+ Generic = 0x00,
+ MemoReceived = 0x10,
+ MemoSent = 0x11,
+ DownloadStarted = 0x20,
+ DownloadComplete = 0x21,
+ CodepointsReceived = 0x30,
+ CodepointsSent = 0x31,
+ ShopPurchase = 0x40,
+ LegionInvite = 0x50,
+ LegionKick = 0x51,
+ LegionBan = 0x52,
+ ChatBan = 0x60,
+ MUDAnnouncement = 0x70,
+ MUDMaintenance = 0x71,
+ NewShiftOSUnstable = 0x72,
+ NewShiftOSStable = 0x73,
+ NewAppveyor = 0x74,
+ CriticalBugwatch = 0x75,
+ NewDeveloper = 0x76,
+ NewShiftOSVideo = 0x77,
+ NewShiftOSStream = 0x78,
+ SavePurge = 0x79,
+ }
+}
diff --git a/ShiftOS_TheReturn/ShiftOS.Engine.csproj b/ShiftOS_TheReturn/ShiftOS.Engine.csproj
index a8c041d..735d046 100644
--- a/ShiftOS_TheReturn/ShiftOS.Engine.csproj
+++ b/ShiftOS_TheReturn/ShiftOS.Engine.csproj
@@ -132,6 +132,7 @@
+