diff --git a/ShiftOS.WinForms/Applications/ExperienceShifter.Designer.cs b/ShiftOS.WinForms/Applications/ExperienceShifter.Designer.cs new file mode 100644 index 0000000..9a0d54c --- /dev/null +++ b/ShiftOS.WinForms/Applications/ExperienceShifter.Designer.cs @@ -0,0 +1,190 @@ +namespace ShiftOS.WinForms.Applications +{ + partial class ExperienceShifter + { + /// + /// 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 Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.menuStrip1 = new System.Windows.Forms.MenuStrip(); + this.desktopToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.appLauncherToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.pnldesktop = new System.Windows.Forms.Panel(); + this.gpdesktopsettings = new System.Windows.Forms.GroupBox(); + this.label2 = new System.Windows.Forms.Label(); + this.pnlapplauncher = new System.Windows.Forms.Panel(); + this.label1 = new System.Windows.Forms.Label(); + this.lbdesktops = new System.Windows.Forms.ListBox(); + this.gpalsettings = new System.Windows.Forms.GroupBox(); + this.lblaunchers = new System.Windows.Forms.ListBox(); + this.menuStrip1.SuspendLayout(); + this.pnldesktop.SuspendLayout(); + this.pnlapplauncher.SuspendLayout(); + this.SuspendLayout(); + // + // menuStrip1 + // + this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.desktopToolStripMenuItem, + this.appLauncherToolStripMenuItem}); + this.menuStrip1.Location = new System.Drawing.Point(0, 0); + this.menuStrip1.Name = "menuStrip1"; + this.menuStrip1.Size = new System.Drawing.Size(582, 24); + this.menuStrip1.TabIndex = 0; + this.menuStrip1.Text = "menuStrip1"; + // + // desktopToolStripMenuItem + // + this.desktopToolStripMenuItem.Name = "desktopToolStripMenuItem"; + this.desktopToolStripMenuItem.Size = new System.Drawing.Size(62, 20); + this.desktopToolStripMenuItem.Text = "Desktop"; + this.desktopToolStripMenuItem.Click += new System.EventHandler(this.desktopToolStripMenuItem_Click); + // + // appLauncherToolStripMenuItem + // + this.appLauncherToolStripMenuItem.Name = "appLauncherToolStripMenuItem"; + this.appLauncherToolStripMenuItem.Size = new System.Drawing.Size(93, 20); + this.appLauncherToolStripMenuItem.Text = "App Launcher"; + this.appLauncherToolStripMenuItem.Click += new System.EventHandler(this.appLauncherToolStripMenuItem_Click); + // + // pnldesktop + // + this.pnldesktop.Controls.Add(this.lbdesktops); + this.pnldesktop.Controls.Add(this.gpdesktopsettings); + this.pnldesktop.Controls.Add(this.label2); + this.pnldesktop.Dock = System.Windows.Forms.DockStyle.Fill; + this.pnldesktop.Location = new System.Drawing.Point(0, 24); + this.pnldesktop.Name = "pnldesktop"; + this.pnldesktop.Size = new System.Drawing.Size(582, 407); + this.pnldesktop.TabIndex = 1; + // + // gpdesktopsettings + // + this.gpdesktopsettings.Dock = System.Windows.Forms.DockStyle.Bottom; + this.gpdesktopsettings.Location = new System.Drawing.Point(0, 262); + this.gpdesktopsettings.Name = "gpdesktopsettings"; + this.gpdesktopsettings.Size = new System.Drawing.Size(582, 145); + this.gpdesktopsettings.TabIndex = 2; + this.gpdesktopsettings.TabStop = false; + this.gpdesktopsettings.Text = "Settings for this environment"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Dock = System.Windows.Forms.DockStyle.Top; + this.label2.Location = new System.Drawing.Point(0, 0); + this.label2.Name = "label2"; + this.label2.Padding = new System.Windows.Forms.Padding(5); + this.label2.Size = new System.Drawing.Size(57, 23); + this.label2.TabIndex = 1; + this.label2.Tag = "header2"; + this.label2.Text = "Desktop"; + // + // pnlapplauncher + // + this.pnlapplauncher.Controls.Add(this.lblaunchers); + this.pnlapplauncher.Controls.Add(this.gpalsettings); + this.pnlapplauncher.Controls.Add(this.label1); + this.pnlapplauncher.Dock = System.Windows.Forms.DockStyle.Fill; + this.pnlapplauncher.Location = new System.Drawing.Point(0, 24); + this.pnlapplauncher.Name = "pnlapplauncher"; + this.pnlapplauncher.Size = new System.Drawing.Size(582, 407); + this.pnlapplauncher.TabIndex = 0; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Dock = System.Windows.Forms.DockStyle.Top; + this.label1.Location = new System.Drawing.Point(0, 0); + this.label1.Name = "label1"; + this.label1.Padding = new System.Windows.Forms.Padding(5); + this.label1.Size = new System.Drawing.Size(84, 23); + this.label1.TabIndex = 0; + this.label1.Tag = "header2"; + this.label1.Text = "App Launcher"; + // + // lbdesktops + // + this.lbdesktops.Dock = System.Windows.Forms.DockStyle.Fill; + this.lbdesktops.FormattingEnabled = true; + this.lbdesktops.Location = new System.Drawing.Point(0, 23); + this.lbdesktops.Name = "lbdesktops"; + this.lbdesktops.Size = new System.Drawing.Size(582, 239); + this.lbdesktops.TabIndex = 0; + // + // gpalsettings + // + this.gpalsettings.Dock = System.Windows.Forms.DockStyle.Bottom; + this.gpalsettings.Location = new System.Drawing.Point(0, 262); + this.gpalsettings.Name = "gpalsettings"; + this.gpalsettings.Size = new System.Drawing.Size(582, 145); + this.gpalsettings.TabIndex = 3; + this.gpalsettings.TabStop = false; + this.gpalsettings.Text = "Settings for this environment"; + // + // lblaunchers + // + this.lblaunchers.Dock = System.Windows.Forms.DockStyle.Fill; + this.lblaunchers.FormattingEnabled = true; + this.lblaunchers.Location = new System.Drawing.Point(0, 23); + this.lblaunchers.Name = "lblaunchers"; + this.lblaunchers.Size = new System.Drawing.Size(582, 239); + this.lblaunchers.TabIndex = 4; + // + // ExperienceShifter + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.pnlapplauncher); + this.Controls.Add(this.pnldesktop); + this.Controls.Add(this.menuStrip1); + this.Name = "ExperienceShifter"; + this.Size = new System.Drawing.Size(582, 431); + this.menuStrip1.ResumeLayout(false); + this.menuStrip1.PerformLayout(); + this.pnldesktop.ResumeLayout(false); + this.pnldesktop.PerformLayout(); + this.pnlapplauncher.ResumeLayout(false); + this.pnlapplauncher.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.MenuStrip menuStrip1; + private System.Windows.Forms.ToolStripMenuItem desktopToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem appLauncherToolStripMenuItem; + private System.Windows.Forms.Panel pnldesktop; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Panel pnlapplauncher; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.GroupBox gpdesktopsettings; + private System.Windows.Forms.ListBox lbdesktops; + private System.Windows.Forms.ListBox lblaunchers; + private System.Windows.Forms.GroupBox gpalsettings; + } +} diff --git a/ShiftOS.WinForms/Applications/ExperienceShifter.cs b/ShiftOS.WinForms/Applications/ExperienceShifter.cs new file mode 100644 index 0000000..82706e8 --- /dev/null +++ b/ShiftOS.WinForms/Applications/ExperienceShifter.cs @@ -0,0 +1,84 @@ +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; + +namespace ShiftOS.WinForms.Applications +{ + [Launcher("Experience Shifter", false, "", "Customization")] + [DefaultTitle("Experience Shifter")] + [DefaultIcon("iconShifter")] + public partial class ExperienceShifter : UserControl, IShiftOSWindow + { + public ExperienceShifter() + { + InitializeComponent(); + } + + private string currentUI = "desktop"; + + public void SetupUI() + { + switch (currentUI) + { + case "desktop": + pnldesktop.BringToFront(); + PopulateDesktops(); + break; + case "applauncher": + pnlapplauncher.BringToFront(); + PopulateLaunchers(); + break; + } + } + + public void PopulateDesktops() + { + lbdesktops.Items.Clear(); + lbdesktops.Items.Add("ShiftOS Desktop"); + } + + public void PopulateLaunchers() + { + lblaunchers.Items.Clear(); + lbdesktops.Items.Add("ShiftOS App Launcher"); + } + + public void OnLoad() + { + SetupUI(); + } + + public void OnSkinLoad() + { + } + + public bool OnUnload() + { + return true; + } + + public void OnUpgrade() + { + } + + private void desktopToolStripMenuItem_Click(object sender, EventArgs e) + { + currentUI = "desktop"; + SetupUI(); + } + + private void appLauncherToolStripMenuItem_Click(object sender, EventArgs e) + { + currentUI = "applauncher"; + SetupUI(); + } + } +} diff --git a/ShiftOS.WinForms/Applications/ExperienceShifter.resx b/ShiftOS.WinForms/Applications/ExperienceShifter.resx new file mode 100644 index 0000000..d5494e3 --- /dev/null +++ b/ShiftOS.WinForms/Applications/ExperienceShifter.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + \ No newline at end of file diff --git a/ShiftOS.WinForms/LuaDesktop.Designer.cs b/ShiftOS.WinForms/LuaDesktop.Designer.cs new file mode 100644 index 0000000..10681f3 --- /dev/null +++ b/ShiftOS.WinForms/LuaDesktop.Designer.cs @@ -0,0 +1,38 @@ +namespace ShiftOS.WinForms +{ + partial class LuaDesktop + { + /// + /// 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.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Text = "LuaDesktop"; + } + + #endregion + } +} \ No newline at end of file diff --git a/ShiftOS.WinForms/LuaDesktop.cs b/ShiftOS.WinForms/LuaDesktop.cs new file mode 100644 index 0000000..445a571 --- /dev/null +++ b/ShiftOS.WinForms/LuaDesktop.cs @@ -0,0 +1,92 @@ +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; +using ShiftOS.Engine.Scripting; + +namespace ShiftOS.WinForms +{ + public partial class LuaDesktop : Form, IDesktop + { + public LuaDesktop() + { + InitializeComponent(); + } + + private LuaInterpreter interpreter = null; + + public string DesktopName + { + get + { + string name = "Unknown"; + try + { + name = (string.IsNullOrWhiteSpace(interpreter.Lua.deskName)) ? "Unknown" : interpreter.Lua.deskName; + } + catch + { + + } + return name; + } + } + + public Size GetSize() + { + return this.Size; + } + + public void InvokeOnWorkerThread(Action act) + { + this.Invoke(act); + } + + public void KillWindow(IWindowBorder border) + { + throw new NotImplementedException(); + } + + public void MaximizeWindow(IWindowBorder brdr) + { + throw new NotImplementedException(); + } + + public void MinimizeWindow(IWindowBorder brdr) + { + throw new NotImplementedException(); + } + + public void PopulateAppLauncher(LauncherItem[] items) + { + + } + + public void PopulatePanelButtons() + { + throw new NotImplementedException(); + } + + public void RestoreWindow(IWindowBorder brdr) + { + throw new NotImplementedException(); + } + + public void SetupDesktop() + { + throw new NotImplementedException(); + } + + public void ShowWindow(IWindowBorder border) + { + throw new NotImplementedException(); + } + } +} diff --git a/ShiftOS.WinForms/Properties/Resources.Designer.cs b/ShiftOS.WinForms/Properties/Resources.Designer.cs index a87a0b4..f38c639 100644 --- a/ShiftOS.WinForms/Properties/Resources.Designer.cs +++ b/ShiftOS.WinForms/Properties/Resources.Designer.cs @@ -871,6 +871,16 @@ namespace ShiftOS.WinForms.Properties { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap RegularDesktopGlyph { + get { + object obj = ResourceManager.GetObject("RegularDesktopGlyph", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized string similar to [ /// { diff --git a/ShiftOS.WinForms/Properties/Resources.resx b/ShiftOS.WinForms/Properties/Resources.resx index ba994b3..3e4819f 100644 --- a/ShiftOS.WinForms/Properties/Resources.resx +++ b/ShiftOS.WinForms/Properties/Resources.resx @@ -379,4 +379,7 @@ ..\SystemIcons\iconWebBrowser.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\RegularDesktopGlyph.bmp;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/ShiftOS.WinForms/Resources/RegularDesktopGlyph.bmp b/ShiftOS.WinForms/Resources/RegularDesktopGlyph.bmp new file mode 100644 index 0000000..55516c7 Binary files /dev/null and b/ShiftOS.WinForms/Resources/RegularDesktopGlyph.bmp differ diff --git a/ShiftOS.WinForms/ShiftOS.WinForms.csproj b/ShiftOS.WinForms/ShiftOS.WinForms.csproj index 126f32f..f63dcd2 100644 --- a/ShiftOS.WinForms/ShiftOS.WinForms.csproj +++ b/ShiftOS.WinForms/ShiftOS.WinForms.csproj @@ -94,6 +94,12 @@ Downloader.cs + + UserControl + + + ExperienceShifter.cs + UserControl @@ -202,6 +208,12 @@ FakeSetupScreen.cs + + Form + + + LuaDesktop.cs + Form @@ -245,6 +257,9 @@ Downloader.cs + + ExperienceShifter.cs + FileDialog.cs @@ -476,6 +491,7 @@ + diff --git a/ShiftOS.WinForms/WinformsDesktop.cs b/ShiftOS.WinForms/WinformsDesktop.cs index d813e51..c2bbe5c 100644 --- a/ShiftOS.WinForms/WinformsDesktop.cs +++ b/ShiftOS.WinForms/WinformsDesktop.cs @@ -416,6 +416,14 @@ namespace ShiftOS.WinForms private IWindowBorder focused = null; + public string DesktopName + { + get + { + return "ShiftOS Desktop"; + } + } + /// /// Minimizes the window. diff --git a/ShiftOS_TheReturn/Commands.cs b/ShiftOS_TheReturn/Commands.cs index dcc96f2..acbecce 100644 --- a/ShiftOS_TheReturn/Commands.cs +++ b/ShiftOS_TheReturn/Commands.cs @@ -230,9 +230,25 @@ namespace ShiftOS.Engine } #if DEVEL + internal class Rock : Exception + { + internal Rock() : base("Someone threw a motherfucking rock at the window, and the Terminal fucking shattered.") + { + + } + } + [Namespace("dev")] public static class ShiftOSDevCommands { + [Command("rock", description = "A little surprise for unstable builds...")] + public static bool ThrowAFuckingRock() + { + Infobox.Show("Fuck.", new Rock().Message); + return false; + } + + [Command("unbuy")] [RequiresArgument("upgrade")] public static bool UnbuyUpgrade(Dictionary args) diff --git a/ShiftOS_TheReturn/Desktop.cs b/ShiftOS_TheReturn/Desktop.cs index 712f05d..d30e3c3 100644 --- a/ShiftOS_TheReturn/Desktop.cs +++ b/ShiftOS_TheReturn/Desktop.cs @@ -32,6 +32,7 @@ using System.Reflection; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; +using ShiftOS.Objects.ShiftFS; using static ShiftOS.Engine.SkinEngine; namespace ShiftOS.Engine @@ -72,6 +73,8 @@ namespace ShiftOS.Engine public interface IDesktop { + string DesktopName { get; } + void SetupDesktop(); void PopulateAppLauncher(LauncherItem[] items); void ShowWindow(IWindowBorder border); @@ -88,6 +91,30 @@ namespace ShiftOS.Engine { private static IDesktop _desktop = null; + public static IDesktop[] GetAllDesktops() + { + List desktops = new List(); + foreach(var exe in System.IO.Directory.GetFiles(Environment.CurrentDirectory)) + { + if(exe.EndsWith(".exe") || exe.EndsWith(".dll")) + { + try + { + var asm = Assembly.LoadFile(exe); + foreach(var type in asm.GetTypes()) + { + if (type.GetInterfaces().Contains(typeof(IDesktop))) + { + desktops.Add(Activator.CreateInstance(type) as IDesktop); + } + } + } + catch { } + } + } + return desktops.ToArray(); + } + public static Size Size { get { return _desktop.GetSize(); diff --git a/ShiftOS_TheReturn/Scripting.cs b/ShiftOS_TheReturn/Scripting.cs index 246852f..e699939 100644 --- a/ShiftOS_TheReturn/Scripting.cs +++ b/ShiftOS_TheReturn/Scripting.cs @@ -40,7 +40,7 @@ namespace ShiftOS.Engine.Scripting { public class LuaInterpreter { - dynamic Lua = new DynamicLua.DynamicLua(); + public dynamic Lua = new DynamicLua.DynamicLua(); public bool Running = true; public LuaInterpreter()