From bb4a3801623579296cf081f4e9172080d852bc7b Mon Sep 17 00:00:00 2001 From: Michael Date: Tue, 28 Feb 2017 17:01:14 -0500 Subject: Beginning screensaver work --- ShiftOS.WinForms/WinformsDesktop.Designer.cs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'ShiftOS.WinForms/WinformsDesktop.Designer.cs') diff --git a/ShiftOS.WinForms/WinformsDesktop.Designer.cs b/ShiftOS.WinForms/WinformsDesktop.Designer.cs index aef7296..2348320 100644 --- a/ShiftOS.WinForms/WinformsDesktop.Designer.cs +++ b/ShiftOS.WinForms/WinformsDesktop.Designer.cs @@ -59,9 +59,12 @@ namespace ShiftOS.WinForms this.sysmenuholder = new System.Windows.Forms.Panel(); this.menuStrip1 = new System.Windows.Forms.MenuStrip(); this.apps = new System.Windows.Forms.ToolStripMenuItem(); + this.pnlscreensaver = new System.Windows.Forms.Panel(); + this.pnlssicon = new System.Windows.Forms.Panel(); this.desktoppanel.SuspendLayout(); this.sysmenuholder.SuspendLayout(); this.menuStrip1.SuspendLayout(); + this.pnlscreensaver.SuspendLayout(); this.SuspendLayout(); // // desktoppanel @@ -144,12 +147,30 @@ namespace ShiftOS.WinForms this.apps.Tag = "applauncherbutton"; this.apps.Text = "ShiftOS"; // + // pnlscreensaver + // + this.pnlscreensaver.Controls.Add(this.pnlssicon); + this.pnlscreensaver.Dock = System.Windows.Forms.DockStyle.Fill; + this.pnlscreensaver.Location = new System.Drawing.Point(0, 24); + this.pnlscreensaver.Name = "pnlscreensaver"; + this.pnlscreensaver.Size = new System.Drawing.Size(1296, 714); + this.pnlscreensaver.TabIndex = 1; + this.pnlscreensaver.Visible = false; + // + // pnlssicon + // + this.pnlssicon.Location = new System.Drawing.Point(303, 495); + this.pnlssicon.Name = "pnlssicon"; + this.pnlssicon.Size = new System.Drawing.Size(200, 100); + this.pnlssicon.TabIndex = 0; + // // WinformsDesktop // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 14F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.Black; this.ClientSize = new System.Drawing.Size(1296, 738); + this.Controls.Add(this.pnlscreensaver); this.Controls.Add(this.desktoppanel); this.Font = new System.Drawing.Font("Consolas", 9F); this.ForeColor = System.Drawing.Color.LightGreen; @@ -163,6 +184,7 @@ namespace ShiftOS.WinForms this.sysmenuholder.PerformLayout(); this.menuStrip1.ResumeLayout(false); this.menuStrip1.PerformLayout(); + this.pnlscreensaver.ResumeLayout(false); this.ResumeLayout(false); } @@ -176,6 +198,8 @@ namespace ShiftOS.WinForms private System.Windows.Forms.ToolStripMenuItem apps; private System.Windows.Forms.FlowLayoutPanel panelbuttonholder; private System.Windows.Forms.Button btnnotifications; + private System.Windows.Forms.Panel pnlscreensaver; + private System.Windows.Forms.Panel pnlssicon; } } -- cgit v1.2.3 From fc9b618fafb6389a0dca714b79834ec024b0be2f Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 7 Apr 2017 20:08:17 -0400 Subject: Basics for Advanced App Launcher. --- .../Applications/UpdateManager.Designer.cs | 44 +++++----- ShiftOS.WinForms/Resources/Shiftorium.txt | 9 +++ ShiftOS.WinForms/WinformsDesktop.Designer.cs | 94 ++++++++++++++++++++++ ShiftOS.WinForms/WinformsDesktop.cs | 85 +++++++++++++++++++ 4 files changed, 210 insertions(+), 22 deletions(-) (limited to 'ShiftOS.WinForms/WinformsDesktop.Designer.cs') diff --git a/ShiftOS.WinForms/Applications/UpdateManager.Designer.cs b/ShiftOS.WinForms/Applications/UpdateManager.Designer.cs index 466151a..0b23b8e 100644 --- a/ShiftOS.WinForms/Applications/UpdateManager.Designer.cs +++ b/ShiftOS.WinForms/Applications/UpdateManager.Designer.cs @@ -30,9 +30,9 @@ { this.lbupdatetitle = new System.Windows.Forms.Label(); this.pnlupdatebar = new System.Windows.Forms.Panel(); - this.btnclose = new System.Windows.Forms.Button(); - this.btnaction = new System.Windows.Forms.Button(); this.pgdownload = new ShiftOS.WinForms.Controls.ShiftedProgressBar(); + this.btnaction = new System.Windows.Forms.Button(); + this.btnclose = new System.Windows.Forms.Button(); this.wbstatus = new System.Windows.Forms.WebBrowser(); this.pnlupdatebar.SuspendLayout(); this.SuspendLayout(); @@ -60,26 +60,6 @@ this.pnlupdatebar.Size = new System.Drawing.Size(597, 33); this.pnlupdatebar.TabIndex = 1; // - // btnclose - // - this.btnclose.Location = new System.Drawing.Point(4, 4); - this.btnclose.Name = "btnclose"; - this.btnclose.Size = new System.Drawing.Size(75, 23); - this.btnclose.TabIndex = 0; - this.btnclose.Text = "{CLOSE}"; - this.btnclose.UseVisualStyleBackColor = true; - this.btnclose.Click += new System.EventHandler(this.btnclose_Click); - // - // btnaction - // - this.btnaction.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.btnaction.Location = new System.Drawing.Point(519, 4); - this.btnaction.Name = "btnaction"; - this.btnaction.Size = new System.Drawing.Size(75, 23); - this.btnaction.TabIndex = 1; - this.btnaction.Text = "Update"; - this.btnaction.UseVisualStyleBackColor = true; - // // pgdownload // this.pgdownload.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) @@ -94,6 +74,26 @@ this.pgdownload.Text = "Updating..."; this.pgdownload.Value = 0; // + // btnaction + // + this.btnaction.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.btnaction.Location = new System.Drawing.Point(519, 4); + this.btnaction.Name = "btnaction"; + this.btnaction.Size = new System.Drawing.Size(75, 23); + this.btnaction.TabIndex = 1; + this.btnaction.Text = "Update"; + this.btnaction.UseVisualStyleBackColor = true; + // + // btnclose + // + this.btnclose.Location = new System.Drawing.Point(4, 4); + this.btnclose.Name = "btnclose"; + this.btnclose.Size = new System.Drawing.Size(75, 23); + this.btnclose.TabIndex = 0; + this.btnclose.Text = "{CLOSE}"; + this.btnclose.UseVisualStyleBackColor = true; + this.btnclose.Click += new System.EventHandler(this.btnclose_Click); + // // wbstatus // this.wbstatus.Dock = System.Windows.Forms.DockStyle.Fill; diff --git a/ShiftOS.WinForms/Resources/Shiftorium.txt b/ShiftOS.WinForms/Resources/Shiftorium.txt index 5310c40..adf187e 100644 --- a/ShiftOS.WinForms/Resources/Shiftorium.txt +++ b/ShiftOS.WinForms/Resources/Shiftorium.txt @@ -945,6 +945,15 @@ Description: "In the shiftorium GUI but dont know what you can spend because you can't see how many code points are on hand? Well shop easy, because with this upgrade that is now possible! You have to restart the shiftorium for it to work." }, + //ADVANCED APP LAUNCHER + { + Name: "Advanced App Launcher", + Cost: 10000, + Description: "The app launcher can categorize items and is quite clean, but let's make it even more advanced by adding more than just a traditional menu as the app launcher.", + Dependencies: "app_launcher_categories", + Category: "GUI" + }, + //UPDATE MANAGER { Name: "AL Update Manager", diff --git a/ShiftOS.WinForms/WinformsDesktop.Designer.cs b/ShiftOS.WinForms/WinformsDesktop.Designer.cs index 2348320..3d24c3d 100644 --- a/ShiftOS.WinForms/WinformsDesktop.Designer.cs +++ b/ShiftOS.WinForms/WinformsDesktop.Designer.cs @@ -61,10 +61,20 @@ namespace ShiftOS.WinForms this.apps = new System.Windows.Forms.ToolStripMenuItem(); this.pnlscreensaver = new System.Windows.Forms.Panel(); this.pnlssicon = new System.Windows.Forms.Panel(); + this.pnladvancedal = new System.Windows.Forms.Panel(); + this.pnlalsystemactions = new System.Windows.Forms.Panel(); + this.btnshutdown = new System.Windows.Forms.Button(); + this.pnlstatus = new System.Windows.Forms.Panel(); + this.lbalstatus = new System.Windows.Forms.Label(); + this.flcategories = new System.Windows.Forms.FlowLayoutPanel(); + this.flapps = new System.Windows.Forms.FlowLayoutPanel(); this.desktoppanel.SuspendLayout(); this.sysmenuholder.SuspendLayout(); this.menuStrip1.SuspendLayout(); this.pnlscreensaver.SuspendLayout(); + this.pnladvancedal.SuspendLayout(); + this.pnlalsystemactions.SuspendLayout(); + this.pnlstatus.SuspendLayout(); this.SuspendLayout(); // // desktoppanel @@ -108,6 +118,7 @@ namespace ShiftOS.WinForms this.lbtime.TabIndex = 0; this.lbtime.Text = "label1"; this.lbtime.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + this.lbtime.Click += new System.EventHandler(this.lbtime_Click); // // panelbuttonholder // @@ -146,6 +157,7 @@ namespace ShiftOS.WinForms this.apps.Size = new System.Drawing.Size(58, 20); this.apps.Tag = "applauncherbutton"; this.apps.Text = "ShiftOS"; + this.apps.Click += new System.EventHandler(this.apps_Click); // // pnlscreensaver // @@ -164,12 +176,83 @@ namespace ShiftOS.WinForms this.pnlssicon.Size = new System.Drawing.Size(200, 100); this.pnlssicon.TabIndex = 0; // + // pnladvancedal + // + this.pnladvancedal.Controls.Add(this.flapps); + this.pnladvancedal.Controls.Add(this.flcategories); + this.pnladvancedal.Controls.Add(this.pnlalsystemactions); + this.pnladvancedal.Controls.Add(this.pnlstatus); + this.pnladvancedal.Location = new System.Drawing.Point(0, 24); + this.pnladvancedal.Name = "pnladvancedal"; + this.pnladvancedal.Size = new System.Drawing.Size(433, 417); + this.pnladvancedal.TabIndex = 1; + this.pnladvancedal.Visible = false; + // + // pnlalsystemactions + // + this.pnlalsystemactions.Controls.Add(this.btnshutdown); + this.pnlalsystemactions.Dock = System.Windows.Forms.DockStyle.Bottom; + this.pnlalsystemactions.Location = new System.Drawing.Point(0, 386); + this.pnlalsystemactions.Name = "pnlalsystemactions"; + this.pnlalsystemactions.Size = new System.Drawing.Size(433, 31); + this.pnlalsystemactions.TabIndex = 1; + // + // btnshutdown + // + this.btnshutdown.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.btnshutdown.AutoSize = true; + this.btnshutdown.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.btnshutdown.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.btnshutdown.Location = new System.Drawing.Point(355, 3); + this.btnshutdown.Name = "btnshutdown"; + this.btnshutdown.Size = new System.Drawing.Size(75, 26); + this.btnshutdown.TabIndex = 0; + this.btnshutdown.Text = "Shutdown"; + this.btnshutdown.UseVisualStyleBackColor = true; + this.btnshutdown.Click += new System.EventHandler(this.btnshutdown_Click); + // + // pnlstatus + // + this.pnlstatus.Controls.Add(this.lbalstatus); + this.pnlstatus.Dock = System.Windows.Forms.DockStyle.Top; + this.pnlstatus.Location = new System.Drawing.Point(0, 0); + this.pnlstatus.Name = "pnlstatus"; + this.pnlstatus.Size = new System.Drawing.Size(433, 58); + this.pnlstatus.TabIndex = 0; + // + // lbalstatus + // + this.lbalstatus.Dock = System.Windows.Forms.DockStyle.Fill; + this.lbalstatus.Location = new System.Drawing.Point(0, 0); + this.lbalstatus.Name = "lbalstatus"; + this.lbalstatus.Size = new System.Drawing.Size(433, 58); + this.lbalstatus.TabIndex = 0; + this.lbalstatus.Text = "michael@system\r\n0 Codepoints\r\n0 installed, 0 available"; + this.lbalstatus.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // flcategories + // + this.flcategories.Dock = System.Windows.Forms.DockStyle.Left; + this.flcategories.Location = new System.Drawing.Point(0, 58); + this.flcategories.Name = "flcategories"; + this.flcategories.Size = new System.Drawing.Size(221, 328); + this.flcategories.TabIndex = 2; + // + // flapps + // + this.flapps.Dock = System.Windows.Forms.DockStyle.Fill; + this.flapps.Location = new System.Drawing.Point(221, 58); + this.flapps.Name = "flapps"; + this.flapps.Size = new System.Drawing.Size(212, 328); + this.flapps.TabIndex = 3; + // // WinformsDesktop // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 14F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.Black; this.ClientSize = new System.Drawing.Size(1296, 738); + this.Controls.Add(this.pnladvancedal); this.Controls.Add(this.pnlscreensaver); this.Controls.Add(this.desktoppanel); this.Font = new System.Drawing.Font("Consolas", 9F); @@ -185,6 +268,10 @@ namespace ShiftOS.WinForms this.menuStrip1.ResumeLayout(false); this.menuStrip1.PerformLayout(); this.pnlscreensaver.ResumeLayout(false); + this.pnladvancedal.ResumeLayout(false); + this.pnlalsystemactions.ResumeLayout(false); + this.pnlalsystemactions.PerformLayout(); + this.pnlstatus.ResumeLayout(false); this.ResumeLayout(false); } @@ -200,6 +287,13 @@ namespace ShiftOS.WinForms private System.Windows.Forms.Button btnnotifications; private System.Windows.Forms.Panel pnlscreensaver; private System.Windows.Forms.Panel pnlssicon; + private System.Windows.Forms.Panel pnladvancedal; + private System.Windows.Forms.Panel pnlalsystemactions; + private System.Windows.Forms.Button btnshutdown; + private System.Windows.Forms.Panel pnlstatus; + private System.Windows.Forms.Label lbalstatus; + private System.Windows.Forms.FlowLayoutPanel flapps; + private System.Windows.Forms.FlowLayoutPanel flcategories; } } diff --git a/ShiftOS.WinForms/WinformsDesktop.cs b/ShiftOS.WinForms/WinformsDesktop.cs index 182c607..a808dd8 100644 --- a/ShiftOS.WinForms/WinformsDesktop.cs +++ b/ShiftOS.WinForms/WinformsDesktop.cs @@ -459,6 +459,8 @@ namespace ShiftOS.WinForms return itm; } + public Dictionary> LauncherItemList = new Dictionary>(); + /// /// Populates the app launcher. /// @@ -472,6 +474,9 @@ namespace ShiftOS.WinForms Dictionary> sortedItems = new Dictionary>(); + flcategories.Controls.Clear(); + + LauncherItemList.Clear(); foreach (var kv in items) @@ -495,11 +500,13 @@ namespace ShiftOS.WinForms if (sortedItems.ContainsKey(kv.DisplayData.Category)) { sortedItems[kv.DisplayData.Category].Add(item); + LauncherItemList[kv.DisplayData.Category].Add(kv); } else { sortedItems.Add(kv.DisplayData.Category, new List()); sortedItems[kv.DisplayData.Category].Add(item); + LauncherItemList.Add(kv.DisplayData.Category, new List { kv }); } } @@ -514,6 +521,22 @@ namespace ShiftOS.WinForms { cat.DropDownItems.Add(subItem); } + if (Shiftorium.UpgradeInstalled("advanced_app_launcher")) + { + var catbtn = new Button(); + catbtn.FlatStyle = FlatStyle.Flat; + catbtn.FlatAppearance.BorderSize = 0; + catbtn.FlatAppearance.MouseOverBackColor = LoadedSkin.Menu_MenuItemSelected; + catbtn.FlatAppearance.MouseDownBackColor = LoadedSkin.Menu_MenuItemPressedGradientBegin; + catbtn.BackColor = LoadedSkin.Menu_ToolStripDropDownBackground; + catbtn.TextAlign = ContentAlignment.MiddleLeft; + catbtn.Text = kv.Key; + catbtn.Width = flcategories.Width; + catbtn.Height = 24; + flcategories.Controls.Add(catbtn); + catbtn.Show(); + catbtn.Click += (o, a) => SetupAdvancedCategory(catbtn.Text); + } } else @@ -545,6 +568,47 @@ namespace ShiftOS.WinForms LuaInterpreter.RaiseEvent("on_al_populate", items); } + public void SetupAdvancedCategory(string cat) + { + flapps.Controls.Clear(); + + foreach(var app in LauncherItemList[cat]) + { + var catbtn = new Button(); + catbtn.FlatStyle = FlatStyle.Flat; + catbtn.FlatAppearance.BorderSize = 0; + catbtn.FlatAppearance.MouseOverBackColor = LoadedSkin.Menu_MenuItemSelected; + catbtn.FlatAppearance.MouseDownBackColor = LoadedSkin.Menu_MenuItemPressedGradientBegin; + catbtn.BackColor = LoadedSkin.Menu_ToolStripDropDownBackground; + catbtn.TextAlign = ContentAlignment.MiddleLeft; + catbtn.Text = (app is LuaLauncherItem) ? app.DisplayData.Name : NameChangerBackend.GetNameRaw(app.LaunchType); + catbtn.Width = flapps.Width; + catbtn.Height = 24; + catbtn.ImageAlign = ContentAlignment.MiddleLeft; + catbtn.Image = (app.LaunchType == null) ? null : SkinEngine.GetIcon(app.LaunchType.Name); + + flapps.Controls.Add(catbtn); + catbtn.Show(); + catbtn.Click += (o, a) => + { + pnladvancedal.Hide(); + if(app is LuaLauncherItem) + { + var interp = new LuaInterpreter(); + interp.ExecuteFile((app as LuaLauncherItem).LaunchPath); + } + else + { + IShiftOSWindow win = Activator.CreateInstance(app.LaunchType) as IShiftOSWindow; + AppearanceManager.SetupWindow(win); + } + + + + }; + + } + } /// /// Desktops the load. @@ -702,6 +766,27 @@ namespace ShiftOS.WinForms { e.Graphics.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality; } + + private void lbtime_Click(object sender, EventArgs e) + { + } + + private void apps_Click(object sender, EventArgs e) + { + if (Shiftorium.UpgradeInstalled("advanced_app_launcher")) + { + flapps.Controls.Clear(); + apps.DropDown.Hide(); + pnladvancedal.Location = new Point(0, (LoadedSkin.DesktopPanelPosition == 0) ? desktoppanel.Height : this.Height - pnladvancedal.Height - desktoppanel.Height); + pnladvancedal.Visible = !pnladvancedal.Visible; + } + + } + + private void btnshutdown_Click(object sender, EventArgs e) + { + TerminalBackend.InvokeCommand("sos.shutdown"); + } } [ShiftOS.Engine.Scripting.Exposed("desktop")] -- cgit v1.2.3 From 538f99faf7b381717079ea700d4f2e6e908537ea Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 16 Apr 2017 13:31:23 -0400 Subject: Begin work on Desktop Widgets --- ShiftOS.WinForms/DesktopWidgetAttribute.cs | 21 ++++ ShiftOS.WinForms/DesktopWidgets/Clock.Designer.cs | 63 ++++++++++++ ShiftOS.WinForms/DesktopWidgets/Clock.cs | 45 ++++++++ ShiftOS.WinForms/DesktopWidgets/Clock.resx | 120 ++++++++++++++++++++++ ShiftOS.WinForms/IDesktopWidget.cs | 51 +++++++++ ShiftOS.WinForms/Resources/Shiftorium.txt | 11 ++ ShiftOS.WinForms/ShiftOS.WinForms.csproj | 12 +++ ShiftOS.WinForms/WidgetManager.cs | 50 +++++++++ ShiftOS.WinForms/WinformsDesktop.Designer.cs | 48 +++++---- ShiftOS.WinForms/WinformsDesktop.cs | 42 ++++++++ 10 files changed, 445 insertions(+), 18 deletions(-) create mode 100644 ShiftOS.WinForms/DesktopWidgetAttribute.cs create mode 100644 ShiftOS.WinForms/DesktopWidgets/Clock.Designer.cs create mode 100644 ShiftOS.WinForms/DesktopWidgets/Clock.cs create mode 100644 ShiftOS.WinForms/DesktopWidgets/Clock.resx create mode 100644 ShiftOS.WinForms/IDesktopWidget.cs create mode 100644 ShiftOS.WinForms/WidgetManager.cs (limited to 'ShiftOS.WinForms/WinformsDesktop.Designer.cs') diff --git a/ShiftOS.WinForms/DesktopWidgetAttribute.cs b/ShiftOS.WinForms/DesktopWidgetAttribute.cs new file mode 100644 index 0000000..28d50ac --- /dev/null +++ b/ShiftOS.WinForms/DesktopWidgetAttribute.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ShiftOS.WinForms +{ + [AttributeUsage(AttributeTargets.Class, AllowMultiple = false)] + public class DesktopWidgetAttribute : Attribute + { + public string Name { get; set; } + public string Description { get; set; } + + public DesktopWidgetAttribute(string n, string desc) + { + Name = n; + Description = desc; + } + } +} diff --git a/ShiftOS.WinForms/DesktopWidgets/Clock.Designer.cs b/ShiftOS.WinForms/DesktopWidgets/Clock.Designer.cs new file mode 100644 index 0000000..a36d386 --- /dev/null +++ b/ShiftOS.WinForms/DesktopWidgets/Clock.Designer.cs @@ -0,0 +1,63 @@ +namespace ShiftOS.WinForms.DesktopWidgets +{ + partial class Clock + { + /// + /// 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.lbtime = new System.Windows.Forms.Label(); + this.SuspendLayout(); + // + // lbtime + // + this.lbtime.BackColor = System.Drawing.Color.Transparent; + this.lbtime.Dock = System.Windows.Forms.DockStyle.Fill; + this.lbtime.Location = new System.Drawing.Point(0, 0); + this.lbtime.Name = "lbtime"; + this.lbtime.Size = new System.Drawing.Size(210, 49); + this.lbtime.TabIndex = 0; + this.lbtime.Tag = "header2 keepbg"; + this.lbtime.Text = "label1"; + this.lbtime.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // Clock + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.BackColor = System.Drawing.Color.Transparent; + this.Controls.Add(this.lbtime); + this.Name = "Clock"; + this.Size = new System.Drawing.Size(210, 49); + this.Tag = "keepbg"; + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.Label lbtime; + } +} diff --git a/ShiftOS.WinForms/DesktopWidgets/Clock.cs b/ShiftOS.WinForms/DesktopWidgets/Clock.cs new file mode 100644 index 0000000..aa29e2e --- /dev/null +++ b/ShiftOS.WinForms/DesktopWidgets/Clock.cs @@ -0,0 +1,45 @@ +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.DesktopWidgets +{ + [DesktopWidget("Clock", "Show a clock on the desktop.")] + [RequiresUpgrade("desktop_clock_widget")] + public partial class Clock : UserControl, IDesktopWidget + { + public Clock() + { + InitializeComponent(); + tmr = new Timer(); + tmr.Tick += (o, a) => + { + lbtime.Text = Applications.Terminal.GetTime(); + }; + tmr.Interval = 100; + } + + Timer tmr = new Timer(); + + public void OnSkinLoad() + { + Tools.ControlManager.SetupControls(this); + } + + public void OnUpgrade() + { + } + + public void Setup() + { + tmr.Start(); + } + } +} diff --git a/ShiftOS.WinForms/DesktopWidgets/Clock.resx b/ShiftOS.WinForms/DesktopWidgets/Clock.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/ShiftOS.WinForms/DesktopWidgets/Clock.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/IDesktopWidget.cs b/ShiftOS.WinForms/IDesktopWidget.cs new file mode 100644 index 0000000..95c373c --- /dev/null +++ b/ShiftOS.WinForms/IDesktopWidget.cs @@ -0,0 +1,51 @@ +using System; +using System.Collections.Generic; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using ShiftOS.Engine; + +namespace ShiftOS.WinForms +{ + /// + /// Provides base functionality for a ShiftOS desktop widget. + /// + public interface IDesktopWidget + { + /// + /// Performs routine setup operations to keep the widget up to date. + /// + void Setup(); + + /// + /// Occurs when a skin is loaded. + /// + void OnSkinLoad(); + + /// + /// Occurs when a Shiftorium upgrade is installed. + /// + void OnUpgrade(); + + /// + /// Hides this desktop widget. + /// + void Hide(); + + /// + /// Shows this desktop widget. + /// + void Show(); + + /// + /// Gets or sets the location on the desktop that this widget resides. + /// + Point Location { get; set; } + + /// + /// Gets or sets this widget's size. + /// + Size Size { get; set; } + } +} diff --git a/ShiftOS.WinForms/Resources/Shiftorium.txt b/ShiftOS.WinForms/Resources/Shiftorium.txt index 82ee613..c18f456 100644 --- a/ShiftOS.WinForms/Resources/Shiftorium.txt +++ b/ShiftOS.WinForms/Resources/Shiftorium.txt @@ -1,4 +1,15 @@ [ + //TEMPORARY + { + Name: "Desktop Widgets", + Cost: 0, + Description: "Temporary upgrade. Will be replaced by either a Shiftnet app or a story element.", + Dependencies: "advanced_app_launcher;wm_free_placement", + Category: "Work-in-progress" + }, + + + // SCREENSAVER { Name: "Screensavers", diff --git a/ShiftOS.WinForms/ShiftOS.WinForms.csproj b/ShiftOS.WinForms/ShiftOS.WinForms.csproj index 9675bb6..a223f47 100644 --- a/ShiftOS.WinForms/ShiftOS.WinForms.csproj +++ b/ShiftOS.WinForms/ShiftOS.WinForms.csproj @@ -257,6 +257,13 @@ Component + + + UserControl + + + Clock.cs + UserControl @@ -271,6 +278,7 @@ + Form @@ -294,6 +302,7 @@ + UserControl @@ -399,6 +408,9 @@ UpdateManager.cs + + Clock.cs + DownloadControl.cs diff --git a/ShiftOS.WinForms/WidgetManager.cs b/ShiftOS.WinForms/WidgetManager.cs new file mode 100644 index 0000000..125c804 --- /dev/null +++ b/ShiftOS.WinForms/WidgetManager.cs @@ -0,0 +1,50 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; +using ShiftOS.Engine; + +namespace ShiftOS.WinForms +{ + public static class WidgetManager + { + public static Dictionary GetAllWidgetTypes() + { + Dictionary types = new Dictionary(); + foreach(var exe in Directory.GetFiles(Environment.CurrentDirectory)) + { + if(exe.EndsWith(".exe") || exe.EndsWith(".dll")) + { + try + { + var asm = Assembly.LoadFile(exe); + foreach(var type in asm.GetTypes()) + { + if (type.GetInterfaces().Contains(typeof(IDesktopWidget))) + { + if (Shiftorium.UpgradeAttributesUnlocked(type)) + { + foreach (var attrib in type.GetCustomAttributes(false)) + { + if (attrib is DesktopWidgetAttribute) + { + var dw = attrib as DesktopWidgetAttribute; + types.Add(dw, type); + } + } + } + } + } + } + catch { } + } + } + return types; + } + + + } +} diff --git a/ShiftOS.WinForms/WinformsDesktop.Designer.cs b/ShiftOS.WinForms/WinformsDesktop.Designer.cs index 3d24c3d..71ef161 100644 --- a/ShiftOS.WinForms/WinformsDesktop.Designer.cs +++ b/ShiftOS.WinForms/WinformsDesktop.Designer.cs @@ -60,14 +60,15 @@ namespace ShiftOS.WinForms this.menuStrip1 = new System.Windows.Forms.MenuStrip(); this.apps = new System.Windows.Forms.ToolStripMenuItem(); this.pnlscreensaver = new System.Windows.Forms.Panel(); + this.pnlwidgetlayer = new System.Windows.Forms.Panel(); this.pnlssicon = new System.Windows.Forms.Panel(); this.pnladvancedal = new System.Windows.Forms.Panel(); + this.flapps = new System.Windows.Forms.FlowLayoutPanel(); + this.flcategories = new System.Windows.Forms.FlowLayoutPanel(); this.pnlalsystemactions = new System.Windows.Forms.Panel(); this.btnshutdown = new System.Windows.Forms.Button(); this.pnlstatus = new System.Windows.Forms.Panel(); this.lbalstatus = new System.Windows.Forms.Label(); - this.flcategories = new System.Windows.Forms.FlowLayoutPanel(); - this.flapps = new System.Windows.Forms.FlowLayoutPanel(); this.desktoppanel.SuspendLayout(); this.sysmenuholder.SuspendLayout(); this.menuStrip1.SuspendLayout(); @@ -169,6 +170,15 @@ namespace ShiftOS.WinForms this.pnlscreensaver.TabIndex = 1; this.pnlscreensaver.Visible = false; // + // pnlwidgetlayer + // + this.pnlwidgetlayer.BackColor = System.Drawing.Color.Transparent; + this.pnlwidgetlayer.Dock = System.Windows.Forms.DockStyle.Fill; + this.pnlwidgetlayer.Location = new System.Drawing.Point(0, 24); + this.pnlwidgetlayer.Name = "pnlwidgetlayer"; + this.pnlwidgetlayer.Size = new System.Drawing.Size(1296, 714); + this.pnlwidgetlayer.TabIndex = 1; + // // pnlssicon // this.pnlssicon.Location = new System.Drawing.Point(303, 495); @@ -188,6 +198,22 @@ namespace ShiftOS.WinForms this.pnladvancedal.TabIndex = 1; this.pnladvancedal.Visible = false; // + // flapps + // + this.flapps.Dock = System.Windows.Forms.DockStyle.Fill; + this.flapps.Location = new System.Drawing.Point(221, 58); + this.flapps.Name = "flapps"; + this.flapps.Size = new System.Drawing.Size(212, 328); + this.flapps.TabIndex = 3; + // + // flcategories + // + this.flcategories.Dock = System.Windows.Forms.DockStyle.Left; + this.flcategories.Location = new System.Drawing.Point(0, 58); + this.flcategories.Name = "flcategories"; + this.flcategories.Size = new System.Drawing.Size(221, 328); + this.flcategories.TabIndex = 2; + // // pnlalsystemactions // this.pnlalsystemactions.Controls.Add(this.btnshutdown); @@ -230,28 +256,13 @@ namespace ShiftOS.WinForms this.lbalstatus.Text = "michael@system\r\n0 Codepoints\r\n0 installed, 0 available"; this.lbalstatus.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // - // flcategories - // - this.flcategories.Dock = System.Windows.Forms.DockStyle.Left; - this.flcategories.Location = new System.Drawing.Point(0, 58); - this.flcategories.Name = "flcategories"; - this.flcategories.Size = new System.Drawing.Size(221, 328); - this.flcategories.TabIndex = 2; - // - // flapps - // - this.flapps.Dock = System.Windows.Forms.DockStyle.Fill; - this.flapps.Location = new System.Drawing.Point(221, 58); - this.flapps.Name = "flapps"; - this.flapps.Size = new System.Drawing.Size(212, 328); - this.flapps.TabIndex = 3; - // // WinformsDesktop // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 14F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.Black; this.ClientSize = new System.Drawing.Size(1296, 738); + this.Controls.Add(this.pnlwidgetlayer); this.Controls.Add(this.pnladvancedal); this.Controls.Add(this.pnlscreensaver); this.Controls.Add(this.desktoppanel); @@ -294,6 +305,7 @@ namespace ShiftOS.WinForms private System.Windows.Forms.Label lbalstatus; private System.Windows.Forms.FlowLayoutPanel flapps; private System.Windows.Forms.FlowLayoutPanel flcategories; + private System.Windows.Forms.Panel pnlwidgetlayer; } } diff --git a/ShiftOS.WinForms/WinformsDesktop.cs b/ShiftOS.WinForms/WinformsDesktop.cs index cd74a6b..3050cdf 100644 --- a/ShiftOS.WinForms/WinformsDesktop.cs +++ b/ShiftOS.WinForms/WinformsDesktop.cs @@ -49,6 +49,9 @@ namespace ShiftOS.WinForms /// public partial class WinformsDesktop : Form, IDesktop { + public List Widgets = new List(); + + private bool InScreensaver = false; private int millisecondsUntilScreensaver = 300000; @@ -65,6 +68,11 @@ namespace ShiftOS.WinForms SetupControl(desktoppanel); Shiftorium.Installed += () => { + foreach(var widget in Widgets) + { + widget.OnUpgrade(); + } + //Only if the DevX Legions story hasn't been experienced yet. if (!Shiftorium.UpgradeInstalled("devx_legions")) { @@ -161,6 +169,11 @@ namespace ShiftOS.WinForms }; SkinEngine.SkinLoaded += () => { + foreach (var widget in Widgets) + { + widget.OnSkinLoad(); + } + SetupDesktop(); }; time.Tick += (o, a) => @@ -429,6 +442,34 @@ namespace ShiftOS.WinForms desktoppanel.Dock = DockStyle.Top; } } + + pnlwidgetlayer.Show(); + pnlwidgetlayer.BringToFront(); + + if (Shiftorium.UpgradeInstalled("desktop_widgets")) + { + Widgets.Clear(); + foreach(var widget in WidgetManager.GetAllWidgetTypes()) + { + UserControl w = (UserControl)Activator.CreateInstance(widget.Value, null); + pnlwidgetlayer.Controls.Add(w); + Widgets.Add(w as IDesktopWidget); + } + } + + foreach (var widget in Widgets) + { + if (Shiftorium.UpgradeInstalled("desktop_widgets")) + { + widget.Setup(); + widget.Show(); + } + else + { + widget.Hide(); + } + } + } else { @@ -851,6 +892,7 @@ namespace ShiftOS.WinForms apps.DropDown.Hide(); pnladvancedal.Location = new Point(0, (LoadedSkin.DesktopPanelPosition == 0) ? desktoppanel.Height : this.Height - pnladvancedal.Height - desktoppanel.Height); pnladvancedal.Visible = !pnladvancedal.Visible; + pnladvancedal.BringToFront(); } } -- cgit v1.2.3 From b1cace7807f28deff51f06665d544a4246879a82 Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 13 May 2017 15:51:19 -0400 Subject: Newer notification system (PANEL ICONS :D) --- ShiftOS.WinForms/Properties/Resources.Designer.cs | 10 ++ ShiftOS.WinForms/Properties/Resources.resx | 3 + .../Resources/notestate_connection_full.bmp | Bin 0 -> 3382 bytes ShiftOS.WinForms/ShiftOS.WinForms.csproj | 1 + ShiftOS.WinForms/WinformsDesktop.Designer.cs | 130 ++++++++++++++++----- ShiftOS.WinForms/WinformsDesktop.cs | 78 ++++++++----- ShiftOS.WinForms/WinformsDesktop.resx | 3 + ShiftOS_TheReturn/AppearanceManager.cs | 5 +- ShiftOS_TheReturn/Desktop.cs | 17 ++- ShiftOS_TheReturn/ServerManager.cs | 1 + ShiftOS_TheReturn/Skinning.cs | 8 ++ 11 files changed, 200 insertions(+), 56 deletions(-) create mode 100644 ShiftOS.WinForms/Resources/notestate_connection_full.bmp (limited to 'ShiftOS.WinForms/WinformsDesktop.Designer.cs') diff --git a/ShiftOS.WinForms/Properties/Resources.Designer.cs b/ShiftOS.WinForms/Properties/Resources.Designer.cs index 0152be8..3e83c3f 100644 --- a/ShiftOS.WinForms/Properties/Resources.Designer.cs +++ b/ShiftOS.WinForms/Properties/Resources.Designer.cs @@ -1048,6 +1048,16 @@ namespace ShiftOS.WinForms.Properties { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap notestate_connection_full { + get { + object obj = ResourceManager.GetObject("notestate_connection_full", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// diff --git a/ShiftOS.WinForms/Properties/Resources.resx b/ShiftOS.WinForms/Properties/Resources.resx index a90e69b..1db7a46 100644 --- a/ShiftOS.WinForms/Properties/Resources.resx +++ b/ShiftOS.WinForms/Properties/Resources.resx @@ -34600,4 +34600,7 @@ ..\Resources\Ambient9.mp3;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + ..\Resources\notestate_connection_full.bmp;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/ShiftOS.WinForms/Resources/notestate_connection_full.bmp b/ShiftOS.WinForms/Resources/notestate_connection_full.bmp new file mode 100644 index 0000000..a4e15b3 Binary files /dev/null and b/ShiftOS.WinForms/Resources/notestate_connection_full.bmp differ diff --git a/ShiftOS.WinForms/ShiftOS.WinForms.csproj b/ShiftOS.WinForms/ShiftOS.WinForms.csproj index 1079203..89da4e1 100644 --- a/ShiftOS.WinForms/ShiftOS.WinForms.csproj +++ b/ShiftOS.WinForms/ShiftOS.WinForms.csproj @@ -771,6 +771,7 @@ + diff --git a/ShiftOS.WinForms/WinformsDesktop.Designer.cs b/ShiftOS.WinForms/WinformsDesktop.Designer.cs index 71ef161..968a31c 100644 --- a/ShiftOS.WinForms/WinformsDesktop.Designer.cs +++ b/ShiftOS.WinForms/WinformsDesktop.Designer.cs @@ -53,15 +53,20 @@ namespace ShiftOS.WinForms private void InitializeComponent() { this.desktoppanel = new System.Windows.Forms.Panel(); - this.btnnotifications = new System.Windows.Forms.Button(); + this.pnlnotifications = new System.Windows.Forms.Panel(); + this.flnotifications = new System.Windows.Forms.FlowLayoutPanel(); this.lbtime = new System.Windows.Forms.Label(); this.panelbuttonholder = new System.Windows.Forms.FlowLayoutPanel(); this.sysmenuholder = new System.Windows.Forms.Panel(); this.menuStrip1 = new System.Windows.Forms.MenuStrip(); this.apps = new System.Windows.Forms.ToolStripMenuItem(); this.pnlscreensaver = new System.Windows.Forms.Panel(); - this.pnlwidgetlayer = new System.Windows.Forms.Panel(); this.pnlssicon = new System.Windows.Forms.Panel(); + this.pnlwidgetlayer = new System.Windows.Forms.Panel(); + this.ntconnectionstatus = new System.Windows.Forms.PictureBox(); + this.pnlnotificationbox = new System.Windows.Forms.Panel(); + this.lbnotemsg = new System.Windows.Forms.Label(); + this.lbnotetitle = new System.Windows.Forms.Label(); this.pnladvancedal = new System.Windows.Forms.Panel(); this.flapps = new System.Windows.Forms.FlowLayoutPanel(); this.flcategories = new System.Windows.Forms.FlowLayoutPanel(); @@ -70,9 +75,13 @@ namespace ShiftOS.WinForms this.pnlstatus = new System.Windows.Forms.Panel(); this.lbalstatus = new System.Windows.Forms.Label(); this.desktoppanel.SuspendLayout(); + this.pnlnotifications.SuspendLayout(); + this.flnotifications.SuspendLayout(); this.sysmenuholder.SuspendLayout(); this.menuStrip1.SuspendLayout(); this.pnlscreensaver.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.ntconnectionstatus)).BeginInit(); + this.pnlnotificationbox.SuspendLayout(); this.pnladvancedal.SuspendLayout(); this.pnlalsystemactions.SuspendLayout(); this.pnlstatus.SuspendLayout(); @@ -81,8 +90,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.pnlnotifications); this.desktoppanel.Controls.Add(this.panelbuttonholder); this.desktoppanel.Controls.Add(this.sysmenuholder); this.desktoppanel.Dock = System.Windows.Forms.DockStyle.Top; @@ -92,28 +100,34 @@ namespace ShiftOS.WinForms this.desktoppanel.TabIndex = 0; this.desktoppanel.Paint += new System.Windows.Forms.PaintEventHandler(this.desktoppanel_Paint); // - // 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); + // pnlnotifications + // + this.pnlnotifications.Controls.Add(this.flnotifications); + this.pnlnotifications.Controls.Add(this.lbtime); + this.pnlnotifications.Cursor = System.Windows.Forms.Cursors.Default; + this.pnlnotifications.Dock = System.Windows.Forms.DockStyle.Right; + this.pnlnotifications.Location = new System.Drawing.Point(1096, 0); + this.pnlnotifications.Name = "pnlnotifications"; + this.pnlnotifications.Size = new System.Drawing.Size(200, 24); + this.pnlnotifications.TabIndex = 3; + // + // flnotifications + // + this.flnotifications.AutoSize = true; + this.flnotifications.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.flnotifications.Controls.Add(this.ntconnectionstatus); + this.flnotifications.Dock = System.Windows.Forms.DockStyle.Left; + this.flnotifications.Location = new System.Drawing.Point(0, 0); + this.flnotifications.Name = "flnotifications"; + this.flnotifications.Size = new System.Drawing.Size(22, 24); + this.flnotifications.TabIndex = 1; // // lbtime // this.lbtime.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Right))); this.lbtime.AutoSize = true; - this.lbtime.Location = new System.Drawing.Point(3, 0); + this.lbtime.Location = new System.Drawing.Point(139, 7); this.lbtime.Name = "lbtime"; this.lbtime.Size = new System.Drawing.Size(49, 14); this.lbtime.TabIndex = 0; @@ -170,6 +184,13 @@ namespace ShiftOS.WinForms this.pnlscreensaver.TabIndex = 1; this.pnlscreensaver.Visible = false; // + // pnlssicon + // + this.pnlssicon.Location = new System.Drawing.Point(303, 495); + this.pnlssicon.Name = "pnlssicon"; + this.pnlssicon.Size = new System.Drawing.Size(200, 100); + this.pnlssicon.TabIndex = 0; + // // pnlwidgetlayer // this.pnlwidgetlayer.BackColor = System.Drawing.Color.Transparent; @@ -179,12 +200,53 @@ namespace ShiftOS.WinForms this.pnlwidgetlayer.Size = new System.Drawing.Size(1296, 714); this.pnlwidgetlayer.TabIndex = 1; // - // pnlssicon - // - this.pnlssicon.Location = new System.Drawing.Point(303, 495); - this.pnlssicon.Name = "pnlssicon"; - this.pnlssicon.Size = new System.Drawing.Size(200, 100); - this.pnlssicon.TabIndex = 0; + // ntconnectionstatus + // + this.ntconnectionstatus.Image = global::ShiftOS.WinForms.Properties.Resources.notestate_connection_full; + this.ntconnectionstatus.Location = new System.Drawing.Point(3, 3); + this.ntconnectionstatus.Name = "ntconnectionstatus"; + this.ntconnectionstatus.Size = new System.Drawing.Size(16, 16); + this.ntconnectionstatus.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; + this.ntconnectionstatus.TabIndex = 0; + this.ntconnectionstatus.TabStop = false; + this.ntconnectionstatus.Tag = "digitalsociety"; + // + // pnlnotificationbox + // + this.pnlnotificationbox.AutoSize = true; + this.pnlnotificationbox.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.pnlnotificationbox.Controls.Add(this.lbnotemsg); + this.pnlnotificationbox.Controls.Add(this.lbnotetitle); + this.pnlnotificationbox.Location = new System.Drawing.Point(654, 111); + this.pnlnotificationbox.Name = "pnlnotificationbox"; + this.pnlnotificationbox.Size = new System.Drawing.Size(69, 68); + this.pnlnotificationbox.TabIndex = 0; + this.pnlnotificationbox.Visible = false; + // + // lbnotemsg + // + this.lbnotemsg.AutoSize = true; + this.lbnotemsg.Dock = System.Windows.Forms.DockStyle.Fill; + this.lbnotemsg.Location = new System.Drawing.Point(0, 34); + this.lbnotemsg.MaximumSize = new System.Drawing.Size(350, 0); + this.lbnotemsg.Name = "lbnotemsg"; + this.lbnotemsg.Padding = new System.Windows.Forms.Padding(10); + this.lbnotemsg.Size = new System.Drawing.Size(69, 34); + this.lbnotemsg.TabIndex = 1; + this.lbnotemsg.Text = "label1"; + // + // lbnotetitle + // + this.lbnotetitle.AutoSize = true; + this.lbnotetitle.Dock = System.Windows.Forms.DockStyle.Top; + this.lbnotetitle.Location = new System.Drawing.Point(0, 0); + this.lbnotetitle.Margin = new System.Windows.Forms.Padding(10); + this.lbnotetitle.Name = "lbnotetitle"; + this.lbnotetitle.Padding = new System.Windows.Forms.Padding(10); + this.lbnotetitle.Size = new System.Drawing.Size(69, 34); + this.lbnotetitle.TabIndex = 0; + this.lbnotetitle.Tag = "header2"; + this.lbnotetitle.Text = "label1"; // // pnladvancedal // @@ -262,6 +324,7 @@ namespace ShiftOS.WinForms this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.Black; this.ClientSize = new System.Drawing.Size(1296, 738); + this.Controls.Add(this.pnlnotificationbox); this.Controls.Add(this.pnlwidgetlayer); this.Controls.Add(this.pnladvancedal); this.Controls.Add(this.pnlscreensaver); @@ -274,16 +337,24 @@ namespace ShiftOS.WinForms this.Load += new System.EventHandler(this.Desktop_Load); this.desktoppanel.ResumeLayout(false); this.desktoppanel.PerformLayout(); + this.pnlnotifications.ResumeLayout(false); + this.pnlnotifications.PerformLayout(); + this.flnotifications.ResumeLayout(false); + this.flnotifications.PerformLayout(); this.sysmenuholder.ResumeLayout(false); this.sysmenuholder.PerformLayout(); this.menuStrip1.ResumeLayout(false); this.menuStrip1.PerformLayout(); this.pnlscreensaver.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.ntconnectionstatus)).EndInit(); + this.pnlnotificationbox.ResumeLayout(false); + this.pnlnotificationbox.PerformLayout(); this.pnladvancedal.ResumeLayout(false); this.pnlalsystemactions.ResumeLayout(false); this.pnlalsystemactions.PerformLayout(); this.pnlstatus.ResumeLayout(false); this.ResumeLayout(false); + this.PerformLayout(); } @@ -295,7 +366,6 @@ 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; private System.Windows.Forms.Panel pnlscreensaver; private System.Windows.Forms.Panel pnlssicon; private System.Windows.Forms.Panel pnladvancedal; @@ -306,6 +376,12 @@ namespace ShiftOS.WinForms private System.Windows.Forms.FlowLayoutPanel flapps; private System.Windows.Forms.FlowLayoutPanel flcategories; private System.Windows.Forms.Panel pnlwidgetlayer; + private System.Windows.Forms.Panel pnlnotifications; + private System.Windows.Forms.FlowLayoutPanel flnotifications; + private System.Windows.Forms.Panel pnlnotificationbox; + private System.Windows.Forms.Label lbnotemsg; + private System.Windows.Forms.Label lbnotetitle; + private System.Windows.Forms.PictureBox ntconnectionstatus; } } diff --git a/ShiftOS.WinForms/WinformsDesktop.cs b/ShiftOS.WinForms/WinformsDesktop.cs index 4efef1b..15ecb7a 100644 --- a/ShiftOS.WinForms/WinformsDesktop.cs +++ b/ShiftOS.WinForms/WinformsDesktop.cs @@ -54,6 +54,38 @@ namespace ShiftOS.WinForms private int millisecondsUntilScreensaver = 300000; + public void PushNotification(string app, string title, string msg) + { + lbnotemsg.Text = msg; + lbnotetitle.Text = title; + + var ctl = flnotifications.Controls.ToList().FirstOrDefault(x => x.Tag.ToString() == app); + if (ctl == null) + pnlnotificationbox.Left = desktoppanel.Width - pnlnotificationbox.Width; + else + { + int left = ctl.PointToScreen(ctl.Location).X; + int realleft = left - pnlnotificationbox.Width; + realleft += ctl.Width; + pnlnotificationbox.Left = realleft; + } + + + if (LoadedSkin.DesktopPanelPosition == 0) + pnlnotificationbox.Top = desktoppanel.Height; + else + pnlnotificationbox.Top = this.Height - desktoppanel.Height - pnlnotificationbox.Height; + var notekiller = new System.Windows.Forms.Timer(); + notekiller.Interval = 10000; + notekiller.Tick += (o, a) => + { + pnlnotificationbox.Hide(); + }; + Engine.AudioManager.PlayStream(Properties.Resources.infobox); + pnlnotificationbox.Show(); + notekiller.Start(); + } + /// /// Initializes a new instance of the class. /// @@ -105,24 +137,6 @@ namespace ShiftOS.WinForms }; this.TopMost = false; - NotificationDaemon.NotificationMade += (note) => - { - //Soon this will pop a balloon note. - this.Invoke(new Action(() => - { - btnnotifications.Text = Localization.Parse("{NOTIFICATIONS} (" + NotificationDaemon.GetUnreadCount().ToString() + ")"); - })); - }; - - NotificationDaemon.NotificationRead += () => - { - //Soon this will pop a balloon note. - this.Invoke(new Action(() => - { - btnnotifications.Text = Localization.Parse("{NOTIFICATIONS} (" + NotificationDaemon.GetUnreadCount().ToString() + ")"); - })); - }; - this.LocationChanged += (o, a) => { if (this.Left != 0) @@ -143,10 +157,6 @@ namespace ShiftOS.WinForms { if (this.Visible == true) this.Invoke(new Action(() => SetupDesktop())); - this.Invoke(new Action(() => - { - btnnotifications.Text = Localization.Parse("{NOTIFICATIONS} (" + NotificationDaemon.GetUnreadCount().ToString() + ")"); - })); }; Shiftorium.Installed += () => { @@ -187,8 +197,10 @@ namespace ShiftOS.WinForms if (SaveSystem.CurrentSave != null && TutorialManager.IsInTutorial == false) { lbtime.Text = Applications.Terminal.GetTime(); - lbtime.Left = desktoppanel.Width - lbtime.Width - LoadedSkin.DesktopPanelClockFromRight.X; + lbtime.Left = pnlnotifications.Width - lbtime.Width - LoadedSkin.DesktopPanelClockFromRight.X; lbtime.Top = LoadedSkin.DesktopPanelClockFromRight.Y; + + pnlnotifications.Width = flnotifications.Width + lbtime.Width + LoadedSkin.DesktopPanelClockFromRight.X; } } @@ -215,8 +227,6 @@ namespace ShiftOS.WinForms catch { } - btnnotifications.Left = lbtime.Left - btnnotifications.Width - 2; - btnnotifications.Top = (desktoppanel.Height - btnnotifications.Height) / 2; }; time.Start(); @@ -372,10 +382,13 @@ namespace ShiftOS.WinForms desktoppanel.Visible = Shiftorium.UpgradeInstalled("desktop"); lbtime.Visible = Shiftorium.UpgradeInstalled("desktop_clock_widget"); - btnnotifications.Visible = Shiftorium.UpgradeInstalled("panel_notifications"); + ControlManager.SetupControls(pnlnotificationbox); //skinning - lbtime.ForeColor = LoadedSkin.DesktopPanelClockColor; + lbtime.BackColor = Color.Transparent; + pnlnotifications.BackgroundImage = GetImage("panelclockbg"); + pnlnotifications.BackgroundImageLayout = GetImageLayout("panelclockbg"); + pnlnotifications.BackColor = LoadedSkin.DesktopPanelClockBackgroundColor; panelbuttonholder.Top = 0; panelbuttonholder.Left = LoadedSkin.PanelButtonHolderFromLeft; @@ -1060,4 +1073,15 @@ namespace ShiftOS.WinForms } } } + + public static class ControlCollectionExtensions + { + public static IList ToList(this Control.ControlCollection ctrls) + { + var lst = new List(); + foreach (var ctl in ctrls) + lst.Add(ctl as Control); + return lst; + } + } } \ No newline at end of file diff --git a/ShiftOS.WinForms/WinformsDesktop.resx b/ShiftOS.WinForms/WinformsDesktop.resx index d5494e3..b77504b 100644 --- a/ShiftOS.WinForms/WinformsDesktop.resx +++ b/ShiftOS.WinForms/WinformsDesktop.resx @@ -120,4 +120,7 @@ 17, 17 + + 17, 17 + \ No newline at end of file diff --git a/ShiftOS_TheReturn/AppearanceManager.cs b/ShiftOS_TheReturn/AppearanceManager.cs index d8004bc..a10f419 100644 --- a/ShiftOS_TheReturn/AppearanceManager.cs +++ b/ShiftOS_TheReturn/AppearanceManager.cs @@ -226,7 +226,10 @@ namespace ShiftOS.Engine OnExit?.Invoke(); //disconnect from MUD ServerManager.Disconnect(); - Environment.Exit(0); + Desktop.InvokeOnWorkerThread(() => + { + Environment.Exit(0); + }); } /// diff --git a/ShiftOS_TheReturn/Desktop.cs b/ShiftOS_TheReturn/Desktop.cs index bc17a8e..a5e7f43 100644 --- a/ShiftOS_TheReturn/Desktop.cs +++ b/ShiftOS_TheReturn/Desktop.cs @@ -102,7 +102,14 @@ namespace ShiftOS.Engine /// Gets the name of the desktop. /// string DesktopName { get; } - + + /// + /// Show a notification on the desktop. + /// + /// An application ID (for determining what system icon to show the notification alongside) + /// The title of the notification. + /// Isn't this.... self explanatory? + void PushNotification(string app, string title, string message); /// /// Performs most of the skinning and layout handling for the desktop. @@ -266,6 +273,14 @@ namespace ShiftOS.Engine { _desktop.HideAppLauncher(); } + + public static void PushNotification(string app, string title, string msg) + { + InvokeOnWorkerThread(() => + { + _desktop.PushNotification(app, title, msg); + }); + } } // sorry i almost killed everything :P } diff --git a/ShiftOS_TheReturn/ServerManager.cs b/ShiftOS_TheReturn/ServerManager.cs index 825064b..371d8e7 100644 --- a/ShiftOS_TheReturn/ServerManager.cs +++ b/ShiftOS_TheReturn/ServerManager.cs @@ -131,6 +131,7 @@ namespace ShiftOS.Engine { if (!UserDisconnect) { + Desktop.PushNotification("digital_society_connection", "Disconnected from Digital Society.", "The ShiftOS kernel has been disconnected from the Digital Society. We are attempting to re-connect you."); TerminalBackend.PrefixEnabled = true; ConsoleEx.ForegroundColor = ConsoleColor.Red; ConsoleEx.Bold = true; diff --git a/ShiftOS_TheReturn/Skinning.cs b/ShiftOS_TheReturn/Skinning.cs index 548e80f..4340f1a 100644 --- a/ShiftOS_TheReturn/Skinning.cs +++ b/ShiftOS_TheReturn/Skinning.cs @@ -276,6 +276,14 @@ namespace ShiftOS.Engine [ShifterHidden] public Dictionary AppIcons = new Dictionary(); + [Image("panelclockbg")] + [ShifterMeta("Desktop")] + [ShifterCategory("Panel Clock")] + [ShifterName("Panel Clock Background Image")] + [ShifterDescription("Set the background image of the panel clock.")] + [RequiresUpgrade("skinning;shift_panel_clock")] + public byte[] PanelClockBG = null; + [ShifterMeta("System")] [ShifterCategory("Login Screen")] [RequiresUpgrade("gui_based_login_screen")] -- cgit v1.2.3