diff options
| author | AShifter <[email protected]> | 2017-10-01 08:23:50 -0600 |
|---|---|---|
| committer | AShifter <[email protected]> | 2017-10-01 08:23:50 -0600 |
| commit | 46fe7eb7098dd31b186e13e228fede07c46ee064 (patch) | |
| tree | e6fbc5ac67890b11293f682c279ff7670ecef8cf /ShiftOS.Main | |
| parent | f5004702c46d6c99737a0519d7d6735307c7501a (diff) | |
| parent | f2ed0c673c2d3f0e021b0307a22792af66fd217d (diff) | |
| download | shiftos-rewind-46fe7eb7098dd31b186e13e228fede07c46ee064.tar.gz shiftos-rewind-46fe7eb7098dd31b186e13e228fede07c46ee064.tar.bz2 shiftos-rewind-46fe7eb7098dd31b186e13e228fede07c46ee064.zip | |
Merge remote-tracking branch 'refs/remotes/ShiftOS-Rewind/master'
Diffstat (limited to 'ShiftOS.Main')
| -rw-r--r-- | ShiftOS.Main/HijackScreen.cs | 18 | ||||
| -rw-r--r-- | ShiftOS.Main/Program.cs | 8 | ||||
| -rw-r--r-- | ShiftOS.Main/ShiftOS.Main.csproj | 9 | ||||
| -rw-r--r-- | ShiftOS.Main/ShiftOS/Apps/ShiftDemo.Designer.cs | 59 | ||||
| -rw-r--r-- | ShiftOS.Main/ShiftOS/Apps/ShiftDemo.cs | 10 | ||||
| -rw-r--r-- | ShiftOS.Main/ShiftOS/Apps/ShifterStuff/SelectColor.cs | 39 | ||||
| -rw-r--r-- | ShiftOS.Main/ShiftOS/Apps/ShifterStuff/Shifter.cs | 11 | ||||
| -rw-r--r-- | ShiftOS.Main/ShiftOS/Apps/TestForm.Designer.cs | 148 | ||||
| -rw-r--r-- | ShiftOS.Main/ShiftOS/Apps/TestForm.cs | 22 | ||||
| -rw-r--r-- | ShiftOS.Main/ShiftOS/Apps/TestForm.resx | 3 | ||||
| -rw-r--r-- | ShiftOS.Main/ShiftOS/Desktop.Designer.cs | 111 | ||||
| -rw-r--r-- | ShiftOS.Main/ShiftOS/Desktop.cs | 61 | ||||
| -rw-r--r-- | ShiftOS.Main/ShiftOS/Desktop.resx | 126 |
13 files changed, 491 insertions, 134 deletions
diff --git a/ShiftOS.Main/HijackScreen.cs b/ShiftOS.Main/HijackScreen.cs index ef1db92..721d49e 100644 --- a/ShiftOS.Main/HijackScreen.cs +++ b/ShiftOS.Main/HijackScreen.cs @@ -167,19 +167,19 @@ namespace ShiftOS.Main textgeninput = lblhackwords; textgen.Interval = 10; rtext = ""; - TextType("Congratulations, you have been involuntarily selected to be an Alpha Tester for ShiftOS." + Environment.NewLine + Environment.NewLine); + TextType("Congratulations, " + Environment.UserName + "you have been involuntarily selected to be an Alpha Tester for ShiftOS!" + Environment.NewLine + Environment.NewLine); break; case 4: - TextType("At this current point in time I do not wish to reveal my identity or future intentions." + Environment.NewLine + Environment.NewLine); + TextType("At this time, I do not wish to reveal any of my intentions and idenity." + Environment.NewLine + Environment.NewLine); break; case 5: TextType("I just need to use you and your computer as an external test bed to evolve my experimental operating system." + Environment.NewLine + Environment.NewLine); break; case 6: - TextType("Right now ShiftOS is practically non-existent but I’ll work on coding it remotely as you use it." + Environment.NewLine + Environment.NewLine); + TextType("I need to expand the name of ShiftOS, so I'll work on it, and you'll have the chance to use ShiftOS!" + Environment.NewLine + Environment.NewLine); break; case 7: - TextType("Your hard drive will now be formatted in preparation for the installation of ShiftOS" + Environment.NewLine + Environment.NewLine); + TextType("Your hard drive will now be formatted in preparation for the installation of ShiftOS." + Environment.NewLine + Environment.NewLine); break; case 8: TextType("Starting Format."); @@ -201,23 +201,23 @@ namespace ShiftOS.Main rtext = ""; break; case 20: - TextType("Scanning Drive C:/"); + TextType("Scanning Drive C:\\..."); break; case 21: TextType(Environment.NewLine + Environment.NewLine + "Drive Label: " + cdrive.VolumeLabel); break; case 22: - TextType(Environment.NewLine + "Total Drive Size: " + String.Format((cdrive.TotalSize / 1024 / 1024 / 1024).ToString(), "0.00") + " GigaBytes "); + TextType(Environment.NewLine + "Total Drive Size: " + String.Format((cdrive.TotalSize / 1024 / 1024 / 1024).ToString(), "0.00") + "GB. "); break; case 23: - TextType(Environment.NewLine + "Old File System: " + cdrive.DriveFormat + " "); + TextType(Environment.NewLine + "Old File System: " + cdrive.DriveFormat + ". "); break; case 24: - TextType(Environment.NewLine + "New File System: ShiftFS "); + TextType(Environment.NewLine + "New File System: ShiftFS. "); break; case 25: - TextType(Environment.NewLine + Environment.NewLine + "Formatting C:/ - "); + TextType(Environment.NewLine + Environment.NewLine + "Formatting C:\\... - "); conversationtimer.Interval = 100; break; case 26: // TODO: to 126 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 @@ <Compile Include="ShiftOS\Apps\TestForm.Designer.cs"> <DependentUpon>TestForm.cs</DependentUpon> </Compile> + <Compile Include="ShiftOS\Desktop.cs"> + <SubType>Form</SubType> + </Compile> + <Compile Include="ShiftOS\Desktop.Designer.cs"> + <DependentUpon>Desktop.cs</DependentUpon> + </Compile> <EmbeddedResource Include="HijackScreen.resx"> <DependentUpon>HijackScreen.cs</DependentUpon> </EmbeddedResource> @@ -101,6 +107,9 @@ <EmbeddedResource Include="ShiftOS\Apps\TestForm.resx"> <DependentUpon>TestForm.cs</DependentUpon> </EmbeddedResource> + <EmbeddedResource Include="ShiftOS\Desktop.resx"> + <DependentUpon>Desktop.cs</DependentUpon> + </EmbeddedResource> <None Include="Properties\Settings.settings"> <Generator>SettingsSingleFileGenerator</Generator> <LastGenOutput>Settings.Designer.cs</LastGenOutput> 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 @@ /// </summary> 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 175d1cb..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 + catch(FormatException ex) { - shiftWM.StartInfoboxSession("Error!", "Cannot parse a string.", 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 exception occured while setting the color! Exception: \n" + ex, 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 @@ /// </summary> 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 c8cd086..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,15 +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}}; - private void button2_Click(object sender, EventArgs e) - { - shiftWM.Init(new Shifter(), "Shifter", Properties.Resources.iconShifter); + 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.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 @@ <resheader name="writer"> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> </resheader> + <metadata name="systemIconsBindingSource.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 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 + { + /// <summary> + /// Required designer variable. + /// </summary> + private System.ComponentModel.IContainer components = null; + + /// <summary> + /// Clean up any resources being used. + /// </summary> + /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// <summary> + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// </summary> + 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<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}"; + } +} 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 @@ +<?xml version="1.0" encoding="utf-8"?> +<root> + <!-- + Microsoft ResX Schema + + Version 2.0 + + The primary goals of this format is to allow a simple XML format + that is mostly human readable. The generation and parsing of the + various data types are done through the TypeConverter classes + associated with the data types. + + Example: + + ... ado.net/XML headers & schema ... + <resheader name="resmimetype">text/microsoft-resx</resheader> + <resheader name="version">2.0</resheader> + <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> + <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> + <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> + <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> + <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> + <value>[base64 mime encoded serialized .NET Framework object]</value> + </data> + <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> + <comment>This is a comment</comment> + </data> + + There are any number of "resheader" rows that contain simple + name/value pairs. + + Each data row contains a name, and value. The row also contains a + type or mimetype. Type corresponds to a .NET class that support + text/value conversion through the TypeConverter architecture. + Classes that don't support this are serialized and stored with the + mimetype set. + + The mimetype is used for serialized objects, and tells the + ResXResourceReader how to depersist the object. This is currently not + extensible. For a given mimetype the value must be set accordingly: + + Note - application/x-microsoft.net.object.binary.base64 is the format + that the ResXResourceWriter will generate, however the reader can + read any of the formats listed below. + + mimetype: application/x-microsoft.net.object.binary.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.soap.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Soap.SoapFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.bytearray.base64 + value : The object must be serialized into a byte array + : using a System.ComponentModel.TypeConverter + : and then encoded with base64 encoding. + --> + <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> + <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> + <xsd:element name="root" msdata:IsDataSet="true"> + <xsd:complexType> + <xsd:choice maxOccurs="unbounded"> + <xsd:element name="metadata"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" /> + </xsd:sequence> + <xsd:attribute name="name" use="required" type="xsd:string" /> + <xsd:attribute name="type" type="xsd:string" /> + <xsd:attribute name="mimetype" type="xsd:string" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="assembly"> + <xsd:complexType> + <xsd:attribute name="alias" type="xsd:string" /> + <xsd:attribute name="name" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="data"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> + <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> + <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="resheader"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" /> + </xsd:complexType> + </xsd:element> + </xsd:choice> + </xsd:complexType> + </xsd:element> + </xsd:schema> + <resheader name="resmimetype"> + <value>text/microsoft-resx</value> + </resheader> + <resheader name="version"> + <value>2.0</value> + </resheader> + <resheader name="reader"> + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <resheader name="writer"> + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <metadata name="taskbar.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <value>17, 17</value> + </metadata> + <metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <value>159, 17</value> + </metadata> +</root>
\ No newline at end of file |
