aboutsummaryrefslogtreecommitdiff
path: root/source/WindowsFormsApplication1
diff options
context:
space:
mode:
authorMichaelTheShifter <[email protected]>2016-07-20 13:52:12 -0400
committerMichaelTheShifter <[email protected]>2016-07-20 13:52:12 -0400
commitb52090021ff0ae61db652e8a486cbff6732f5ec5 (patch)
treed6b3fa622525e293f715c963e46cb91465b4a064 /source/WindowsFormsApplication1
parent64aae03a9b08a10ace6366008093e95ab5e99945 (diff)
downloadshiftos-c--b52090021ff0ae61db652e8a486cbff6732f5ec5.tar.gz
shiftos-c--b52090021ff0ae61db652e8a486cbff6732f5ec5.tar.bz2
shiftos-c--b52090021ff0ae61db652e8a486cbff6732f5ec5.zip
Move ShiftUI designer to ShiftOS and add
prober for ShiftOS to allow ShiftUI designer to design ShiftOS forms.
Diffstat (limited to 'source/WindowsFormsApplication1')
-rw-r--r--source/WindowsFormsApplication1/API.cs1
-rw-r--r--source/WindowsFormsApplication1/Apps/BitnoteWallet.cs15
-rw-r--r--source/WindowsFormsApplication1/Apps/Shifter.Designer.cs9
-rw-r--r--source/WindowsFormsApplication1/Controls/ProgressBarEX.cs8
-rw-r--r--source/WindowsFormsApplication1/Engine/Lua_Interp.cs4
-rw-r--r--source/WindowsFormsApplication1/Program.cs72
6 files changed, 54 insertions, 55 deletions
diff --git a/source/WindowsFormsApplication1/API.cs b/source/WindowsFormsApplication1/API.cs
index 4434fc7..ce0ad8c 100644
--- a/source/WindowsFormsApplication1/API.cs
+++ b/source/WindowsFormsApplication1/API.cs
@@ -1926,6 +1926,7 @@ namespace ShiftOS
public static Color[] yellowmemory = new Color[16];
public static Color[] pinkmemory = new Color[16];
internal static Dictionary<string, Dictionary<string, object>> LuaShifterRegistry = null;
+ public static bool ShouldLoadEngine = true;
#endregion
}
diff --git a/source/WindowsFormsApplication1/Apps/BitnoteWallet.cs b/source/WindowsFormsApplication1/Apps/BitnoteWallet.cs
index 7b19c70..3a7164e 100644
--- a/source/WindowsFormsApplication1/Apps/BitnoteWallet.cs
+++ b/source/WindowsFormsApplication1/Apps/BitnoteWallet.cs
@@ -22,14 +22,17 @@ namespace ShiftOS
public BitnoteWallet()
{
InitializeComponent();
- Clients = new List<BitnoteClient>();
- foreach(var c in Package_Grabber.clients)
+ if (API.ShouldLoadEngine)
{
- if(c.Value.IsConnected)
+ Clients = new List<BitnoteClient>();
+ foreach (var c in Package_Grabber.clients)
{
- var client = new BitnoteClient(c.Key);
- client.GetBank();
- Clients.Add(client);
+ if (c.Value.IsConnected)
+ {
+ var client = new BitnoteClient(c.Key);
+ client.GetBank();
+ Clients.Add(client);
+ }
}
}
}
diff --git a/source/WindowsFormsApplication1/Apps/Shifter.Designer.cs b/source/WindowsFormsApplication1/Apps/Shifter.Designer.cs
index 04a61d3..568822e 100644
--- a/source/WindowsFormsApplication1/Apps/Shifter.Designer.cs
+++ b/source/WindowsFormsApplication1/Apps/Shifter.Designer.cs
@@ -443,7 +443,6 @@ namespace ShiftOS
this.pnlshifterintro.SuspendLayout();
this.pnldesktopoptions.SuspendLayout();
this.pnldesktoppaneloptions.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.txtdesktoppanelheight)).BeginInit();
this.pnlapplauncheroptions.SuspendLayout();
this.pnldesktopintro.SuspendLayout();
this.pnlpanelbuttonsoptions.SuspendLayout();
@@ -453,7 +452,6 @@ namespace ShiftOS
this.predesktoppanel.SuspendLayout();
this.prepnlpanelbuttonholder.SuspendLayout();
this.prepnlpanelbutton.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.pretbicon)).BeginInit();
this.pretimepanel.SuspendLayout();
this.preapplaunchermenuholder.SuspendLayout();
this.predesktopappmenu.SuspendLayout();
@@ -472,7 +470,6 @@ namespace ShiftOS
this.prepgleft.SuspendLayout();
this.prepgright.SuspendLayout();
this.pretitlebar.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.prepnlicon)).BeginInit();
this.pnlreset.SuspendLayout();
this.pgcontents.SuspendLayout();
this.pnldesktopcomposition.SuspendLayout();
@@ -5123,7 +5120,7 @@ namespace ShiftOS
this.pnldesktopoptions.ResumeLayout(false);
this.pnldesktoppaneloptions.ResumeLayout(false);
this.pnldesktoppaneloptions.PerformLayout();
- ((System.ComponentModel.ISupportInitialize)(this.txtdesktoppanelheight)).EndInit();
+ //((System.ComponentModel.ISupportInitialize)(this.txtdesktoppanelheight)).EndInit();
this.pnlapplauncheroptions.ResumeLayout(false);
this.pnlapplauncheroptions.PerformLayout();
this.pnldesktopintro.ResumeLayout(false);
@@ -5139,7 +5136,7 @@ namespace ShiftOS
this.prepnlpanelbuttonholder.ResumeLayout(false);
this.prepnlpanelbutton.ResumeLayout(false);
this.prepnlpanelbutton.PerformLayout();
- ((System.ComponentModel.ISupportInitialize)(this.pretbicon)).EndInit();
+ //((System.ComponentModel.ISupportInitialize)(this.pretbicon)).EndInit();
this.pretimepanel.ResumeLayout(false);
this.pretimepanel.PerformLayout();
this.preapplaunchermenuholder.ResumeLayout(false);
@@ -5169,7 +5166,7 @@ namespace ShiftOS
this.prepgright.ResumeLayout(false);
this.pretitlebar.ResumeLayout(false);
this.pretitlebar.PerformLayout();
- ((System.ComponentModel.ISupportInitialize)(this.prepnlicon)).EndInit();
+ //((System.ComponentModel.ISupportInitialize)(this.prepnlicon)).EndInit();
this.pnlreset.ResumeLayout(false);
this.pgcontents.ResumeLayout(false);
this.pgcontents.PerformLayout();
diff --git a/source/WindowsFormsApplication1/Controls/ProgressBarEX.cs b/source/WindowsFormsApplication1/Controls/ProgressBarEX.cs
index d89969e..8febdcd 100644
--- a/source/WindowsFormsApplication1/Controls/ProgressBarEX.cs
+++ b/source/WindowsFormsApplication1/Controls/ProgressBarEX.cs
@@ -102,13 +102,7 @@ namespace ShiftOS
get { return _MaxValue; }
set
{
- if (value > this.MinValue)
- {
- _MaxValue = value;
- }
- else {
- throw new ArgumentOutOfRangeException("The maximum value must be more than the minimum value.");
- }
+ _MaxValue = value;
}
}
diff --git a/source/WindowsFormsApplication1/Engine/Lua_Interp.cs b/source/WindowsFormsApplication1/Engine/Lua_Interp.cs
index fabc1be..d36b4d9 100644
--- a/source/WindowsFormsApplication1/Engine/Lua_Interp.cs
+++ b/source/WindowsFormsApplication1/Engine/Lua_Interp.cs
@@ -1466,9 +1466,7 @@ end");
/// <returns>The converted widget.</returns>
public static Widget ToWidget(this System.Windows.Forms.Control ctrl)
{
- string json = JsonConvert.SerializeObject(ctrl);
- json = json.Replace("Control", "Widget");
- return JsonConvert.DeserializeObject<Widget>(json);
+ return new Controls.WinFormsHost(ctrl);
}
}
}
diff --git a/source/WindowsFormsApplication1/Program.cs b/source/WindowsFormsApplication1/Program.cs
index 5f3f1ad..af294db 100644
--- a/source/WindowsFormsApplication1/Program.cs
+++ b/source/WindowsFormsApplication1/Program.cs
@@ -12,24 +12,24 @@ using Newtonsoft.Json;
namespace ShiftOS
{
- static class Program
+ public static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
- static void Main(string[] args)
+ public static void Main(string[] args)
{
-
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
//Extract all dependencies before starting the engine.
ExtractDependencies();
- var poolThread = new Thread(new ThreadStart(new Action(() => {
+ var poolThread = new Thread(new ThreadStart(new Action(() =>
+ {
try
{
- //Download ShiftOS server startup-pool
- string pool = new WebClient().DownloadString("http://playshiftos.ml/server/startup_pool");
+ //Download ShiftOS server startup-pool
+ string pool = new WebClient().DownloadString("http://playshiftos.ml/server/startup_pool");
string[] splitter = pool.Split(';');
foreach (string address in splitter)
{
@@ -55,13 +55,14 @@ namespace ShiftOS
//Start the Windows Forms backend
Paths.RegisterPaths(); //Sets ShiftOS path variables based on the current OS.
SaveSystem.Utilities.CheckForOlderSaves(); //Backs up C:\ShiftOS on Windows systems if it exists and doesn't contain a _engineInfo.txt file telling ShiftOS what engine created it.
- //If there isn't a save folder at the directory specified by ShiftOS.Paths.SaveRoot, create a new save.
- //If not, load that save.
+ //If there isn't a save folder at the directory specified by ShiftOS.Paths.SaveRoot, create a new save.
+ //If not, load that save.
if (Directory.Exists(Paths.SaveRoot))
{
API.Log("Loading ShiftOS save...");
SaveSystem.Utilities.loadGame();
- } else
+ }
+ else
{
SaveSystem.Utilities.NewGame();
}
@@ -80,44 +81,48 @@ namespace ShiftOS
Skinning.Utilities.loadskin();
SaveSystem.ShiftoriumRegistry.UpdateShiftorium();
//Lua bootscreen.
- if(File.Exists(Paths.SaveRoot + "BOOT"))
+ if (File.Exists(Paths.SaveRoot + "BOOT"))
{
string lua = File.ReadAllText(Paths.SaveRoot + "BOOT");
var l = new LuaInterpreter();
l.mod(lua);
}
//Start recieving calls from the Modding API...
- Application.Run(new ShiftOSDesktop());
- //By now, the API receiver has been loaded,
- //and the desktop is shown. So, let's check
- //for auto-start mods.
- if(Directory.Exists(Paths.AutoStart))
+ if (!args.Contains("nodisplay"))
{
- foreach(string file in Directory.GetFiles(Paths.AutoStart))
+ Application.Run(new ShiftOSDesktop());
+ //By now, the API receiver has been loaded,
+ //and the desktop is shown. So, let's check
+ //for auto-start mods.
+ if (Directory.Exists(Paths.AutoStart))
{
- var inf = new FileInfo(file);
- switch(inf.Extension)
+ foreach (string file in Directory.GetFiles(Paths.AutoStart))
{
- case ".saa":
- if (API.Upgrades["shiftnet"] == true)
- {
- API.Log("Starting start-up mod \"" + inf.FullName + "\"...");
- API.LaunchMod(inf.FullName);
- }
- break;
- case ".trm":
- var t = new Terminal();
- t.runterminalfile(inf.FullName);
- API.Log("Started terminal file \"" + inf.FullName + "\"...");
- break;
- } }
+ var inf = new FileInfo(file);
+ switch (inf.Extension)
+ {
+ case ".saa":
+ if (API.Upgrades["shiftnet"] == true)
+ {
+ API.Log("Starting start-up mod \"" + inf.FullName + "\"...");
+ API.LaunchMod(inf.FullName);
+ }
+ break;
+ case ".trm":
+ var t = new Terminal();
+ t.runterminalfile(inf.FullName);
+ API.Log("Started terminal file \"" + inf.FullName + "\"...");
+ break;
+ }
+ }
+ }
}
//Now, for some ShiftOS launcher integration.
try
{
- if(args[0] != null)
+ if (args[0] != null)
{
- if(args[0] != "")
+ if (args[0] != "")
{
API.CurrentSave.username = args[0];
//Username set.
@@ -130,6 +135,7 @@ namespace ShiftOS
}
}
+
static void ExtractDependencies()
{
//Wow. This'll make it easy for people...