From a10440a45c40652b13e883aec832a0c8ded685e8 Mon Sep 17 00:00:00 2001 From: John T Date: Sun, 5 Nov 2017 18:47:46 -0500 Subject: Added a half-complete ShiftFS and did some code cleanup --- ShiftOS.Main/ShiftOS/Desktop.cs | 96 +++++++++++++++++++++-------------------- 1 file changed, 50 insertions(+), 46 deletions(-) (limited to 'ShiftOS.Main/ShiftOS/Desktop.cs') diff --git a/ShiftOS.Main/ShiftOS/Desktop.cs b/ShiftOS.Main/ShiftOS/Desktop.cs index 66392a7..9bfcb0f 100644 --- a/ShiftOS.Main/ShiftOS/Desktop.cs +++ b/ShiftOS.Main/ShiftOS/Desktop.cs @@ -1,14 +1,10 @@ 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.Misc; using ShiftOS.Engine.WindowManager; -using ShiftOS.Engine; +using ShiftOS.Main.Properties; +using ShiftOS.Main.ShiftOS.Apps; namespace ShiftOS.Main.ShiftOS { @@ -20,56 +16,64 @@ namespace ShiftOS.Main.ShiftOS timer1.Start(); - this.Closed += (sender, args) => - { - Application.Exit(); - }; + Closed += (sender, args) => { Application.Exit(); }; #region Disgusting taskbar code - ShiftWM.Windows.CollectionChanged += (sender, args) => + ShiftWm.Windows.CollectionChanged += (sender, args) => { - args.NewItems?.OfType().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().ToList().ForEach(window => - { - taskbar.Invoke(new Action(() => - { - var tbRemovalList = taskbar.Items.OfType().Where(i => (uint) i.Tag == window.Id); + args.NewItems?.OfType() + .ToList() + .ForEach( + window => + { + taskbar.Invoke( + new Action( + () => + { + taskbar.Items.Add( + new ToolStripButton + { + Text = window.Title.Text, + Image = window.Icon.ToBitmap(), + Tag = window.Id + }); + })); + }); - tbRemovalList.ToList().ForEach(p => taskbar.Items.Remove(p)); - })); - }); + args.OldItems?.OfType() + .ToList() + .ForEach( + window => + { + taskbar.Invoke( + new Action( + () => + { + var tbRemovalList = taskbar.Items.OfType().Where(i => (uint) i.Tag == window.Id); + + tbRemovalList.ToList().ForEach(p => taskbar.Items.Remove(p)); + })); + }); }; #endregion } - private void timer1_Tick(object sender, EventArgs e) => + void timer1_Tick(object sender, EventArgs e) => taskbarClock.Text = $"{DateTime.Now:t}"; - private void terminalToolStripMenuItem_Click(object sender, EventArgs e) - { - Apps.Terminal trm = new Apps.Terminal(); + void terminalToolStripMenuItem_Click(object sender, EventArgs e) + { + var trm = new Terminal(); - ShiftWM.Init(trm, "Terminal", null, false, true); - } + ShiftWm.Init(trm, "Terminal", null); + } - private void textPadToolStripMenuItem_Click(object sender, EventArgs e) - { - var tp = new Apps.TextPad(); - ShiftWM.Init(tp, "TextPad", Properties.Resources.iconTextPad.ToIcon()); - } - } -} + void textPadToolStripMenuItem_Click(object sender, EventArgs e) + { + var tp = new TextPad(); + ShiftWm.Init(tp, "TextPad", Resources.iconTextPad.ToIcon()); + } + } +} \ No newline at end of file -- cgit v1.2.3