aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS.WinForms
diff options
context:
space:
mode:
authorMichael <[email protected]>2017-05-13 15:51:19 -0400
committerMichael <[email protected]>2017-05-13 15:51:19 -0400
commitb1cace7807f28deff51f06665d544a4246879a82 (patch)
tree4d5cc480d8af931e65052c40b04fbdd7f4290a5a /ShiftOS.WinForms
parentc0f0e99f9d2a092209e710107c1f061fc8a2eaca (diff)
downloadshiftos_thereturn-b1cace7807f28deff51f06665d544a4246879a82.tar.gz
shiftos_thereturn-b1cace7807f28deff51f06665d544a4246879a82.tar.bz2
shiftos_thereturn-b1cace7807f28deff51f06665d544a4246879a82.zip
Newer notification system (PANEL ICONS :D)
Diffstat (limited to 'ShiftOS.WinForms')
-rw-r--r--ShiftOS.WinForms/Properties/Resources.Designer.cs10
-rw-r--r--ShiftOS.WinForms/Properties/Resources.resx3
-rw-r--r--ShiftOS.WinForms/Resources/notestate_connection_full.bmpbin0 -> 3382 bytes
-rw-r--r--ShiftOS.WinForms/ShiftOS.WinForms.csproj1
-rw-r--r--ShiftOS.WinForms/WinformsDesktop.Designer.cs130
-rw-r--r--ShiftOS.WinForms/WinformsDesktop.cs78
-rw-r--r--ShiftOS.WinForms/WinformsDesktop.resx3
7 files changed, 171 insertions, 54 deletions
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
@@ -1051,6 +1051,16 @@ namespace ShiftOS.WinForms.Properties {
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
+ internal static System.Drawing.Bitmap notestate_connection_full {
+ get {
+ object obj = ResourceManager.GetObject("notestate_connection_full", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized resource of type System.Drawing.Bitmap.
+ /// </summary>
internal static System.Drawing.Bitmap RegularDesktopGlyph {
get {
object obj = ResourceManager.GetObject("RegularDesktopGlyph", resourceCulture);
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 @@
<data name="Ambient9" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Ambient9.mp3;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
+ <data name="notestate_connection_full" type="System.Resources.ResXFileRef, System.Windows.Forms">
+ <value>..\Resources\notestate_connection_full.bmp;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
+ </data>
</root> \ 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
--- /dev/null
+++ b/ShiftOS.WinForms/Resources/notestate_connection_full.bmp
Binary files 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 @@
<None Include="Resources\typesound.wav" />
<None Include="Resources\writesound.wav" />
<None Include="Resources\SuperDesk screenshot.png" />
+ <None Include="Resources\notestate_connection_full.bmp" />
<Content Include="SystemIcons\iconArtpad.png" />
<Content Include="SystemIcons\iconAudioPlayer.png" />
<Content Include="SystemIcons\iconBitnoteDigger.png" />
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();
+ }
+
/// <summary>
/// Initializes a new instance of the <see cref="ShiftOS.WinForms.WinformsDesktop"/> class.
/// </summary>
@@ -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<Control> ToList(this Control.ControlCollection ctrls)
+ {
+ var lst = new List<Control>();
+ 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 @@
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
+ <metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>17, 17</value>
+ </metadata>
</root> \ No newline at end of file