From a25baf08203237fc2eeeb4b7ca720f7d47f8a666 Mon Sep 17 00:00:00 2001 From: John T Date: Wed, 27 Sep 2017 18:32:16 -0400 Subject: added desktop and some small additions and changes to shiftwm --- ShiftOS.Main/Program.cs | 8 +- ShiftOS.Main/ShiftOS.Main.csproj | 9 ++ ShiftOS.Main/ShiftOS/Apps/ShiftDemo.Designer.cs | 59 +++++--- ShiftOS.Main/ShiftOS/Apps/ShiftDemo.cs | 10 +- .../ShiftOS/Apps/ShifterStuff/SelectColor.cs | 39 +++--- ShiftOS.Main/ShiftOS/Apps/ShifterStuff/Shifter.cs | 11 +- ShiftOS.Main/ShiftOS/Apps/TestForm.Designer.cs | 148 +++++++++++++-------- ShiftOS.Main/ShiftOS/Apps/TestForm.cs | 21 +-- ShiftOS.Main/ShiftOS/Apps/TestForm.resx | 3 + ShiftOS.Main/ShiftOS/Desktop.Designer.cs | 111 ++++++++++++++++ ShiftOS.Main/ShiftOS/Desktop.cs | 61 +++++++++ ShiftOS.Main/ShiftOS/Desktop.resx | 126 ++++++++++++++++++ 12 files changed, 482 insertions(+), 124 deletions(-) create mode 100644 ShiftOS.Main/ShiftOS/Desktop.Designer.cs create mode 100644 ShiftOS.Main/ShiftOS/Desktop.cs create mode 100644 ShiftOS.Main/ShiftOS/Desktop.resx (limited to 'ShiftOS.Main') diff --git a/ShiftOS.Main/Program.cs b/ShiftOS.Main/Program.cs index 5464d8e..10277b0 100644 --- a/ShiftOS.Main/Program.cs +++ b/ShiftOS.Main/Program.cs @@ -1,8 +1,7 @@ using System; -using System.Collections.Generic; -using System.Linq; using System.Threading.Tasks; using System.Windows.Forms; +using ShiftOS.Main.ShiftOS; namespace ShiftOS.Main { @@ -16,7 +15,10 @@ namespace ShiftOS.Main { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); - Application.Run(new TestForm()); + + Parallel.Invoke( + () => Application.Run(new TestForm()), + () => Application.Run(new Desktop())); } } } diff --git a/ShiftOS.Main/ShiftOS.Main.csproj b/ShiftOS.Main/ShiftOS.Main.csproj index 18e842f..c814c14 100644 --- a/ShiftOS.Main/ShiftOS.Main.csproj +++ b/ShiftOS.Main/ShiftOS.Main.csproj @@ -76,6 +76,12 @@ TestForm.cs + + Form + + + Desktop.cs + HijackScreen.cs @@ -101,6 +107,9 @@ TestForm.cs + + Desktop.cs + SettingsSingleFileGenerator Settings.Designer.cs diff --git a/ShiftOS.Main/ShiftOS/Apps/ShiftDemo.Designer.cs b/ShiftOS.Main/ShiftOS/Apps/ShiftDemo.Designer.cs index 5c3a0de..7fd37f0 100644 --- a/ShiftOS.Main/ShiftOS/Apps/ShiftDemo.Designer.cs +++ b/ShiftOS.Main/ShiftOS/Apps/ShiftDemo.Designer.cs @@ -28,32 +28,47 @@ /// private void InitializeComponent() { - this.label1 = new System.Windows.Forms.Label(); - this.SuspendLayout(); - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(18, 16); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(35, 13); - this.label1.TabIndex = 0; - this.label1.Text = "label1"; - // - // ShiftDemo - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add(this.label1); - this.Name = "ShiftDemo"; - this.Size = new System.Drawing.Size(300, 300); - this.ResumeLayout(false); - this.PerformLayout(); + this.label1 = new System.Windows.Forms.Label(); + this.icon = new System.Windows.Forms.PictureBox(); + ((System.ComponentModel.ISupportInitialize)(this.icon)).BeginInit(); + this.SuspendLayout(); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(27, 25); + this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(51, 20); + this.label1.TabIndex = 0; + this.label1.Text = "label1"; + // + // icon + // + this.icon.Location = new System.Drawing.Point(31, 61); + this.icon.Name = "icon"; + this.icon.Size = new System.Drawing.Size(300, 300); + this.icon.TabIndex = 1; + this.icon.TabStop = false; + // + // ShiftDemo + // + this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.icon); + this.Controls.Add(this.label1); + this.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.Name = "ShiftDemo"; + this.Size = new System.Drawing.Size(450, 462); + ((System.ComponentModel.ISupportInitialize)(this.icon)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); } #endregion public System.Windows.Forms.Label label1; - } + private System.Windows.Forms.PictureBox icon; + } } diff --git a/ShiftOS.Main/ShiftOS/Apps/ShiftDemo.cs b/ShiftOS.Main/ShiftOS/Apps/ShiftDemo.cs index 1f400c8..11fc160 100644 --- a/ShiftOS.Main/ShiftOS/Apps/ShiftDemo.cs +++ b/ShiftOS.Main/ShiftOS/Apps/ShiftDemo.cs @@ -7,14 +7,20 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; +using ShiftOS.Engine.WindowManager; namespace ShiftOS.Main { - public partial class ShiftDemo : UserControl + public partial class ShiftDemo : UserControl, IShiftWindowExtensions { public ShiftDemo() { InitializeComponent(); } - } + + public void OnLoaded(ShiftWindow window) + { + icon.Image = this.GetShiftWindow().Icon.ToBitmap(); + } + } } diff --git a/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/SelectColor.cs b/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/SelectColor.cs index 9062947..697e22e 100644 --- a/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/SelectColor.cs +++ b/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/SelectColor.cs @@ -1,11 +1,5 @@ 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.WindowManager; @@ -13,11 +7,10 @@ namespace ShiftOS.Main.ShiftOS.Apps { public partial class SelectColor : UserControl { - ShiftWM shiftWM = new ShiftWM(); - Color finalColor; - int colorType1; - int colorType2; - int colorType3; + Color _finalColor; + int _colorType1; + int _colorType2; + int _colorType3; public SelectColor() { InitializeComponent(); @@ -28,31 +21,31 @@ namespace ShiftOS.Main.ShiftOS.Apps { try { - colorType1 = Convert.ToInt32(textBox1.Text); - colorType2 = Convert.ToInt32(textBox2.Text); - colorType3 = Convert.ToInt32(textBox3.Text); + _colorType1 = Convert.ToInt32(textBox1.Text); + _colorType2 = Convert.ToInt32(textBox2.Text); + _colorType3 = Convert.ToInt32(textBox3.Text); } - catch(Exception ex) + catch(FormatException ex) { - shiftWM.StartInfoboxSession("Error!", "Failed to parse integer. Error:\n" + ex, InfoboxTemplate.buttonType.OK); + ShiftWM.StartInfoboxSession("Error!", "Failed to parse integer. Error:\n" + ex, InfoboxTemplate.ButtonType.Ok); } - if (colorType1 > 255 || colorType2 > 255 || colorType3 > 255) + if (_colorType1 > 255 || _colorType2 > 255 || _colorType3 > 255) { - shiftWM.StartInfoboxSession("Error!", "A value cannot be greater than 255!", InfoboxTemplate.buttonType.OK); + ShiftWM.StartInfoboxSession("Error!", "A value cannot be greater than 255!", InfoboxTemplate.ButtonType.Ok); } else { try { ShiftWindow sw = new ShiftWindow(); - finalColor = Color.FromArgb(colorType1, colorType2, colorType3); - this.BackColor = finalColor; - shiftWM.StartInfoboxSession("Success!", "Changed color to:\n" + colorType1.ToString() + ", " + colorType2.ToString() + ", " + colorType3.ToString() + ".", InfoboxTemplate.buttonType.OK); + _finalColor = Color.FromArgb(_colorType1, _colorType2, _colorType3); + BackColor = _finalColor; + ShiftWM.StartInfoboxSession("Success!", "Changed color to:\n" + _colorType1.ToString() + ", " + _colorType2.ToString() + ", " + _colorType3.ToString() + ".", InfoboxTemplate.ButtonType.Ok); } - catch (Exception ex) + catch (Exception) { - shiftWM.StartInfoboxSession("Error!", "An error occured while setting the color.", InfoboxTemplate.buttonType.OK); + ShiftWM.StartInfoboxSession("Error!", "An error occured while setting the color.", InfoboxTemplate.ButtonType.Ok); } } } diff --git a/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/Shifter.cs b/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/Shifter.cs index 74b2079..098920f 100644 --- a/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/Shifter.cs +++ b/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/Shifter.cs @@ -1,12 +1,6 @@ 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; using ShiftOS.Engine.WindowManager; namespace ShiftOS.Main.ShiftOS.Apps @@ -14,7 +8,6 @@ namespace ShiftOS.Main.ShiftOS.Apps public partial class Shifter : UserControl { public int colorType; //This is a check to see what option was chosen. - ShiftWM wm = new ShiftWM(); public Shifter() { InitializeComponent(); @@ -23,7 +16,7 @@ namespace ShiftOS.Main.ShiftOS.Apps private void button1_Click(object sender, EventArgs e) { colorType = 1; - wm.Init(new SelectColor(), "Select a color", Properties.Resources.iconColourPicker_fw); + ShiftWM.Init(new SelectColor(), "Select a color", Properties.Resources.iconColourPicker_fw.ToIcon()); } } } diff --git a/ShiftOS.Main/ShiftOS/Apps/TestForm.Designer.cs b/ShiftOS.Main/ShiftOS/Apps/TestForm.Designer.cs index 7049a7e..50bcb58 100644 --- a/ShiftOS.Main/ShiftOS/Apps/TestForm.Designer.cs +++ b/ShiftOS.Main/ShiftOS/Apps/TestForm.Designer.cs @@ -28,61 +28,95 @@ /// private void InitializeComponent() { - this.textBox1 = new System.Windows.Forms.TextBox(); - this.textBox2 = new System.Windows.Forms.TextBox(); - this.button1 = new System.Windows.Forms.Button(); - this.button2 = new System.Windows.Forms.Button(); - this.SuspendLayout(); - // - // textBox1 - // - this.textBox1.Location = new System.Drawing.Point(12, 13); - this.textBox1.Name = "textBox1"; - this.textBox1.Size = new System.Drawing.Size(260, 20); - this.textBox1.TabIndex = 0; - this.textBox1.Text = "Title"; - // - // textBox2 - // - this.textBox2.Location = new System.Drawing.Point(12, 39); - this.textBox2.Name = "textBox2"; - this.textBox2.Size = new System.Drawing.Size(260, 20); - this.textBox2.TabIndex = 1; - this.textBox2.Text = "Contents"; - // - // button1 - // - this.button1.Location = new System.Drawing.Point(12, 65); - this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(128, 23); - this.button1.TabIndex = 2; - this.button1.Text = "Create Window"; - this.button1.UseVisualStyleBackColor = true; - this.button1.Click += new System.EventHandler(this.Button1_Click); - // - // button2 - // - this.button2.Location = new System.Drawing.Point(146, 65); - this.button2.Name = "button2"; - this.button2.Size = new System.Drawing.Size(126, 23); - this.button2.TabIndex = 4; - this.button2.Text = "Test Shifter"; - this.button2.UseVisualStyleBackColor = true; - this.button2.Click += new System.EventHandler(this.button2_Click); - // - // TestForm - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(284, 100); - this.Controls.Add(this.button2); - this.Controls.Add(this.button1); - this.Controls.Add(this.textBox2); - this.Controls.Add(this.textBox1); - this.Name = "TestForm"; - this.Text = "TestForm"; - this.ResumeLayout(false); - this.PerformLayout(); + this.components = new System.ComponentModel.Container(); + this.textBox1 = new System.Windows.Forms.TextBox(); + this.textBox2 = new System.Windows.Forms.TextBox(); + this.button1 = new System.Windows.Forms.Button(); + this.button2 = new System.Windows.Forms.Button(); + this.comboBox1 = new System.Windows.Forms.ComboBox(); + this.systemIconsBindingSource = new System.Windows.Forms.BindingSource(this.components); + ((System.ComponentModel.ISupportInitialize)(this.systemIconsBindingSource)).BeginInit(); + this.SuspendLayout(); + // + // textBox1 + // + this.textBox1.Location = new System.Drawing.Point(18, 20); + this.textBox1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(388, 26); + this.textBox1.TabIndex = 0; + this.textBox1.Text = "Title"; + // + // textBox2 + // + this.textBox2.Location = new System.Drawing.Point(18, 60); + this.textBox2.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.textBox2.Name = "textBox2"; + this.textBox2.Size = new System.Drawing.Size(388, 26); + this.textBox2.TabIndex = 1; + this.textBox2.Text = "Contents"; + // + // button1 + // + this.button1.Location = new System.Drawing.Point(13, 149); + this.button1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(192, 35); + this.button1.TabIndex = 2; + this.button1.Text = "Create Window"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.Button1_Click); + // + // button2 + // + this.button2.Location = new System.Drawing.Point(217, 149); + this.button2.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.button2.Name = "button2"; + this.button2.Size = new System.Drawing.Size(189, 35); + this.button2.TabIndex = 4; + this.button2.Text = "Test Shifter"; + this.button2.UseVisualStyleBackColor = true; + this.button2.Click += new System.EventHandler(this.button2_Click); + // + // comboBox1 + // + this.comboBox1.FormattingEnabled = true; + this.comboBox1.Items.AddRange(new object[] { + "Application", + "Asterisk", + "Error", + "Exclamation", + "Hand", + "Information", + "Question", + "Shield", + "Warning", + "WinLogo"}); + this.comboBox1.Location = new System.Drawing.Point(18, 104); + this.comboBox1.Name = "comboBox1"; + this.comboBox1.Size = new System.Drawing.Size(388, 28); + this.comboBox1.TabIndex = 5; + // + // systemIconsBindingSource + // + this.systemIconsBindingSource.DataSource = typeof(System.Drawing.SystemIcons); + // + // TestForm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(426, 198); + this.Controls.Add(this.comboBox1); + this.Controls.Add(this.button2); + this.Controls.Add(this.button1); + this.Controls.Add(this.textBox2); + this.Controls.Add(this.textBox1); + this.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.Name = "TestForm"; + this.Text = "TestForm"; + ((System.ComponentModel.ISupportInitialize)(this.systemIconsBindingSource)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); } @@ -92,5 +126,7 @@ private System.Windows.Forms.TextBox textBox2; private System.Windows.Forms.Button button1; private System.Windows.Forms.Button button2; - } + private System.Windows.Forms.ComboBox comboBox1; + private System.Windows.Forms.BindingSource systemIconsBindingSource; + } } \ No newline at end of file diff --git a/ShiftOS.Main/ShiftOS/Apps/TestForm.cs b/ShiftOS.Main/ShiftOS/Apps/TestForm.cs index e2b5bf7..1fd3b18 100644 --- a/ShiftOS.Main/ShiftOS/Apps/TestForm.cs +++ b/ShiftOS.Main/ShiftOS/Apps/TestForm.cs @@ -1,5 +1,8 @@ using System; +using System.Drawing; +using System.Linq; using System.Windows.Forms; +using ShiftOS.Engine; using ShiftOS.Engine.WindowManager; using ShiftOS.Main.ShiftOS.Apps; @@ -7,8 +10,6 @@ namespace ShiftOS.Main { public partial class TestForm : Form { - public ShiftWM shiftWM = new ShiftWM(); - public TestForm() { InitializeComponent(); @@ -16,14 +17,16 @@ namespace ShiftOS.Main private void Button1_Click(object sender, EventArgs e) { - ShiftDemo demo = new ShiftDemo(); - demo.label1.Text = textBox2.Text; - shiftWM.Init(demo, textBox1.Text, null); - shiftWM.StartInfoboxSession(textBox1.Text, textBox2.Text, InfoboxTemplate.buttonType.OK); + ShiftDemo demo = new ShiftDemo {label1 = {Text = textBox2.Text}}; + + var item = typeof(SystemIcons).GetProperties() + .First(p => p.Name == comboBox1.SelectedItem as string); + + ShiftWM.Init(demo, textBox1.Text, (item.GetMethod.Invoke(null, new object[0]) as Icon)); + ShiftWM.StartInfoboxSession(textBox1.Text, textBox2.Text, InfoboxTemplate.ButtonType.Ok); } - private void button2_Click(object sender, EventArgs e) - { - shiftWM.Init(new Shifter(), "Shifter", Properties.Resources.iconShifter); } + private void button2_Click(object sender, EventArgs e) + => ShiftWM.Init(new Shifter(), "Shifter", Properties.Resources.iconShifter.ToIcon()); } } diff --git a/ShiftOS.Main/ShiftOS/Apps/TestForm.resx b/ShiftOS.Main/ShiftOS/Apps/TestForm.resx index 1af7de1..6dba9d3 100644 --- a/ShiftOS.Main/ShiftOS/Apps/TestForm.resx +++ b/ShiftOS.Main/ShiftOS/Apps/TestForm.resx @@ -117,4 +117,7 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 17, 17 + \ No newline at end of file diff --git a/ShiftOS.Main/ShiftOS/Desktop.Designer.cs b/ShiftOS.Main/ShiftOS/Desktop.Designer.cs new file mode 100644 index 0000000..dac30c6 --- /dev/null +++ b/ShiftOS.Main/ShiftOS/Desktop.Designer.cs @@ -0,0 +1,111 @@ +namespace ShiftOS.Main.ShiftOS +{ + partial class Desktop + { + /// + /// 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 Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + this.listView1 = new System.Windows.Forms.ListView(); + this.taskbar = new System.Windows.Forms.ToolStrip(); + this.toolStripDropDownButton1 = new System.Windows.Forms.ToolStripDropDownButton(); + this.taskbarClock = new System.Windows.Forms.ToolStripLabel(); + this.timer1 = new System.Windows.Forms.Timer(this.components); + this.taskbar.SuspendLayout(); + this.SuspendLayout(); + // + // listView1 + // + this.listView1.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.listView1.Dock = System.Windows.Forms.DockStyle.Fill; + this.listView1.Location = new System.Drawing.Point(0, 0); + this.listView1.Name = "listView1"; + this.listView1.Size = new System.Drawing.Size(1962, 1236); + this.listView1.TabIndex = 0; + this.listView1.UseCompatibleStateImageBehavior = false; + // + // taskbar + // + this.taskbar.Dock = System.Windows.Forms.DockStyle.Bottom; + this.taskbar.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden; + this.taskbar.ImageScalingSize = new System.Drawing.Size(24, 24); + this.taskbar.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.toolStripDropDownButton1, + this.taskbarClock}); + this.taskbar.Location = new System.Drawing.Point(0, 1204); + this.taskbar.Name = "taskbar"; + this.taskbar.Size = new System.Drawing.Size(1962, 32); + this.taskbar.TabIndex = 1; + this.taskbar.Text = "toolStrip1"; + // + // toolStripDropDownButton1 + // + this.toolStripDropDownButton1.Image = global::ShiftOS.Main.Properties.Resources.iconWebBrowser; + this.toolStripDropDownButton1.ImageTransparentColor = System.Drawing.Color.Magenta; + this.toolStripDropDownButton1.Name = "toolStripDropDownButton1"; + this.toolStripDropDownButton1.Size = new System.Drawing.Size(131, 29); + this.toolStripDropDownButton1.Tag = ((uint)(0u)); + this.toolStripDropDownButton1.Text = "Programs"; + // + // taskbarClock + // + this.taskbarClock.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right; + this.taskbarClock.Image = global::ShiftOS.Main.Properties.Resources.iconClock; + this.taskbarClock.Name = "taskbarClock"; + this.taskbarClock.Size = new System.Drawing.Size(70, 29); + this.taskbarClock.Tag = ((uint)(0u)); + this.taskbarClock.Text = "0:00"; + // + // timer1 + // + this.timer1.Interval = 1000; + this.timer1.Tick += new System.EventHandler(this.timer1_Tick); + // + // Desktop + // + this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(1962, 1236); + this.Controls.Add(this.taskbar); + this.Controls.Add(this.listView1); + this.Name = "Desktop"; + this.Text = "Desktop"; + this.taskbar.ResumeLayout(false); + this.taskbar.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.ListView listView1; + private System.Windows.Forms.ToolStrip taskbar; + private System.Windows.Forms.ToolStripDropDownButton toolStripDropDownButton1; + private System.Windows.Forms.ToolStripLabel taskbarClock; + private System.Windows.Forms.Timer timer1; + } +} \ No newline at end of file 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().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); + + tbRemovalList.ToList().ForEach(p => taskbar.Items.Remove(p)); + })); + }); + }; + + #endregion + } + + private void timer1_Tick(object sender, EventArgs e) => + taskbarClock.Text = $"{DateTime.Now:t}"; + } +} diff --git a/ShiftOS.Main/ShiftOS/Desktop.resx b/ShiftOS.Main/ShiftOS/Desktop.resx new file mode 100644 index 0000000..1ea96dc --- /dev/null +++ b/ShiftOS.Main/ShiftOS/Desktop.resx @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + 17, 17 + + + 159, 17 + + \ No newline at end of file -- cgit v1.2.3