This commit is contained in:
Michael 2017-02-16 17:14:18 -05:00
parent 781351aefb
commit e255c7fd47
13 changed files with 608 additions and 1 deletions

View file

@ -0,0 +1,190 @@
namespace ShiftOS.WinForms.Applications
{
partial class ExperienceShifter
{
/// <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 Component 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.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;
}
}

View file

@ -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();
}
}
}

View file

@ -0,0 +1,123 @@
<?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="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

38
ShiftOS.WinForms/LuaDesktop.Designer.cs generated Normal file
View file

@ -0,0 +1,38 @@
namespace ShiftOS.WinForms
{
partial class LuaDesktop
{
/// <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.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Text = "LuaDesktop";
}
#endregion
}
}

View file

@ -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();
}
}
}

View file

@ -871,6 +871,16 @@ namespace ShiftOS.WinForms.Properties {
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap RegularDesktopGlyph {
get {
object obj = ResourceManager.GetObject("RegularDesktopGlyph", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized string similar to [
/// {

View file

@ -379,4 +379,7 @@
<data name="iconWebBrowser" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\SystemIcons\iconWebBrowser.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="RegularDesktopGlyph" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\RegularDesktopGlyph.bmp;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

View file

@ -94,6 +94,12 @@
<Compile Include="Applications\Downloader.Designer.cs">
<DependentUpon>Downloader.cs</DependentUpon>
</Compile>
<Compile Include="Applications\ExperienceShifter.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Applications\ExperienceShifter.Designer.cs">
<DependentUpon>ExperienceShifter.cs</DependentUpon>
</Compile>
<Compile Include="Applications\FileDialog.cs">
<SubType>UserControl</SubType>
</Compile>
@ -202,6 +208,12 @@
<DependentUpon>FakeSetupScreen.cs</DependentUpon>
</Compile>
<Compile Include="JobTasks.cs" />
<Compile Include="LuaDesktop.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="LuaDesktop.Designer.cs">
<DependentUpon>LuaDesktop.cs</DependentUpon>
</Compile>
<Compile Include="Oobe.cs">
<SubType>Form</SubType>
</Compile>
@ -245,6 +257,9 @@
<EmbeddedResource Include="Applications\Downloader.resx">
<DependentUpon>Downloader.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Applications\ExperienceShifter.resx">
<DependentUpon>ExperienceShifter.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Applications\FileDialog.resx">
<DependentUpon>FileDialog.cs</DependentUpon>
</EmbeddedResource>
@ -476,6 +491,7 @@
<None Include="Resources\strings_en.txt" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\RegularDesktopGlyph.bmp" />
<Content Include="SystemIcons\iconArtpad.png" />
<Content Include="SystemIcons\iconAudioPlayer.png" />
<Content Include="SystemIcons\iconBitnoteDigger.png" />

View file

@ -416,6 +416,14 @@ namespace ShiftOS.WinForms
private IWindowBorder focused = null;
public string DesktopName
{
get
{
return "ShiftOS Desktop";
}
}
/// <summary>
/// Minimizes the window.

View file

@ -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<string, object> args)

View file

@ -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<IDesktop> desktops = new List<IDesktop>();
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();

View file

@ -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()