aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS.Main/ShiftOS/Desktop.cs
diff options
context:
space:
mode:
authorJohn T <[email protected]>2017-09-27 18:32:16 -0400
committerJohn T <[email protected]>2017-09-27 18:32:16 -0400
commita25baf08203237fc2eeeb4b7ca720f7d47f8a666 (patch)
tree2664b08ca0f9b57ed0a9240ab54441ece6ac2d71 /ShiftOS.Main/ShiftOS/Desktop.cs
parentdc7533184a88271bfd2a3aae299532ec7632144d (diff)
downloadshiftos-rewind-a25baf08203237fc2eeeb4b7ca720f7d47f8a666.tar.gz
shiftos-rewind-a25baf08203237fc2eeeb4b7ca720f7d47f8a666.tar.bz2
shiftos-rewind-a25baf08203237fc2eeeb4b7ca720f7d47f8a666.zip
added desktop and some small additions and changes to shiftwm
Diffstat (limited to 'ShiftOS.Main/ShiftOS/Desktop.cs')
-rw-r--r--ShiftOS.Main/ShiftOS/Desktop.cs61
1 files changed, 61 insertions, 0 deletions
diff --git a/ShiftOS.Main/ShiftOS/Desktop.cs b/ShiftOS.Main/ShiftOS/Desktop.cs
new file mode 100644
index 0000000..494222a
--- /dev/null
+++ b/ShiftOS.Main/ShiftOS/Desktop.cs
@@ -0,0 +1,61 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+using ShiftOS.Engine.WindowManager;
+
+namespace ShiftOS.Main.ShiftOS
+{
+ public partial class Desktop : Form
+ {
+ public Desktop()
+ {
+ InitializeComponent();
+
+ timer1.Start();
+
+ this.Closed += (sender, args) =>
+ {
+ Application.Exit();
+ };
+
+ #region Disgusting taskbar code
+
+ ShiftWM.Windows.CollectionChanged += (sender, args) =>
+ {
+ args.NewItems?.OfType<ShiftWindow>().ToList().ForEach(window =>
+ {
+ taskbar.Invoke(new Action(() =>
+ {
+ taskbar.Items.Add(new ToolStripButton
+ {
+ Text = window.Title.Text,
+ Image = window.Icon.ToBitmap(),
+ Tag = window.Id
+ });
+ }));
+ });
+
+ args.OldItems?.OfType<ShiftWindow>().ToList().ForEach(window =>
+ {
+ taskbar.Invoke(new Action(() =>
+ {
+ var tbRemovalList = taskbar.Items.OfType<ToolStripItem>().Where(i => (uint) i.Tag == window.Id);
+
+ tbRemovalList.ToList().ForEach(p => taskbar.Items.Remove(p));
+ }));
+ });
+ };
+
+ #endregion
+ }
+
+ private void timer1_Tick(object sender, EventArgs e) =>
+ taskbarClock.Text = $"{DateTime.Now:t}";
+ }
+}