From bdd8e61600ce849d36e1b4932a01540f2575b738 Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 24 Feb 2017 21:16:45 -0500 Subject: [PATCH] Notification frontend. Sorta. --- .../Applications/Notifications.Designer.cs | 62 +++++++++ .../Applications/Notifications.cs | 40 ++++++ .../Applications/Notifications.resx | 120 ++++++++++++++++++ ShiftOS.WinForms/Resources/Shiftorium.txt | 12 ++ ShiftOS.WinForms/ShiftOS.WinForms.csproj | 9 ++ ShiftOS.WinForms/WinformsDesktop.Designer.cs | 19 +++ ShiftOS.WinForms/WinformsDesktop.cs | 10 ++ 7 files changed, 272 insertions(+) create mode 100644 ShiftOS.WinForms/Applications/Notifications.Designer.cs create mode 100644 ShiftOS.WinForms/Applications/Notifications.cs create mode 100644 ShiftOS.WinForms/Applications/Notifications.resx diff --git a/ShiftOS.WinForms/Applications/Notifications.Designer.cs b/ShiftOS.WinForms/Applications/Notifications.Designer.cs new file mode 100644 index 0000000..f8372de --- /dev/null +++ b/ShiftOS.WinForms/Applications/Notifications.Designer.cs @@ -0,0 +1,62 @@ +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.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"; + // + // Notifications + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + 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; + } +} diff --git a/ShiftOS.WinForms/Applications/Notifications.cs b/ShiftOS.WinForms/Applications/Notifications.cs new file mode 100644 index 0000000..9e1b36b --- /dev/null +++ b/ShiftOS.WinForms/Applications/Notifications.cs @@ -0,0 +1,40 @@ +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(); + } + + public void OnLoad() + { + } + + public void OnSkinLoad() + { + } + + public bool OnUnload() + { + 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")]