From 1f58603725b3266dbf8584e664c64d7d6aeb3d0f Mon Sep 17 00:00:00 2001 From: Alee Date: Tue, 12 Feb 2019 19:45:04 -0500 Subject: Added the desktop, debug, file system and more --- Microbit/Debug.Designer.cs | 76 +++++++++++++++++++++++ Microbit/Debug.cs | 31 ++++++++++ Microbit/Debug.resx | 120 ++++++++++++++++++++++++++++++++++++ Microbit/Desktop.Designer.cs | 120 ++++++++++++++++++++++++++++++++++++ Microbit/Desktop.cs | 30 +++++++++ Microbit/Desktop.resx | 139 ++++++++++++++++++++++++++++++++++++++++++ Microbit/MainMenu.Designer.cs | 18 ++++++ Microbit/MainMenu.cs | 51 ++++++++++++++-- Microbit/Microbit.Main.csproj | 36 +++++++---- Microbit/packages.config | 7 +-- 10 files changed, 606 insertions(+), 22 deletions(-) create mode 100644 Microbit/Debug.Designer.cs create mode 100644 Microbit/Debug.cs create mode 100644 Microbit/Debug.resx create mode 100644 Microbit/Desktop.Designer.cs create mode 100644 Microbit/Desktop.cs create mode 100644 Microbit/Desktop.resx (limited to 'Microbit') diff --git a/Microbit/Debug.Designer.cs b/Microbit/Debug.Designer.cs new file mode 100644 index 0000000..2443681 --- /dev/null +++ b/Microbit/Debug.Designer.cs @@ -0,0 +1,76 @@ +namespace Microbit.Main +{ + partial class Debug + { + /// + /// 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.label1 = new System.Windows.Forms.Label(); + this.button1 = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("Consolas", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label1.Location = new System.Drawing.Point(12, 23); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(480, 54); + this.label1.TabIndex = 0; + this.label1.Text = "Welcome to Debug Mode!\r\nThis is where you get easy access to the Microbit softwar" + + "e.\r\nLike Desktop, Settings and more!"; + // + // button1 + // + this.button1.Location = new System.Drawing.Point(34, 105); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(75, 23); + this.button1.TabIndex = 1; + this.button1.Text = "Desktop"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // Debug + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(494, 388); + this.Controls.Add(this.button1); + this.Controls.Add(this.label1); + this.Name = "Debug"; + this.Text = "Debug"; + this.Load += new System.EventHandler(this.Debug_Load); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Button button1; + } +} \ No newline at end of file diff --git a/Microbit/Debug.cs b/Microbit/Debug.cs new file mode 100644 index 0000000..abe96fa --- /dev/null +++ b/Microbit/Debug.cs @@ -0,0 +1,31 @@ +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; + +namespace Microbit.Main +{ + public partial class Debug : Form + { + public Debug() + { + InitializeComponent(); + } + + private void Debug_Load(object sender, EventArgs e) + { + + } + + private void button1_Click(object sender, EventArgs e) + { + Desktop desktop = new Desktop(); + desktop.Show(); + } + } +} diff --git a/Microbit/Debug.resx b/Microbit/Debug.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/Microbit/Debug.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + \ No newline at end of file diff --git a/Microbit/Desktop.Designer.cs b/Microbit/Desktop.Designer.cs new file mode 100644 index 0000000..485d5d7 --- /dev/null +++ b/Microbit/Desktop.Designer.cs @@ -0,0 +1,120 @@ +namespace Microbit.Main +{ + 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() + { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Desktop)); + this.toolStrip1 = new System.Windows.Forms.ToolStrip(); + this.toolStripDropDownButton1 = new System.Windows.Forms.ToolStripDropDownButton(); + this.programsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.settingsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); + this.shutdownToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStrip1.SuspendLayout(); + this.SuspendLayout(); + // + // toolStrip1 + // + this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.toolStripDropDownButton1}); + this.toolStrip1.Location = new System.Drawing.Point(0, 0); + this.toolStrip1.Name = "toolStrip1"; + this.toolStrip1.Padding = new System.Windows.Forms.Padding(0, 0, 2, 0); + this.toolStrip1.Size = new System.Drawing.Size(748, 25); + this.toolStrip1.TabIndex = 0; + this.toolStrip1.Text = "toolStrip1"; + // + // toolStripDropDownButton1 + // + this.toolStripDropDownButton1.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; + this.toolStripDropDownButton1.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.programsToolStripMenuItem, + this.settingsToolStripMenuItem, + this.toolStripSeparator1, + this.shutdownToolStripMenuItem}); + this.toolStripDropDownButton1.Image = ((System.Drawing.Image)(resources.GetObject("toolStripDropDownButton1.Image"))); + this.toolStripDropDownButton1.ImageTransparentColor = System.Drawing.Color.Magenta; + this.toolStripDropDownButton1.Name = "toolStripDropDownButton1"; + this.toolStripDropDownButton1.Size = new System.Drawing.Size(51, 22); + this.toolStripDropDownButton1.Text = "Menu"; + // + // programsToolStripMenuItem + // + this.programsToolStripMenuItem.Name = "programsToolStripMenuItem"; + this.programsToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.programsToolStripMenuItem.Text = "Programs"; + // + // settingsToolStripMenuItem + // + this.settingsToolStripMenuItem.Name = "settingsToolStripMenuItem"; + this.settingsToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.settingsToolStripMenuItem.Text = "Settings"; + // + // toolStripSeparator1 + // + this.toolStripSeparator1.Name = "toolStripSeparator1"; + this.toolStripSeparator1.Size = new System.Drawing.Size(177, 6); + // + // shutdownToolStripMenuItem + // + this.shutdownToolStripMenuItem.Name = "shutdownToolStripMenuItem"; + this.shutdownToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.shutdownToolStripMenuItem.Text = "Shutdown"; + this.shutdownToolStripMenuItem.Click += new System.EventHandler(this.shutdownToolStripMenuItem_Click); + // + // Desktop + // + this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 22F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.BackColor = System.Drawing.Color.Black; + this.ClientSize = new System.Drawing.Size(748, 520); + this.Controls.Add(this.toolStrip1); + this.Font = new System.Drawing.Font("Consolas", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; + this.Margin = new System.Windows.Forms.Padding(5, 5, 5, 5); + this.Name = "Desktop"; + this.Text = "Desktop"; + this.WindowState = System.Windows.Forms.FormWindowState.Maximized; + this.Load += new System.EventHandler(this.Desktop_Load); + this.toolStrip1.ResumeLayout(false); + this.toolStrip1.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.ToolStrip toolStrip1; + private System.Windows.Forms.ToolStripDropDownButton toolStripDropDownButton1; + private System.Windows.Forms.ToolStripMenuItem programsToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem settingsToolStripMenuItem; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; + private System.Windows.Forms.ToolStripMenuItem shutdownToolStripMenuItem; + } +} \ No newline at end of file diff --git a/Microbit/Desktop.cs b/Microbit/Desktop.cs new file mode 100644 index 0000000..2761b89 --- /dev/null +++ b/Microbit/Desktop.cs @@ -0,0 +1,30 @@ +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; + +namespace Microbit.Main +{ + public partial class Desktop : Form + { + public Desktop() + { + InitializeComponent(); + } + + private void Desktop_Load(object sender, EventArgs e) + { + + } + + private void shutdownToolStripMenuItem_Click(object sender, EventArgs e) + { + this.Close(); + } + } +} diff --git a/Microbit/Desktop.resx b/Microbit/Desktop.resx new file mode 100644 index 0000000..30a20f7 --- /dev/null +++ b/Microbit/Desktop.resx @@ -0,0 +1,139 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG + YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9 + 0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw + bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc + VzOOpHI7Jr376Hi9ogHqFIANO0/MmmmbmSmm9a8ze+I4MrNWAdjtoJgWcx+PSzg166yZZ8xM8XvXDix9 + c4jIqFYAjoriBV9AhEPv1mH/sonogha0afbZMMZz+yreTGyhpusHwtNNCsA5U1zS4BLxzJIfg299qO32 + Ir7UJtZfftyATqeT+8o2D8JSjQrAJblrncYL7ZJ2+bfaFnC/1S1NjL3diRat7qrO7wLRP3HjWsojBeCo + mDEo5mNjuweFGvjWg2EBhCbpkW78htSHHwRyNdmgAFzPEee2iFkzayy2OLXzT4gr6UdUnlXrullsxxQ+ + kx0g8BTA3aZlButjSTyjODq/WcQcW/B/Je4OQhLvKQDnzN1mp0nnkvAhR8VuMzNrpm1mpjgkoVwB/v8D + TgDQASA1MVpwzwAAAABJRU5ErkJggg== + + + \ No newline at end of file diff --git a/Microbit/MainMenu.Designer.cs b/Microbit/MainMenu.Designer.cs index d2b4011..3ba5ad4 100644 --- a/Microbit/MainMenu.Designer.cs +++ b/Microbit/MainMenu.Designer.cs @@ -33,6 +33,7 @@ this.wbLauncher = new System.Windows.Forms.WebBrowser(); this.btnReset = new System.Windows.Forms.Button(); this.btnExit = new System.Windows.Forms.Button(); + this.btnDebug = new System.Windows.Forms.Button(); this.SuspendLayout(); // // lbTitle @@ -101,6 +102,21 @@ this.btnExit.UseVisualStyleBackColor = true; this.btnExit.Click += new System.EventHandler(this.btnExit_Click); // + // btnDebug + // + this.btnDebug.Enabled = false; + this.btnDebug.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.btnDebug.Font = new System.Drawing.Font("Consolas", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.btnDebug.ForeColor = System.Drawing.Color.White; + this.btnDebug.Location = new System.Drawing.Point(117, 63); + this.btnDebug.Name = "btnDebug"; + this.btnDebug.Size = new System.Drawing.Size(90, 32); + this.btnDebug.TabIndex = 5; + this.btnDebug.Text = "{{DEBUG}}"; + this.btnDebug.UseVisualStyleBackColor = true; + this.btnDebug.Visible = false; + this.btnDebug.Click += new System.EventHandler(this.btnDebug_Click); + // // MainMenu // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -108,6 +124,7 @@ this.BackColor = System.Drawing.Color.Black; this.ClientSize = new System.Drawing.Size(800, 450); this.ControlBox = false; + this.Controls.Add(this.btnDebug); this.Controls.Add(this.btnExit); this.Controls.Add(this.btnReset); this.Controls.Add(this.wbLauncher); @@ -128,6 +145,7 @@ private System.Windows.Forms.WebBrowser wbLauncher; private System.Windows.Forms.Button btnReset; private System.Windows.Forms.Button btnExit; + private System.Windows.Forms.Button btnDebug; } } diff --git a/Microbit/MainMenu.cs b/Microbit/MainMenu.cs index be78120..981d1bd 100644 --- a/Microbit/MainMenu.cs +++ b/Microbit/MainMenu.cs @@ -18,6 +18,10 @@ * ****************************************************************************/ using System; +using Microbit.Main; +using System.IO; +using Microbit.Kernel; +using Newtonsoft.Json; using System.Collections.Generic; using System.ComponentModel; using System.Data; @@ -38,22 +42,59 @@ namespace Microbit private void MainMenu_Load(object sender, EventArgs e) { - +#if DEBUG + btnDebug.Visible = true; + btnDebug.Enabled = true; +#endif + if (Directory.Exists(MicroFS.MicrobitFolder)) + { + btnReset.Enabled = true; + } + else + { + btnReset.Enabled = false; + MicroFS.CreateSystemFiles(); + } } - private void btnExit_Click(object sender, EventArgs e) + private void btnStart_Click(object sender, EventArgs e) { - this.Close(); + } - private void btnStart_Click(object sender, EventArgs e) + private void btnReset_Click(object sender, EventArgs e) { + MessageBoxButtons buttons = MessageBoxButtons.YesNo; + DialogResult result; + result = MessageBox.Show("Are you sure that you want to reset this OS?\nTHIS ACTION WILL DESTROY YOUR FILES AND RESTORE TO THE DEFAULT SETTINGS.", "Are you sure?", buttons); + if (result == System.Windows.Forms.DialogResult.Yes) + { + foreach (string file in Directory.GetFiles(MicroFS.MicrobitFolder)) + { + File.Delete(file); + } + foreach (string directory in Directory.GetDirectories(MicroFS.MicrobitFolder)) + { + Directory.Delete(directory); + } + + Directory.Delete(MicroFS.MicrobitFolder); + } + btnReset.Enabled = false; + MessageBox.Show("OS has been restored to the default settings and all files are deleted."); } - private void btnReset_Click(object sender, EventArgs e) + private void btnDebug_Click(object sender, EventArgs e) { + Debug debug = new Debug(); + debug.Show(); + } + private void btnExit_Click(object sender, EventArgs e) + { + this.Close(); } + } } diff --git a/Microbit/Microbit.Main.csproj b/Microbit/Microbit.Main.csproj index 5014e47..82cf32b 100644 --- a/Microbit/Microbit.Main.csproj +++ b/Microbit/Microbit.Main.csproj @@ -32,25 +32,19 @@ 4 - - ..\packages\Discord.Net.Core.1.0.2\lib\net45\Discord.Net.Core.dll - - - ..\packages\Discord.Net.Rest.1.0.2\lib\net45\Discord.Net.Rest.dll - - - ..\packages\Discord.Net.Rpc.1.0.2\lib\net45\Discord.Net.Rpc.dll + + ..\Microbit.Kernel\bin\Debug\Microbit.Kernel.dll ..\packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll - - ..\packages\System.Collections.Immutable.1.3.1\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll + + ..\packages\System.Collections.Immutable.1.5.0\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll - - ..\packages\System.Interactive.Async.3.1.1\lib\net45\System.Interactive.Async.dll + + ..\packages\System.Interactive.Async.3.2.0\lib\net45\System.Interactive.Async.dll @@ -63,6 +57,18 @@ + + Form + + + Debug.cs + + + Form + + + Desktop.cs + Form @@ -71,6 +77,12 @@ + + Debug.cs + + + Desktop.cs + MainMenu.cs diff --git a/Microbit/packages.config b/Microbit/packages.config index e732a0b..1a5a8cb 100644 --- a/Microbit/packages.config +++ b/Microbit/packages.config @@ -1,9 +1,6 @@  - - - - - + + \ No newline at end of file -- cgit v1.2.3