aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS.WinForms
diff options
context:
space:
mode:
Diffstat (limited to 'ShiftOS.WinForms')
-rw-r--r--ShiftOS.WinForms/Applications/ExperienceShifter.Designer.cs83
-rw-r--r--ShiftOS.WinForms/Applications/ExperienceShifter.cs51
-rw-r--r--ShiftOS.WinForms/Applications/ExperienceShifter.resx3
-rw-r--r--ShiftOS.WinForms/GUIFunctions.cs85
-rw-r--r--ShiftOS.WinForms/LuaDesktop.Designer.cs23
-rw-r--r--ShiftOS.WinForms/LuaDesktop.cs158
-rw-r--r--ShiftOS.WinForms/LuaDesktop.resx120
-rw-r--r--ShiftOS.WinForms/ShiftOS.WinForms.csproj11
-rw-r--r--ShiftOS.WinForms/ShiftOSConfigFile.cs20
-rw-r--r--ShiftOS.WinForms/Window.Designer.cs37
-rw-r--r--ShiftOS.WinForms/Window.cs44
-rw-r--r--ShiftOS.WinForms/WinformsDesktop.cs23
12 files changed, 598 insertions, 60 deletions
diff --git a/ShiftOS.WinForms/Applications/ExperienceShifter.Designer.cs b/ShiftOS.WinForms/Applications/ExperienceShifter.Designer.cs
index 9a0d54c..02cb01b 100644
--- a/ShiftOS.WinForms/Applications/ExperienceShifter.Designer.cs
+++ b/ShiftOS.WinForms/Applications/ExperienceShifter.Designer.cs
@@ -32,16 +32,19 @@
this.desktopToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.appLauncherToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.pnldesktop = new System.Windows.Forms.Panel();
+ this.lbdesktops = new System.Windows.Forms.ListBox();
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.gpalsettings = new System.Windows.Forms.GroupBox();
+ this.label1 = new System.Windows.Forms.Label();
+ this.menuStrip2 = new System.Windows.Forms.MenuStrip();
+ this.addToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.menuStrip1.SuspendLayout();
this.pnldesktop.SuspendLayout();
this.pnlapplauncher.SuspendLayout();
+ this.menuStrip2.SuspendLayout();
this.SuspendLayout();
//
// menuStrip1
@@ -71,6 +74,7 @@
//
// pnldesktop
//
+ this.pnldesktop.Controls.Add(this.menuStrip2);
this.pnldesktop.Controls.Add(this.lbdesktops);
this.pnldesktop.Controls.Add(this.gpdesktopsettings);
this.pnldesktop.Controls.Add(this.label2);
@@ -80,6 +84,16 @@
this.pnldesktop.Size = new System.Drawing.Size(582, 407);
this.pnldesktop.TabIndex = 1;
//
+ // 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;
+ this.lbdesktops.SelectedIndexChanged += new System.EventHandler(this.lbdesktops_SelectedIndexChanged);
+ //
// gpdesktopsettings
//
this.gpdesktopsettings.Dock = System.Windows.Forms.DockStyle.Bottom;
@@ -113,6 +127,25 @@
this.pnlapplauncher.Size = new System.Drawing.Size(582, 407);
this.pnlapplauncher.TabIndex = 0;
//
+ // 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;
+ //
+ // 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";
+ //
// label1
//
this.label1.AutoSize = true;
@@ -125,40 +158,30 @@
this.label1.Tag = "header2";
this.label1.Text = "App Launcher";
//
- // lbdesktops
+ // menuStrip2
//
- 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";
+ this.menuStrip2.Dock = System.Windows.Forms.DockStyle.Bottom;
+ this.menuStrip2.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.addToolStripMenuItem});
+ this.menuStrip2.Location = new System.Drawing.Point(0, 238);
+ this.menuStrip2.Name = "menuStrip2";
+ this.menuStrip2.Size = new System.Drawing.Size(582, 24);
+ this.menuStrip2.TabIndex = 0;
+ this.menuStrip2.Text = "menuStrip2";
//
- // lblaunchers
+ // addToolStripMenuItem
//
- 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;
+ this.addToolStripMenuItem.Name = "addToolStripMenuItem";
+ this.addToolStripMenuItem.Size = new System.Drawing.Size(41, 20);
+ this.addToolStripMenuItem.Text = "Add";
+ this.addToolStripMenuItem.Click += new System.EventHandler(this.addToolStripMenuItem_Click);
//
// 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.pnlapplauncher);
this.Controls.Add(this.menuStrip1);
this.Name = "ExperienceShifter";
this.Size = new System.Drawing.Size(582, 431);
@@ -168,6 +191,8 @@
this.pnldesktop.PerformLayout();
this.pnlapplauncher.ResumeLayout(false);
this.pnlapplauncher.PerformLayout();
+ this.menuStrip2.ResumeLayout(false);
+ this.menuStrip2.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
@@ -186,5 +211,7 @@
private System.Windows.Forms.ListBox lbdesktops;
private System.Windows.Forms.ListBox lblaunchers;
private System.Windows.Forms.GroupBox gpalsettings;
+ private System.Windows.Forms.MenuStrip menuStrip2;
+ private System.Windows.Forms.ToolStripMenuItem addToolStripMenuItem;
}
}
diff --git a/ShiftOS.WinForms/Applications/ExperienceShifter.cs b/ShiftOS.WinForms/Applications/ExperienceShifter.cs
index 2623b88..281b723 100644
--- a/ShiftOS.WinForms/Applications/ExperienceShifter.cs
+++ b/ShiftOS.WinForms/Applications/ExperienceShifter.cs
@@ -9,6 +9,8 @@ using System.Threading.Tasks;
using System.Windows.Forms;
using ShiftOS.Engine;
+using ShiftOS.Objects.ShiftFS;
+using Newtonsoft.Json;
namespace ShiftOS.WinForms.Applications
{
@@ -42,12 +44,27 @@ namespace ShiftOS.WinForms.Applications
public void PopulateDesktops()
{
lbdesktops.Items.Clear();
- foreach(var desk in Desktop.GetAllDesktops())
+ foreach(var desk in GetAllDesktops())
{
lbdesktops.Items.Add(desk.DesktopName);
}
}
+ public List<IDesktop> GetAllDesktops()
+ {
+ List<IDesktop> dekstops = new List<IDesktop>();
+ dekstops.Add(new WinformsDesktop());
+ if (!Utils.FileExists(Paths.GetPath("conf.sft")))
+ Utils.WriteAllText(Paths.GetPath("conf.sft"), JsonConvert.SerializeObject(new ShiftOSConfigFile(), Formatting.Indented));
+
+ foreach(var script in JsonConvert.DeserializeObject<ShiftOSConfigFile>(Utils.ReadAllText(Paths.GetPath("conf.sft"))).Desktops)
+ {
+ if(Utils.FileExists(script))
+ dekstops.Add(new LuaDesktop(script));
+ }
+ return dekstops;
+ }
+
public void PopulateLaunchers()
{
lblaunchers.Items.Clear();
@@ -83,5 +100,37 @@ namespace ShiftOS.WinForms.Applications
currentUI = "applauncher";
SetupUI();
}
+
+ private void addToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ FileSkimmerBackend.GetFile(new[] { ".lua" }, FileOpenerStyle.Open, new Action<string>((script) =>
+ {
+ ShiftOSConfigFile conf = new WinForms.ShiftOSConfigFile();
+ if (Utils.FileExists(Paths.GetPath("conf.sft")))
+ {
+ conf = JsonConvert.DeserializeObject<ShiftOSConfigFile>(Utils.ReadAllText(Paths.GetPath("conf.sft")));
+ }
+ conf.Desktops.Add(script);
+ Utils.WriteAllText(Paths.GetPath("conf.sft"), JsonConvert.SerializeObject(conf, Formatting.Indented));
+ }));
+ }
+
+ private void lbdesktops_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ foreach(var desk in GetAllDesktops())
+ {
+ try
+ {
+ if(desk.DesktopName == lbdesktops.SelectedItem.ToString())
+ {
+ Desktop.Init(desk, true);
+ }
+ }
+ catch
+ {
+
+ }
+ }
+ }
}
}
diff --git a/ShiftOS.WinForms/Applications/ExperienceShifter.resx b/ShiftOS.WinForms/Applications/ExperienceShifter.resx
index d5494e3..2d404e0 100644
--- a/ShiftOS.WinForms/Applications/ExperienceShifter.resx
+++ b/ShiftOS.WinForms/Applications/ExperienceShifter.resx
@@ -120,4 +120,7 @@
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
+ <metadata name="menuStrip2.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>132, 17</value>
+ </metadata>
</root> \ No newline at end of file
diff --git a/ShiftOS.WinForms/GUIFunctions.cs b/ShiftOS.WinForms/GUIFunctions.cs
new file mode 100644
index 0000000..edccea9
--- /dev/null
+++ b/ShiftOS.WinForms/GUIFunctions.cs
@@ -0,0 +1,85 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using ShiftOS.Engine.Scripting;
+using System.Drawing;
+using ShiftOS.Engine;
+
+namespace ShiftOS.WinForms
+{
+ [Exposed("gui")]
+ public class GUIFunctions
+ {
+ public dynamic color(int r, int g, int b)
+ {
+ return Color.FromArgb(r, g, b);
+ }
+
+ public dynamic color(string name)
+ {
+ return Color.FromName(name);
+ }
+
+ public dynamic point(int x, int y)
+ {
+ return new Point(x, y);
+ }
+
+ public dynamic size(int w, int h)
+ {
+ return new Size(w, h);
+ }
+
+ public dynamic font(string name, float size, bool bold, bool italic, bool strikethrough, bool underline)
+ {
+ FontStyle fs = FontStyle.Regular;
+ if (bold)
+ fs = fs | FontStyle.Bold;
+ if (italic)
+ fs = fs | FontStyle.Italic;
+ if (underline)
+ fs = fs | FontStyle.Underline;
+ if (strikethrough)
+ fs = fs | FontStyle.Strikeout;
+
+ return new Font(name, size, fs);
+ }
+
+ public dynamic createWindow(string name, dynamic size)
+ {
+ var win = new Window();
+ win.Size = size;
+ AppearanceManager.SetupWindow(win);
+ return win;
+ }
+ }
+
+ [Exposed("clr")]
+ public class CommonLanguageRuntimeInterop
+ {
+ public dynamic construct(Type type, dynamic[] ctorParams)
+ {
+ return Activator.CreateInstance(type, ctorParams);
+ }
+
+ public dynamic typeOf(string typeName)
+ {
+ return Type.GetType(typeName);
+ }
+
+ public void throwException(string message)
+ {
+ throw new UserException(message);
+ }
+ }
+
+ public class UserException : Exception
+ {
+ public UserException(string message) :base("User threw exception using clr:throwException().\r\n\r\n" + message)
+ {
+
+ }
+ }
+}
diff --git a/ShiftOS.WinForms/LuaDesktop.Designer.cs b/ShiftOS.WinForms/LuaDesktop.Designer.cs
index 10681f3..7c77f0e 100644
--- a/ShiftOS.WinForms/LuaDesktop.Designer.cs
+++ b/ShiftOS.WinForms/LuaDesktop.Designer.cs
@@ -28,11 +28,32 @@
/// </summary>
private void InitializeComponent()
{
- this.components = new System.ComponentModel.Container();
+ this.pnlcanvas = new System.Windows.Forms.Panel();
+ this.SuspendLayout();
+ //
+ // pnlcanvas
+ //
+ this.pnlcanvas.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.pnlcanvas.Location = new System.Drawing.Point(0, 0);
+ this.pnlcanvas.Name = "pnlcanvas";
+ this.pnlcanvas.Size = new System.Drawing.Size(284, 261);
+ this.pnlcanvas.TabIndex = 0;
+ //
+ // LuaDesktop
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(284, 261);
+ this.Controls.Add(this.pnlcanvas);
+ this.Name = "LuaDesktop";
this.Text = "LuaDesktop";
+ this.Load += new System.EventHandler(this.LuaDesktop_Load);
+ this.ResumeLayout(false);
+
}
#endregion
+
+ private System.Windows.Forms.Panel pnlcanvas;
}
} \ No newline at end of file
diff --git a/ShiftOS.WinForms/LuaDesktop.cs b/ShiftOS.WinForms/LuaDesktop.cs
index 445a571..8fd5244 100644
--- a/ShiftOS.WinForms/LuaDesktop.cs
+++ b/ShiftOS.WinForms/LuaDesktop.cs
@@ -7,17 +7,35 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
-
+using Newtonsoft.Json;
using ShiftOS.Engine;
using ShiftOS.Engine.Scripting;
+using ShiftOS.Objects.ShiftFS;
+using static ShiftOS.Engine.SkinEngine;
+
namespace ShiftOS.WinForms
{
public partial class LuaDesktop : Form, IDesktop
{
- public LuaDesktop()
+ public LuaDesktop(string script)
{
InitializeComponent();
+ interpreter = new LuaInterpreter();
+ interpreter.Lua.getCanvas = new Func<Panel>(() =>
+ {
+ return this.pnlcanvas;
+ });
+ if (Utils.FileExists(script))
+ {
+ interpreter.ExecuteFile(script);
+ }
+ else
+ {
+ Desktop.Init(new WinformsDesktop(), true);
+ Infobox.Show("Script not found.", "Couldn't find a ShiftOS script to handle the desktop environment.");
+ this.Close();
+ }
}
private LuaInterpreter interpreter = null;
@@ -39,6 +57,8 @@ namespace ShiftOS.WinForms
}
}
+ private IWindowBorder focused = null;
+
public Size GetSize()
{
return this.Size;
@@ -49,44 +69,146 @@ namespace ShiftOS.WinForms
this.Invoke(act);
}
- public void KillWindow(IWindowBorder border)
+ public void PopulateAppLauncher(LauncherItem[] items)
{
- throw new NotImplementedException();
+ interpreter.Lua.populateAppLauncher(interpreter.Lua.totable(new List<LauncherItem>(items)));
}
- public void MaximizeWindow(IWindowBorder brdr)
+ public void PopulatePanelButtons()
{
- throw new NotImplementedException();
+ interpreter.Lua.populatePanelButtons();
}
- public void MinimizeWindow(IWindowBorder brdr)
+ public void SetupDesktop()
{
- throw new NotImplementedException();
+ try
+ {
+ interpreter.Lua.setupDesktop();
+ }
+ catch (Exception ex)
+ {
+ Infobox.Show("Desktop setup error", "The desktop environment threw an exception: \r\n\r\n\r\n" + ex.Message);
+ Desktop.Init(new WinformsDesktop(), true);
+ this.Close();
+ }
}
- public void PopulateAppLauncher(LauncherItem[] items)
+ public void ShowWindow(IWindowBorder border)
{
-
+ var brdr = border as Form;
+ focused = border;
+ brdr.GotFocus += (o, a) =>
+ {
+ focused = border;
+ };
+ brdr.FormBorderStyle = FormBorderStyle.None;
+ brdr.Show();
+ brdr.TopMost = true;
}
- public void PopulatePanelButtons()
+ /// <summary>
+ /// Kills the window.
+ /// </summary>
+ /// <returns>The window.</returns>
+ /// <param name="border">Border.</param>
+ public void KillWindow(IWindowBorder border)
{
- throw new NotImplementedException();
+ border.Close();
}
- public void RestoreWindow(IWindowBorder brdr)
+ /// <summary>
+ /// Minimizes the window.
+ /// </summary>
+ /// <param name="brdr">Brdr.</param>
+ public void MinimizeWindow(IWindowBorder brdr)
+ {
+ var loc = (brdr as WindowBorder).Location;
+ var sz = (brdr as WindowBorder).Size;
+ (brdr as WindowBorder).Tag = JsonConvert.SerializeObject(new
+ {
+ Size = sz,
+ Location = loc
+ });
+ (brdr as WindowBorder).Location = new Point(this.GetSize().Width * 2, this.GetSize().Height * 2);
+ }
+
+ /// <summary>
+ /// Maximizes the window.
+ /// </summary>
+ /// <returns>The window.</returns>
+ /// <param name="brdr">Brdr.</param>
+ public void MaximizeWindow(IWindowBorder brdr)
{
- throw new NotImplementedException();
+ int startY = (LoadedSkin.DesktopPanelPosition == 1) ? 0 : LoadedSkin.DesktopPanelHeight;
+ int h = this.GetSize().Height - LoadedSkin.DesktopPanelHeight;
+ var loc = (brdr as WindowBorder).Location;
+ var sz = (brdr as WindowBorder).Size;
+ (brdr as WindowBorder).Tag = JsonConvert.SerializeObject(new
+ {
+ Size = sz,
+ Location = loc
+ });
+ (brdr as WindowBorder).Location = new Point(0, startY);
+ (brdr as WindowBorder).Size = new Size(this.GetSize().Width, h);
+
}
- public void SetupDesktop()
+ /// <summary>
+ /// Restores the window.
+ /// </summary>
+ /// <returns>The window.</returns>
+ /// <param name="brdr">Brdr.</param>
+ public void RestoreWindow(IWindowBorder brdr)
{
- throw new NotImplementedException();
+ dynamic tag = JsonConvert.DeserializeObject<dynamic>((brdr as WindowBorder).Tag.ToString());
+ (brdr as WindowBorder).Location = tag.Location;
+ (brdr as WindowBorder).Size = tag.Size;
+
}
- public void ShowWindow(IWindowBorder border)
+ private void LuaDesktop_Load(object sender, EventArgs e)
{
- throw new NotImplementedException();
+ this.LocationChanged += (o, a) =>
+ {
+ if (this.Left != 0)
+ this.Left = 0;
+ if (this.Top != 0)
+ this.Top = 0;
+ };
+
+ this.SizeChanged += (o, a) =>
+ {
+ if(this.DisplayRectangle != Screen.PrimaryScreen.Bounds)
+ {
+ this.WindowState = FormWindowState.Maximized;
+ }
+ };
+
+ interpreter.Lua.onLoadDesktop();
+ SetupDesktop();
+ SaveSystem.GameReady += () =>
+ {
+ InvokeOnWorkerThread(new Action(() =>
+ {
+ SetupDesktop();
+ }));
+ };
+ SkinEngine.SkinLoaded += () =>
+ {
+ if(this.Visible == true)
+ {
+ SetupDesktop();
+ }
+ };
+ Shiftorium.Installed += () =>
+ {
+ if (this.Visible == true)
+ {
+ SetupDesktop();
+ }
+
+ };
+
}
}
}
diff --git a/ShiftOS.WinForms/LuaDesktop.resx b/ShiftOS.WinForms/LuaDesktop.resx
new file mode 100644
index 0000000..1af7de1
--- /dev/null
+++ b/ShiftOS.WinForms/LuaDesktop.resx
@@ -0,0 +1,120 @@
+<?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>
+</root> \ No newline at end of file
diff --git a/ShiftOS.WinForms/ShiftOS.WinForms.csproj b/ShiftOS.WinForms/ShiftOS.WinForms.csproj
index f63dcd2..d2260cf 100644
--- a/ShiftOS.WinForms/ShiftOS.WinForms.csproj
+++ b/ShiftOS.WinForms/ShiftOS.WinForms.csproj
@@ -207,6 +207,7 @@
<Compile Include="FakeSetupScreen.Designer.cs">
<DependentUpon>FakeSetupScreen.cs</DependentUpon>
</Compile>
+ <Compile Include="GUIFunctions.cs" />
<Compile Include="JobTasks.cs" />
<Compile Include="LuaDesktop.cs">
<SubType>Form</SubType>
@@ -221,12 +222,19 @@
<DependentUpon>Oobe.cs</DependentUpon>
</Compile>
<Compile Include="ShiftOSAudioProvider.cs" />
+ <Compile Include="ShiftOSConfigFile.cs" />
<Compile Include="Tools\ColorPickerDataBackend.cs" />
<Compile Include="Tools\ControlManager.cs" />
<Compile Include="Tools\DitheringEngine.cs" />
<Compile Include="Tools\ShiftOSMenuRenderer.cs" />
<Compile Include="TrailerCommands.cs" />
<Compile Include="WFLanguageProvider.cs" />
+ <Compile Include="Window.cs">
+ <SubType>UserControl</SubType>
+ </Compile>
+ <Compile Include="Window.Designer.cs">
+ <DependentUpon>Window.cs</DependentUpon>
+ </Compile>
<Compile Include="WindowBorder.cs">
<SubType>Form</SubType>
</Compile>
@@ -305,6 +313,9 @@
<EmbeddedResource Include="FakeSetupScreen.resx">
<DependentUpon>FakeSetupScreen.cs</DependentUpon>
</EmbeddedResource>
+ <EmbeddedResource Include="LuaDesktop.resx">
+ <DependentUpon>LuaDesktop.cs</DependentUpon>
+ </EmbeddedResource>
<EmbeddedResource Include="Oobe.resx">
<DependentUpon>Oobe.cs</DependentUpon>
</EmbeddedResource>
diff --git a/ShiftOS.WinForms/ShiftOSConfigFile.cs b/ShiftOS.WinForms/ShiftOSConfigFile.cs
new file mode 100644
index 0000000..60a9a41
--- /dev/null
+++ b/ShiftOS.WinForms/ShiftOSConfigFile.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ShiftOS.WinForms
+{
+ public class ShiftOSConfigFile
+ {
+ public ShiftOSConfigFile()
+ {
+ AudioVolume = 0.5F;
+ Desktops = new List<string>();
+ }
+
+ public float AudioVolume { get; set; }
+ public List<string> Desktops { get; set; }
+ }
+}
diff --git a/ShiftOS.WinForms/Window.Designer.cs b/ShiftOS.WinForms/Window.Designer.cs
new file mode 100644
index 0000000..520f614
--- /dev/null
+++ b/ShiftOS.WinForms/Window.Designer.cs
@@ -0,0 +1,37 @@
+namespace ShiftOS.WinForms
+{
+ partial class Window
+ {
+ /// <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()
+ {
+ components = new System.ComponentModel.Container();
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ }
+
+ #endregion
+ }
+}
diff --git a/ShiftOS.WinForms/Window.cs b/ShiftOS.WinForms/Window.cs
new file mode 100644
index 0000000..9295820
--- /dev/null
+++ b/ShiftOS.WinForms/Window.cs
@@ -0,0 +1,44 @@
+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.Scripting;
+
+
+namespace ShiftOS.WinForms
+{
+ public partial class Window : UserControl, IShiftOSWindow
+ {
+ public Window()
+ {
+ InitializeComponent();
+ }
+
+ public void OnLoad()
+ {
+ LuaInterpreter.RaiseEvent("on_window_load", this);
+ }
+
+ public void OnSkinLoad()
+ {
+ LuaInterpreter.RaiseEvent("on_window_skin_load", this);
+ }
+
+ public bool OnUnload()
+ {
+ LuaInterpreter.RaiseEvent("on_window_unload", this);
+ return true;
+ }
+
+ public void OnUpgrade()
+ {
+ LuaInterpreter.RaiseEvent("on_window_upgrade", this);
+ }
+ }
+}
diff --git a/ShiftOS.WinForms/WinformsDesktop.cs b/ShiftOS.WinForms/WinformsDesktop.cs
index c2bbe5c..0ea150c 100644
--- a/ShiftOS.WinForms/WinformsDesktop.cs
+++ b/ShiftOS.WinForms/WinformsDesktop.cs
@@ -75,8 +75,16 @@ namespace ShiftOS.WinForms
}
};
- SaveSystem.GameReady += () => this.Invoke(new Action(() => SetupDesktop()));
- Shiftorium.Installed += () => this.Invoke(new Action(() => SetupDesktop()));
+ SaveSystem.GameReady += () =>
+ {
+ if(this.Visible == true)
+ this.Invoke(new Action(() => SetupDesktop()));
+ };
+ Shiftorium.Installed += () =>
+ {
+ if(this.Visible == true)
+ this.Invoke(new Action(() => SetupDesktop()));
+ };
var time = new Timer();
time.Interval = 100;
this.KeyDown += (o, a) =>
@@ -112,16 +120,7 @@ namespace ShiftOS.WinForms
time.Start();
this.DoubleBuffered = true;
- SetCursors(this);
- }
-
- public void SetCursors(Control ctrl)
- {
- ControlManager.SetupControl(ctrl);
- foreach(Control child in ctrl.Controls)
- {
- SetCursors(child);
- }
+
}
/// <summary>