aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS.WinForms
diff options
context:
space:
mode:
authorMichael <[email protected]>2017-04-23 14:53:10 -0400
committerMichael <[email protected]>2017-04-23 14:53:10 -0400
commite833a9bf2751f16d8614af9aa20f5b9bec3d81a8 (patch)
tree2bed17163caeb9f417394d91b741d6c7d6766a8c /ShiftOS.WinForms
parentba0ae29bbb7eee83c5a4969316d97b43b5f18ba0 (diff)
downloadshiftos_thereturn-e833a9bf2751f16d8614af9aa20f5b9bec3d81a8.tar.gz
shiftos_thereturn-e833a9bf2751f16d8614af9aa20f5b9bec3d81a8.tar.bz2
shiftos_thereturn-e833a9bf2751f16d8614af9aa20f5b9bec3d81a8.zip
FUCKTONS OF SHIFTORIUM WORK
Diffstat (limited to 'ShiftOS.WinForms')
-rw-r--r--ShiftOS.WinForms/Applications/FormatEditor.cs3
-rw-r--r--ShiftOS.WinForms/Applications/Shiftnet.Designer.cs30
-rw-r--r--ShiftOS.WinForms/Applications/Shiftnet.cs301
-rw-r--r--ShiftOS.WinForms/Applications/ShiftoriumFrontend.cs2
-rw-r--r--ShiftOS.WinForms/Program.cs33
-rw-r--r--ShiftOS.WinForms/Resources/Shiftorium.txt7
-rw-r--r--ShiftOS.WinForms/ShiftOS.WinForms.csproj18
-rw-r--r--ShiftOS.WinForms/ShiftnetSites/AppscapeMain.Designer.cs113
-rw-r--r--ShiftOS.WinForms/ShiftnetSites/AppscapeMain.cs208
-rw-r--r--ShiftOS.WinForms/ShiftnetSites/AppscapeMain.resx120
-rw-r--r--ShiftOS.WinForms/ShiftnetSites/MainHomepage.Designer.cs153
-rw-r--r--ShiftOS.WinForms/ShiftnetSites/MainHomepage.cs89
-rw-r--r--ShiftOS.WinForms/ShiftnetSites/MainHomepage.resx128
-rw-r--r--ShiftOS.WinForms/WindowBorder.cs15
14 files changed, 987 insertions, 233 deletions
diff --git a/ShiftOS.WinForms/Applications/FormatEditor.cs b/ShiftOS.WinForms/Applications/FormatEditor.cs
index 7491e36..db52d85 100644
--- a/ShiftOS.WinForms/Applications/FormatEditor.cs
+++ b/ShiftOS.WinForms/Applications/FormatEditor.cs
@@ -36,11 +36,10 @@ using ShiftOS.Engine;
namespace ShiftOS.WinForms.Applications {
[MultiplayerOnly]
[Launcher("Format Editor", true, "al_format_editor", "Customization")]
- [RequiresUpgrade("format_editor")]
+ [AppscapeEntry("Format Editor", "Edit the syntax of your Terminal to be however you like.", 750, "file_skimmer", "Customization")]
[WinOpen("formateditor")]
[DefaultTitle("Format Editor")]
[DefaultIcon("iconFormatEditor")]
-
public partial class FormatEditor : UserControl, IShiftOSWindow {
IList<CommandFormat> parts = new List<CommandFormat>();
diff --git a/ShiftOS.WinForms/Applications/Shiftnet.Designer.cs b/ShiftOS.WinForms/Applications/Shiftnet.Designer.cs
index eca44ae..a7fe700 100644
--- a/ShiftOS.WinForms/Applications/Shiftnet.Designer.cs
+++ b/ShiftOS.WinForms/Applications/Shiftnet.Designer.cs
@@ -57,13 +57,12 @@ namespace ShiftOS.WinForms.Applications
this.btnforward = new System.Windows.Forms.Button();
this.txturl = new System.Windows.Forms.TextBox();
this.btngo = new System.Windows.Forms.Button();
- this.wbcanvas = new System.Windows.Forms.WebBrowser();
+ this.pnlcanvas = new System.Windows.Forms.Panel();
this.flcontrols.SuspendLayout();
this.SuspendLayout();
//
// flcontrols
//
- this.flcontrols.AutoSize = true;
this.flcontrols.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.flcontrols.Controls.Add(this.btnback);
this.flcontrols.Controls.Add(this.btnforward);
@@ -123,42 +122,35 @@ namespace ShiftOS.WinForms.Applications
this.btngo.UseVisualStyleBackColor = true;
this.btngo.Click += new System.EventHandler(this.btngo_Click);
//
- // wbcanvas
+ // pnlcanvas
//
- this.wbcanvas.Dock = System.Windows.Forms.DockStyle.Fill;
- this.wbcanvas.IsWebBrowserContextMenuEnabled = false;
- this.wbcanvas.Location = new System.Drawing.Point(0, 29);
- this.wbcanvas.MinimumSize = new System.Drawing.Size(20, 20);
- this.wbcanvas.Name = "wbcanvas";
- this.wbcanvas.ScriptErrorsSuppressed = true;
- this.wbcanvas.Size = new System.Drawing.Size(805, 510);
- this.wbcanvas.TabIndex = 1;
- this.wbcanvas.WebBrowserShortcutsEnabled = false;
- this.wbcanvas.Navigated += new System.Windows.Forms.WebBrowserNavigatedEventHandler(this.wbcanvas_Navigated);
- this.wbcanvas.Navigating += new System.Windows.Forms.WebBrowserNavigatingEventHandler(this.wbcanvas_Navigating);
+ this.pnlcanvas.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
+ this.pnlcanvas.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.pnlcanvas.Location = new System.Drawing.Point(0, 29);
+ this.pnlcanvas.Name = "pnlcanvas";
+ this.pnlcanvas.Size = new System.Drawing.Size(805, 510);
+ this.pnlcanvas.TabIndex = 1;
//
// Shiftnet
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.Controls.Add(this.wbcanvas);
+ this.Controls.Add(this.pnlcanvas);
this.Controls.Add(this.flcontrols);
this.Name = "Shiftnet";
this.Size = new System.Drawing.Size(805, 539);
this.flcontrols.ResumeLayout(false);
this.flcontrols.PerformLayout();
this.ResumeLayout(false);
- this.PerformLayout();
}
#endregion
-
- private System.Windows.Forms.FlowLayoutPanel flcontrols;
private System.Windows.Forms.Button btnback;
private System.Windows.Forms.Button btnforward;
private System.Windows.Forms.TextBox txturl;
private System.Windows.Forms.Button btngo;
- private System.Windows.Forms.WebBrowser wbcanvas;
+ private System.Windows.Forms.Panel pnlcanvas;
+ private System.Windows.Forms.FlowLayoutPanel flcontrols;
}
}
diff --git a/ShiftOS.WinForms/Applications/Shiftnet.cs b/ShiftOS.WinForms/Applications/Shiftnet.cs
index 54a8aa6..7f5d3c1 100644
--- a/ShiftOS.WinForms/Applications/Shiftnet.cs
+++ b/ShiftOS.WinForms/Applications/Shiftnet.cs
@@ -35,6 +35,8 @@ using ShiftOS.Engine;
using Newtonsoft.Json;
using static ShiftOS.Engine.SkinEngine;
using ShiftOS.WinForms.Tools;
+using System.IO;
+using System.Reflection;
namespace ShiftOS.WinForms.Applications
{
@@ -50,216 +52,34 @@ namespace ShiftOS.WinForms.Applications
[WinOpen("shiftnet")]
[RequiresUpgrade("victortran_shiftnet")]
[DefaultIcon("iconShiftnet")]
- public partial class Shiftnet : UserControl, IShiftOSWindow
+ public partial class Shiftnet : UserControl, IShiftOSWindow, IShiftnetClient
{
public Shiftnet()
{
InitializeComponent();
- ServerManager.MessageReceived += (msg) =>
- {
- try
- {
- if (msg.Name == "shiftnet_file")
- {
- if (Objects.ShiftFS.Utils.FileExists("0:/md.txt"))
- {
- this.Invoke(new Action(() =>
- {
- wbcanvas.DocumentText = ConstructHtml(Objects.ShiftFS.Utils.ReadAllText("0:/md.txt"));
- }));
- }
- else
- {
- this.Invoke(new Action(() =>
- {
- wbcanvas.DocumentText = ConstructHtml(msg.Contents);
- }));
- }
- }
- }
- catch
- {
-
- }
- };
- }
-
- public string ConstructHtml(string markdown)
- {
- var TerminalForeColor = ControlManager.ConvertColor(SkinEngine.LoadedSkin.TerminalForeColorCC);
- var TerminalBackColor = ControlManager.ConvertColor(SkinEngine.LoadedSkin.TerminalBackColorCC);
- string html = $@"<html>
- <head>
- <style>
- body {{
- background-color: rgb({LoadedSkin.ControlColor.R}, {LoadedSkin.ControlColor.G}, {LoadedSkin.ControlColor.B});
- color: rgb({LoadedSkin.ControlTextColor.R}, {LoadedSkin.ControlTextColor.G}, {LoadedSkin.ControlTextColor.B});
- font-family: ""{LoadedSkin.MainFont.Name}"";
- font-size: {LoadedSkin.MainFont.SizeInPoints}pt;
- }}
-
- h1 {{
- font-family: ""{LoadedSkin.HeaderFont.Name}"";
- font-size: {LoadedSkin.HeaderFont.SizeInPoints}pt;
- }}
-
- h2 {{
- font-family: ""{LoadedSkin.Header2Font.Name}"";
- font-size: {LoadedSkin.Header2Font.SizeInPoints}pt;
- }}
-
- h3 {{
- font-family: ""{LoadedSkin.Header3Font.Name}"";
- font-size: {LoadedSkin.Header3Font.SizeInPoints}pt;
- }}
-
- pre, code {{
- font-family: ""{LoadedSkin.TerminalFont.Name}"";
- font-size: {LoadedSkin.TerminalFont.SizeInPoints}pt;
- color: rgb({TerminalForeColor.R}, {TerminalForeColor.G}, {TerminalForeColor.B});
- background-color: rgb({TerminalBackColor.R}, {TerminalBackColor.G}, {TerminalBackColor.B});
- }}
- </style>
- </head>
- <body>
- <markdown/>
- </body>
-</html>";
-
- string body = CommonMark.CommonMarkConverter.Convert(markdown);
- for (int i = 0; i <= Encoding.UTF8.GetBytes(body).Length; i += DownloadManager.GetDownloadSpeed())
- {
- //halt the page load until 'download' finishes.
- }
- html = html.Replace("<markdown/>", body);
- return html;
}
public string CurrentUrl { get; set; }
- private void wbcanvas_Navigating(object sender, WebBrowserNavigatingEventArgs e)
- {
- string Url = e.Url.ToString().Replace("http://", "");
- if (CurrentUrl != Url.ToString() && !Url.ToString().StartsWith("about:"))
- {
- e.Cancel = true;
- Future.Clear();
- if (Url.StartsWith("runsyscmd/"))
- {
- ProcessShiftnetCmd(Url.Replace("runsyscmd/", ""));
- }
-
- ShiftnetNavigate(Url.ToString());
- }
- }
-
- public void ProcessShiftnetCmd(string cmd)
- {
- var args = cmd.Split('/');
- switch (args[0])
- {
- case "setsnsub":
- for (int i = 0; i < DownloadManager.GetAllSubscriptions().Length; i++)
- {
- if (DownloadManager.GetAllSubscriptions()[i].Name == args[1])
- {
- var sub = DownloadManager.GetAllSubscriptions()[i];
- Infobox.PromptYesNo("Shiftnet", $"Are you sure you want to switch your system's Shiftnet subscription to {sub.Name} by {sub.Company}?{Environment.NewLine}{Environment.NewLine}Cost per month: {sub.CostPerMonth} CP{Environment.NewLine}Download speed: {sub.DownloadSpeed} bytes per second", new Action<bool>((answer) =>
- {
- if (answer == true)
- {
- if (SaveSystem.CurrentSave.Codepoints >= sub.CostPerMonth)
- {
- //Initial fee gets deducted.
- SaveSystem.CurrentSave.Codepoints -= sub.CostPerMonth;
- //Then we set the subscription.
- SaveSystem.CurrentSave.ShiftnetSubscription = i;
- //Then we say that we have paid this month.
- SaveSystem.CurrentSave.LastMonthPaid = DateTime.Now.Month;
- //Then we send our save to the MUD.
- SaveSystem.SaveGame();
-
- }
- else
- {
- //User can't afford this subscription.
- Infobox.Show("Shiftnet - Not enough Codepoints", $"You cannot afford to pay for this subscription at this time. You need {sub.CostPerMonth - SaveSystem.CurrentSave.Codepoints} more Codepoints.");
- }
- }
- }));
- }
- }
- return;
- }
- }
-
public Stack<string> History = new Stack<string>();
public Stack<string> Future = new Stack<string>();
- public void ShiftnetNavigate(string Url, bool pushHistory = true)
- {
- if (Url.EndsWith(".rnp") || !Url.Contains("."))
- {
- if (!string.IsNullOrEmpty(CurrentUrl) && pushHistory)
- History.Push(CurrentUrl);
- CurrentUrl = Url;
- ServerManager.SendMessage("shiftnet_get", JsonConvert.SerializeObject(new
- {
- url = Url
- }));
- txturl.Text = Url;
-
- }
- else
- {
- ServerMessageReceived smr = null;
- smr = (msg) =>
- {
- if (msg.Name == "download_meta")
- {
- var bytes = JsonConvert.DeserializeObject<byte[]>(msg.Contents);
- string destPath = null;
- string ext = Url.Split('.')[Url.Split('.').Length - 1];
- this.Invoke(new Action(() =>
- {
- FileSkimmerBackend.GetFile(new[] { ext }, FileOpenerStyle.Save, new Action<string>((file) =>
- {
- destPath = file;
- }));
- }));
- while (string.IsNullOrEmpty(destPath))
- {
-
- }
- var d = new Download
- {
- ShiftnetUrl = Url,
- Destination = destPath,
- Bytes = bytes,
- Progress = 0,
- };
- DownloadManager.StartDownload(d);
- this.Invoke(new Action(() =>
- {
- AppearanceManager.SetupWindow(new Downloader());
- }));
- ServerManager.MessageReceived -= smr;
- }
- };
- ServerManager.MessageReceived += smr;
- ServerManager.SendMessage("download_start", Url);
- }
- }
+ public IShiftnetSite CurrentPage = null;
public void OnLoad()
{
- ShiftnetNavigate("shiftnet/main");
+ NavigateToUrl("shiftnet/main");
}
public void OnSkinLoad()
{
- ShiftnetNavigate(CurrentUrl);
+ CurrentPage?.OnSkinLoad();
+ btnback.Location = new Point(2, 2);
+ btnforward.Location = new Point(btnback.Left + btnback.Width + 2, 2);
+ txturl.Location = new Point(btnforward.Left + btnforward.Width + 2, 2);
+ txturl.Width = flcontrols.Width - btnback.Width - 2 - btnforward.Width - 2 - (btngo.Width*2) - 2;
+ btngo.Location = new Point(flcontrols.Width - btngo.Width - 2, 2);
}
public bool OnUnload()
@@ -269,6 +89,7 @@ namespace ShiftOS.WinForms.Applications
public void OnUpgrade()
{
+ CurrentPage?.OnUpgrade();
}
private void btnback_Click(object sender, EventArgs e)
@@ -279,7 +100,7 @@ namespace ShiftOS.WinForms.Applications
if (!string.IsNullOrEmpty(hist))
{
Future.Push(hist);
- ShiftnetNavigate(hist, false);
+ NavigateToUrl(hist);
}
}
catch
@@ -295,7 +116,8 @@ namespace ShiftOS.WinForms.Applications
string fut = Future.Pop();
if (!string.IsNullOrEmpty(fut))
{
- ShiftnetNavigate(fut);
+ History.Push(CurrentUrl);
+ NavigateToUrl(fut);
}
}
catch
@@ -309,8 +131,8 @@ namespace ShiftOS.WinForms.Applications
if (!string.IsNullOrWhiteSpace(txturl.Text))
{
Future.Clear();
-
- ShiftnetNavigate(txturl.Text);
+ History.Push(CurrentUrl);
+ NavigateToUrl(txturl.Text);
}
}
@@ -323,8 +145,95 @@ namespace ShiftOS.WinForms.Applications
}
}
- private void wbcanvas_Navigated(object sender, WebBrowserNavigatedEventArgs e)
+ public void NavigateToUrl(string url)
+ {
+ txturl.Text = url;
+ foreach(var exe in 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(IShiftnetSite)))
+ {
+ if (type.BaseType == typeof(UserControl))
+ {
+ var attribute = type.GetCustomAttributes(false).FirstOrDefault(x => x is ShiftnetSiteAttribute) as ShiftnetSiteAttribute;
+ if (attribute != null)
+ {
+ if (attribute.Url == url)
+ {
+ if (Shiftorium.UpgradeAttributesUnlocked(type))
+ {
+ var obj = (IShiftnetSite)Activator.CreateInstance(type, null);
+ obj.GoToUrl += (u) =>
+ {
+ History.Push(u);
+ NavigateToUrl(u);
+ };
+ obj.GoBack += () =>
+ {
+ string u = History.Pop();
+ Future.Push(u);
+ NavigateToUrl(u);
+ };
+ CurrentPage = obj;
+ this.pnlcanvas.Controls.Clear();
+ this.pnlcanvas.Controls.Add((UserControl)obj);
+ ((UserControl)obj).Show();
+ ((UserControl)obj).Dock = DockStyle.Fill;
+ obj.OnUpgrade();
+ obj.OnSkinLoad();
+ obj.Setup();
+ return;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ pnlcanvas.Controls.Clear();
+ var tlbl = new Label();
+ tlbl.Text = "Server error in \"" + url + "\" application.";
+ tlbl.Tag = "header1";
+ tlbl.AutoSize = true;
+ tlbl.Location = new Point(10, 10);
+ tlbl.Dock = DockStyle.Top;
+ pnlcanvas.Controls.Add(tlbl);
+ tlbl.Show();
+
+ var crash = new Label();
+ crash.Dock = DockStyle.Fill;
+ crash.AutoSize = false;
+ crash.Text = ex.ToString();
+ pnlcanvas.Controls.Add(crash);
+ crash.Show();
+ crash.BringToFront();
+ ControlManager.SetupControls(pnlcanvas);
+ return;
+ }
+ }
+ }
+ pnlcanvas.Controls.Clear();
+ var lbl = new Label();
+ lbl.Text = "Page not found!";
+ lbl.Tag = "header1";
+ lbl.AutoSize = true;
+ lbl.Location = new Point(10, 10);
+ pnlcanvas.Controls.Add(lbl);
+ lbl.Show();
+
+ }
+
+ public void RefreshSite()
{
+ NavigateToUrl(CurrentUrl);
}
}
}
diff --git a/ShiftOS.WinForms/Applications/ShiftoriumFrontend.cs b/ShiftOS.WinForms/Applications/ShiftoriumFrontend.cs
index 0762897..66b0448 100644
--- a/ShiftOS.WinForms/Applications/ShiftoriumFrontend.cs
+++ b/ShiftOS.WinForms/Applications/ShiftoriumFrontend.cs
@@ -185,7 +185,7 @@ namespace ShiftOS.WinForms.Applications
{
long cpCost = 0;
backend.Silent = true;
- Dictionary<string, int> UpgradesToBuy = new Dictionary<string, int>();
+ Dictionary<string, long> UpgradesToBuy = new Dictionary<string, long>();
foreach (var itm in lbupgrades.SelectedItems)
{
cpCost += upgrades[itm.ToString()].Cost;
diff --git a/ShiftOS.WinForms/Program.cs b/ShiftOS.WinForms/Program.cs
index 36c9338..3343cb0 100644
--- a/ShiftOS.WinForms/Program.cs
+++ b/ShiftOS.WinForms/Program.cs
@@ -34,6 +34,7 @@ using static ShiftOS.Objects.ShiftFS.Utils;
using ShiftOS.WinForms.Applications;
using ShiftOS.WinForms.Tools;
using System.Reflection;
+using System.IO;
namespace ShiftOS.WinForms
{
@@ -98,7 +99,37 @@ namespace ShiftOS.WinForms
{
public List<ShiftoriumUpgrade> GetDefaults()
{
- return JsonConvert.DeserializeObject<List<ShiftoriumUpgrade>>(Properties.Resources.Shiftorium);
+ var defaultList = JsonConvert.DeserializeObject<List<ShiftoriumUpgrade>>(Properties.Resources.Shiftorium);
+
+ foreach(var exe in Directory.GetFiles(Environment.CurrentDirectory))
+ {
+ if(exe.EndsWith(".exe") || exe.EndsWith(".dll"))
+ {
+ try
+ {
+ var asm = Assembly.LoadFile(exe);
+ foreach(var type in asm.GetTypes())
+ {
+ var attrib = type.GetCustomAttributes(false).FirstOrDefault(x => x is AppscapeEntryAttribute) as AppscapeEntryAttribute;
+ if(attrib != null)
+ {
+ var upgrade = new ShiftoriumUpgrade
+ {
+ Id = attrib.Name.ToLower().Replace(" ", "_"),
+ Name = attrib.Name,
+ Description = attrib.Description,
+ Cost = attrib.Cost,
+ Category = attrib.Category,
+ Dependencies = (string.IsNullOrWhiteSpace(attrib.DependencyString)) ? "appscape_handled_nodisplay" : "appscape_handled_nodisplay;" + attrib.DependencyString
+ };
+ defaultList.Add(upgrade);
+ }
+ }
+ }
+ catch { }
+ }
+ }
+ return defaultList;
}
}
diff --git a/ShiftOS.WinForms/Resources/Shiftorium.txt b/ShiftOS.WinForms/Resources/Shiftorium.txt
index ca555d4..e68277c 100644
--- a/ShiftOS.WinForms/Resources/Shiftorium.txt
+++ b/ShiftOS.WinForms/Resources/Shiftorium.txt
@@ -369,13 +369,6 @@
Dependencies:"desktop;wm_unlimited_windows"
},
{
- Name: "Format Editor",
- Cost: 6000,
- Description: "Allows you to change the format of commands.",
- Category: "Applications",
- Dependencies: "shifter;name_changer"
- },
- {
Name: "Format Editor Optional Text",
Cost: 150,
Description: "Allows you to add an optional text to commands",
diff --git a/ShiftOS.WinForms/ShiftOS.WinForms.csproj b/ShiftOS.WinForms/ShiftOS.WinForms.csproj
index bd8fd65..3edfd38 100644
--- a/ShiftOS.WinForms/ShiftOS.WinForms.csproj
+++ b/ShiftOS.WinForms/ShiftOS.WinForms.csproj
@@ -317,6 +317,18 @@
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="ScriptingTestFunctions.cs" />
+ <Compile Include="ShiftnetSites\AppscapeMain.cs">
+ <SubType>UserControl</SubType>
+ </Compile>
+ <Compile Include="ShiftnetSites\AppscapeMain.Designer.cs">
+ <DependentUpon>AppscapeMain.cs</DependentUpon>
+ </Compile>
+ <Compile Include="ShiftnetSites\MainHomepage.cs">
+ <SubType>UserControl</SubType>
+ </Compile>
+ <Compile Include="ShiftnetSites\MainHomepage.Designer.cs">
+ <DependentUpon>MainHomepage.cs</DependentUpon>
+ </Compile>
<Compile Include="ShiftOSAudioProvider.cs" />
<Compile Include="ShiftOSConfigFile.cs" />
<Compile Include="SkinCommands.cs" />
@@ -463,6 +475,12 @@
<SubType>Designer</SubType>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
+ <EmbeddedResource Include="ShiftnetSites\AppscapeMain.resx">
+ <DependentUpon>AppscapeMain.cs</DependentUpon>
+ </EmbeddedResource>
+ <EmbeddedResource Include="ShiftnetSites\MainHomepage.resx">
+ <DependentUpon>MainHomepage.cs</DependentUpon>
+ </EmbeddedResource>
<EmbeddedResource Include="WindowBorder.resx">
<DependentUpon>WindowBorder.cs</DependentUpon>
</EmbeddedResource>
diff --git a/ShiftOS.WinForms/ShiftnetSites/AppscapeMain.Designer.cs b/ShiftOS.WinForms/ShiftnetSites/AppscapeMain.Designer.cs
new file mode 100644
index 0000000..6698e5a
--- /dev/null
+++ b/ShiftOS.WinForms/ShiftnetSites/AppscapeMain.Designer.cs
@@ -0,0 +1,113 @@
+namespace ShiftOS.WinForms.ShiftnetSites
+{
+ partial class AppscapeMain
+ {
+ /// <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.label1 = new System.Windows.Forms.Label();
+ this.flcategories = new System.Windows.Forms.FlowLayoutPanel();
+ this.pnlappslist = new System.Windows.Forms.Panel();
+ this.label2 = new System.Windows.Forms.Label();
+ this.lbtitle = new System.Windows.Forms.Label();
+ this.SuspendLayout();
+ //
+ // label1
+ //
+ this.label1.AutoSize = true;
+ this.label1.Location = new System.Drawing.Point(17, 17);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(55, 13);
+ this.label1.TabIndex = 0;
+ this.label1.Tag = "header1";
+ this.label1.Text = "Appscape";
+ //
+ // flcategories
+ //
+ this.flcategories.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)));
+ this.flcategories.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
+ this.flcategories.Location = new System.Drawing.Point(20, 120);
+ this.flcategories.Margin = new System.Windows.Forms.Padding(0);
+ this.flcategories.Name = "flcategories";
+ this.flcategories.Size = new System.Drawing.Size(187, 310);
+ this.flcategories.TabIndex = 1;
+ //
+ // pnlappslist
+ //
+ this.pnlappslist.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.pnlappslist.Location = new System.Drawing.Point(221, 120);
+ this.pnlappslist.Name = "pnlappslist";
+ this.pnlappslist.Size = new System.Drawing.Size(459, 310);
+ this.pnlappslist.TabIndex = 2;
+ //
+ // label2
+ //
+ this.label2.AutoSize = true;
+ this.label2.Location = new System.Drawing.Point(20, 76);
+ this.label2.Name = "label2";
+ this.label2.Size = new System.Drawing.Size(57, 13);
+ this.label2.TabIndex = 3;
+ this.label2.Tag = "header2";
+ this.label2.Text = "Categories";
+ //
+ // lbtitle
+ //
+ this.lbtitle.AutoSize = true;
+ this.lbtitle.Location = new System.Drawing.Point(218, 76);
+ this.lbtitle.Name = "lbtitle";
+ this.lbtitle.Size = new System.Drawing.Size(57, 13);
+ this.lbtitle.TabIndex = 4;
+ this.lbtitle.Tag = "header2";
+ this.lbtitle.Text = "Categories";
+ //
+ // AppscapeMain
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.Controls.Add(this.lbtitle);
+ this.Controls.Add(this.label2);
+ this.Controls.Add(this.pnlappslist);
+ this.Controls.Add(this.flcategories);
+ this.Controls.Add(this.label1);
+ this.Name = "AppscapeMain";
+ this.Size = new System.Drawing.Size(709, 457);
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.Label label1;
+ private System.Windows.Forms.FlowLayoutPanel flcategories;
+ private System.Windows.Forms.Panel pnlappslist;
+ private System.Windows.Forms.Label label2;
+ private System.Windows.Forms.Label lbtitle;
+ }
+}
diff --git a/ShiftOS.WinForms/ShiftnetSites/AppscapeMain.cs b/ShiftOS.WinForms/ShiftnetSites/AppscapeMain.cs
new file mode 100644
index 0000000..88db07b
--- /dev/null
+++ b/ShiftOS.WinForms/ShiftnetSites/AppscapeMain.cs
@@ -0,0 +1,208 @@
+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.WinForms.Tools;
+
+namespace ShiftOS.WinForms.ShiftnetSites
+{
+ [ShiftnetSite("shiftnet/appscape", "Appscape", "Bringing ShiftOS to life")]
+ [ShiftnetFundamental]
+ public partial class AppscapeMain : UserControl, IShiftnetSite
+ {
+ public AppscapeMain()
+ {
+ InitializeComponent();
+ }
+
+ public event Action GoBack;
+ public event Action<string> GoToUrl;
+
+ public void OnSkinLoad()
+ {
+ ControlManager.SetupControls(this);
+ }
+
+ public void OnUpgrade()
+ {
+ }
+
+ public string Category = "All";
+
+ public string[] GetCategories()
+ {
+ var upgrades = Shiftorium.GetDefaults().Where(x => x.Dependencies.Contains("appscape_"));
+ List<string> cats = new List<string>();
+ cats.Add("All");
+ try
+ {
+ if (upgrades.Count() > 0)
+ foreach (var upg in upgrades)
+ {
+ if (!cats.Contains(upg.Category))
+ cats.Add(upg.Category);
+ }
+ }
+ catch { }
+ return cats.ToArray();
+ }
+
+ public ShiftoriumUpgrade CurrentUpgrade = null;
+
+ public void SetupCategory(string cat)
+ {
+ pnlappslist.Controls.Clear();
+ pnlappslist.Show();
+ pnlappslist.BringToFront();
+ Category = cat;
+ var upgrades = GetAllInCategory();
+ lbtitle.Text = cat;
+ if(upgrades.Length == 0)
+ {
+ var err = new Label();
+ err.AutoSize = true;
+ err.Text = "There are no apps in this list! Come back later for more.";
+ pnlappslist.Controls.Add(err);
+ err.Show();
+ }
+ else
+ {
+ var fl = new FlowLayoutPanel();
+ fl.Dock = DockStyle.Fill;
+ pnlappslist.Controls.Add(fl);
+ fl.Show();
+ foreach(var upg in upgrades)
+ {
+ var pnl = new Panel();
+ pnl.Height = 250;
+ pnl.Width = 200;
+ fl.Controls.Add(pnl);
+ pnl.Show();
+ var upgTitle = new Label();
+ upgTitle.Text = upg.Name;
+ upgTitle.Dock = DockStyle.Top;
+ upgTitle.AutoSize = true;
+ upgTitle.MaximumSize = new Size(pnl.Width, 0);
+ upgTitle.Tag = "header3";
+ pnl.Controls.Add(upgTitle);
+ upgTitle.Show();
+
+ var cp_display = new Panel();
+ cp_display.Height = 30;
+ cp_display.Dock = DockStyle.Bottom;
+ pnl.Controls.Add(cp_display);
+ cp_display.Show();
+
+ var cp_value = new Label();
+ if (Shiftorium.UpgradeInstalled(upg.ID))
+ {
+ cp_value.Text = "Out of stock.";
+ }
+ else
+ {
+ cp_value.Text = $"{upg.Cost} CP";
+ }
+ cp_value.AutoSize = true;
+ cp_value.Top = (cp_display.Height - cp_value.Height) / 2;
+ cp_value.Left = 5;
+ cp_display.Controls.Add(cp_value);
+ cp_value.Show();
+
+
+ if(cp_value.Text != "Out of stock.")
+ {
+ var more_info = new Button();
+ more_info.Text = "More info";
+ more_info.Click += (o, a) =>
+ {
+ ViewMoreInfo(upg);
+ };
+ more_info.AutoSize = false;
+ more_info.AutoSizeMode = AutoSizeMode.GrowAndShrink;
+ more_info.Top = (cp_display.Height - more_info.Height) / 2;
+ more_info.Left = cp_display.Width - more_info.Width - 5;
+ cp_display.Controls.Add(more_info);
+ more_info.Show();
+ }
+
+ var desc = new Label();
+ desc.Text = upg.Description;
+ desc.AutoSize = false;
+ desc.Dock = DockStyle.Fill;
+ pnl.Controls.Add(desc);
+ desc.Show();
+ desc.BringToFront();
+
+
+ ControlManager.SetupControls(pnl);
+ }
+ }
+ }
+
+ public void ViewMoreInfo(ShiftoriumUpgrade upg)
+ {
+
+ }
+
+ public ShiftoriumUpgrade[] GetAllInCategory()
+ {
+ var upgrades = Shiftorium.GetDefaults().Where(x => (x.Dependencies == null) ? false : x.Dependencies.Contains("appscape_"));
+ if (upgrades.Count() == 0)
+ return new ShiftoriumUpgrade[0];
+
+ if (Category == "All")
+ return upgrades.ToArray();
+ else
+ return upgrades.Where(x => x.Category == Category).ToArray();
+ }
+
+ public void Setup()
+ {
+ flcategories.Controls.Clear();
+ foreach(var cat in this.GetCategories())
+ {
+ var btn = new Button();
+ btn.Text = cat;
+ btn.Click += (o, a) =>
+ {
+ SetupCategory(cat);
+ };
+ ControlManager.SetupControl(btn);
+ btn.Width = flcategories.Width - 2;
+ flcategories.Controls.Add(btn);
+ btn.Show();
+ }
+ SetupCategory("All");
+ }
+ }
+}
+
+namespace ShiftOS.WinForms
+{
+ /// <summary>
+ /// Special version of <see cref="RequiresUpgradeAttribute"/> for specifying Appscape applications as Shiftorium upgrades.
+ /// </summary>
+ public class AppscapeEntryAttribute : RequiresUpgradeAttribute
+ {
+ public AppscapeEntryAttribute(string name, string description, long cost, string dependencies = "", string category = "Misc") : base((string.IsNullOrWhiteSpace(dependencies)) ? name.ToLower().Replace(" ","_") : name.ToLower().Replace(" ", "_") + dependencies)
+ {
+ Name = name;
+ Description = description;
+ Category = category;
+ Cost = cost;
+ DependencyString = dependencies;
+ }
+
+ public string Name { get; private set; }
+ public string Description { get; private set; }
+ public string Category { get; private set; }
+ public long Cost { get; private set; }
+ public string DependencyString { get; private set; }
+ }
+} \ No newline at end of file
diff --git a/ShiftOS.WinForms/ShiftnetSites/AppscapeMain.resx b/ShiftOS.WinForms/ShiftnetSites/AppscapeMain.resx
new file mode 100644
index 0000000..1af7de1
--- /dev/null
+++ b/ShiftOS.WinForms/ShiftnetSites/AppscapeMain.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/ShiftnetSites/MainHomepage.Designer.cs b/ShiftOS.WinForms/ShiftnetSites/MainHomepage.Designer.cs
new file mode 100644
index 0000000..bebc8bd
--- /dev/null
+++ b/ShiftOS.WinForms/ShiftnetSites/MainHomepage.Designer.cs
@@ -0,0 +1,153 @@
+namespace ShiftOS.WinForms.ShiftnetSites
+{
+ partial class MainHomepage
+ {
+ /// <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()
+ {
+ System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainHomepage));
+ this.label1 = new System.Windows.Forms.Label();
+ this.label2 = new System.Windows.Forms.Label();
+ this.panel1 = new System.Windows.Forms.Panel();
+ this.lbspecheader = new System.Windows.Forms.Label();
+ this.label3 = new System.Windows.Forms.Label();
+ this.panel2 = new System.Windows.Forms.Panel();
+ this.label4 = new System.Windows.Forms.Label();
+ this.flfundamentals = new System.Windows.Forms.FlowLayoutPanel();
+ this.panel1.SuspendLayout();
+ this.panel2.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // label1
+ //
+ this.label1.Dock = System.Windows.Forms.DockStyle.Top;
+ this.label1.Location = new System.Drawing.Point(0, 0);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(710, 65);
+ this.label1.TabIndex = 0;
+ this.label1.Tag = "header1";
+ this.label1.Text = "Welcome to the Shiftnet!";
+ this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+ //
+ // label2
+ //
+ this.label2.Dock = System.Windows.Forms.DockStyle.Top;
+ this.label2.Location = new System.Drawing.Point(0, 65);
+ this.label2.Name = "label2";
+ this.label2.Size = new System.Drawing.Size(710, 22);
+ this.label2.TabIndex = 1;
+ this.label2.Text = "The Shiftnet is a vast network of services, websites, software and so much more f" +
+ "or ShiftOS. Have a look around!";
+ this.label2.TextAlign = System.Drawing.ContentAlignment.TopCenter;
+ //
+ // panel1
+ //
+ this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.panel1.Controls.Add(this.label3);
+ this.panel1.Controls.Add(this.lbspecheader);
+ this.panel1.Location = new System.Drawing.Point(27, 140);
+ this.panel1.Name = "panel1";
+ this.panel1.Size = new System.Drawing.Size(389, 281);
+ this.panel1.TabIndex = 2;
+ //
+ // lbspecheader
+ //
+ this.lbspecheader.Dock = System.Windows.Forms.DockStyle.Top;
+ this.lbspecheader.Location = new System.Drawing.Point(0, 0);
+ this.lbspecheader.Name = "lbspecheader";
+ this.lbspecheader.Size = new System.Drawing.Size(389, 42);
+ this.lbspecheader.TabIndex = 0;
+ this.lbspecheader.Tag = "header3";
+ this.lbspecheader.Text = "How to use the Shiftnet";
+ //
+ // label3
+ //
+ this.label3.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.label3.Location = new System.Drawing.Point(0, 42);
+ this.label3.Name = "label3";
+ this.label3.Size = new System.Drawing.Size(389, 239);
+ this.label3.TabIndex = 1;
+ this.label3.Text = resources.GetString("label3.Text");
+ //
+ // panel2
+ //
+ this.panel2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.panel2.Controls.Add(this.flfundamentals);
+ this.panel2.Controls.Add(this.label4);
+ this.panel2.Location = new System.Drawing.Point(439, 140);
+ this.panel2.Name = "panel2";
+ this.panel2.Size = new System.Drawing.Size(247, 281);
+ this.panel2.TabIndex = 3;
+ //
+ // label4
+ //
+ this.label4.Dock = System.Windows.Forms.DockStyle.Top;
+ this.label4.Location = new System.Drawing.Point(0, 0);
+ this.label4.Name = "label4";
+ this.label4.Size = new System.Drawing.Size(247, 42);
+ this.label4.TabIndex = 1;
+ this.label4.Tag = "header3";
+ this.label4.Text = "The Fundamentals";
+ //
+ // flfundamentals
+ //
+ this.flfundamentals.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.flfundamentals.Location = new System.Drawing.Point(0, 42);
+ this.flfundamentals.Name = "flfundamentals";
+ this.flfundamentals.Size = new System.Drawing.Size(247, 239);
+ this.flfundamentals.TabIndex = 2;
+ //
+ // MainHomepage
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.Controls.Add(this.panel2);
+ this.Controls.Add(this.panel1);
+ this.Controls.Add(this.label2);
+ this.Controls.Add(this.label1);
+ this.Name = "MainHomepage";
+ this.Size = new System.Drawing.Size(710, 437);
+ this.panel1.ResumeLayout(false);
+ this.panel2.ResumeLayout(false);
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.Label label1;
+ private System.Windows.Forms.Label label2;
+ private System.Windows.Forms.Panel panel1;
+ private System.Windows.Forms.Label lbspecheader;
+ private System.Windows.Forms.Label label3;
+ private System.Windows.Forms.Panel panel2;
+ private System.Windows.Forms.FlowLayoutPanel flfundamentals;
+ private System.Windows.Forms.Label label4;
+ }
+}
diff --git a/ShiftOS.WinForms/ShiftnetSites/MainHomepage.cs b/ShiftOS.WinForms/ShiftnetSites/MainHomepage.cs
new file mode 100644
index 0000000..cb39cd6
--- /dev/null
+++ b/ShiftOS.WinForms/ShiftnetSites/MainHomepage.cs
@@ -0,0 +1,89 @@
+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.WinForms.Tools;
+using System.Reflection;
+using System.IO;
+
+namespace ShiftOS.WinForms.ShiftnetSites
+{
+ [ShiftnetSite("shiftnet/main", "Main Site", "The main Shiftnet hub.")]
+ public partial class MainHomepage : UserControl, IShiftnetSite
+ {
+ public MainHomepage()
+ {
+ InitializeComponent();
+ }
+
+ public event Action GoBack;
+ public event Action<string> GoToUrl;
+
+ public void OnSkinLoad()
+ {
+ ControlManager.SetupControls(this);
+ }
+
+ public void OnUpgrade()
+ {
+
+ }
+
+ public void Setup()
+ {
+ //Get the Fundamentals List
+ flfundamentals.Controls.Clear();
+ foreach (var exe in 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(IShiftnetSite)))
+ {
+ if (type.BaseType == typeof(UserControl))
+ {
+ var attribute = type.GetCustomAttributes(false).FirstOrDefault(x => x is ShiftnetSiteAttribute) as ShiftnetSiteAttribute;
+ if (attribute != null)
+ {
+ if (Shiftorium.UpgradeAttributesUnlocked(type))
+ {
+ if (type.GetCustomAttributes(false).FirstOrDefault(x => x is ShiftnetFundamentalAttribute) != null)
+ {
+ var dash = new Label();
+ dash.Text = " - ";
+ dash.AutoSize = true;
+ flfundamentals.Controls.Add(dash);
+ dash.Show();
+ var link = new LinkLabel();
+ link.Text = attribute.Name;
+ link.Click += (o, a) =>
+ {
+ GoToUrl?.Invoke(attribute.Url);
+ };
+ flfundamentals.Controls.Add(link);
+ flfundamentals.SetFlowBreak(link, true);
+ link.Show();
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ catch { }
+ }
+ }
+
+ }
+ }
+}
diff --git a/ShiftOS.WinForms/ShiftnetSites/MainHomepage.resx b/ShiftOS.WinForms/ShiftnetSites/MainHomepage.resx
new file mode 100644
index 0000000..e9a0c8f
--- /dev/null
+++ b/ShiftOS.WinForms/ShiftnetSites/MainHomepage.resx
@@ -0,0 +1,128 @@
+<?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>
+ <data name="label3.Text" xml:space="preserve">
+ <value>The Shiftnet works a lot like a regular web browser. To browse to a website, you can either click links or you can type a Shiftnet URL into your Address Bar at the top and click "Go".
+
+An example of a Shiftnet URL would be "shiftnet/main", which you are at right now. This is the main Shiftnet hub. You can also browse to files and folder listings, if you have access to them.
+
+
+There are lots of Shiftnet websites for you to visit - so go ahead and explore, but first, check out some of the fundamental sites and services to the right!</value>
+ </data>
+</root> \ No newline at end of file
diff --git a/ShiftOS.WinForms/WindowBorder.cs b/ShiftOS.WinForms/WindowBorder.cs
index 64f2da4..2829a3e 100644
--- a/ShiftOS.WinForms/WindowBorder.cs
+++ b/ShiftOS.WinForms/WindowBorder.cs
@@ -134,18 +134,16 @@ namespace ShiftOS.WinForms
}
};
- this.Width = LoadedSkin.LeftBorderWidth + _parentWindow.Width + LoadedSkin.RightBorderWidth;
- this.Height = LoadedSkin.TitlebarHeight + _parentWindow.Height + LoadedSkin.BottomBorderWidth;
-
- SetupControls(this);
-
+
+
this.pnlcontents.Controls.Add(this._parentWindow);
this._parentWindow.Dock = DockStyle.Fill;
this._parentWindow.Show();
+ SetupControls(this);
+ this.Width = LoadedSkin.LeftBorderWidth + this.Width + LoadedSkin.RightBorderWidth;
+ this.Height = LoadedSkin.TitlebarHeight + this.Height + LoadedSkin.BottomBorderWidth;
ControlManager.SetupControls(this._parentWindow);
- ParentWindow.OnSkinLoad();
- ParentWindow.OnUpgrade();
Shiftorium.Installed += () =>
{
Setup();
@@ -221,6 +219,9 @@ namespace ShiftOS.WinForms
this.Left = (Screen.PrimaryScreen.Bounds.Width - this.Width) / 2;
this.Top = (Screen.PrimaryScreen.Bounds.Height - this.Height) / 2;
ParentWindow.OnLoad();
+ ParentWindow.OnSkinLoad();
+ ParentWindow.OnUpgrade();
+
}
/// <summary>