diff options
| author | Michael <[email protected]> | 2017-04-23 14:53:10 -0400 |
|---|---|---|
| committer | Michael <[email protected]> | 2017-04-23 14:53:10 -0400 |
| commit | e833a9bf2751f16d8614af9aa20f5b9bec3d81a8 (patch) | |
| tree | 2bed17163caeb9f417394d91b741d6c7d6766a8c /ShiftOS.WinForms/ShiftnetSites | |
| parent | ba0ae29bbb7eee83c5a4969316d97b43b5f18ba0 (diff) | |
| download | shiftos_thereturn-e833a9bf2751f16d8614af9aa20f5b9bec3d81a8.tar.gz shiftos_thereturn-e833a9bf2751f16d8614af9aa20f5b9bec3d81a8.tar.bz2 shiftos_thereturn-e833a9bf2751f16d8614af9aa20f5b9bec3d81a8.zip | |
FUCKTONS OF SHIFTORIUM WORK
Diffstat (limited to 'ShiftOS.WinForms/ShiftnetSites')
| -rw-r--r-- | ShiftOS.WinForms/ShiftnetSites/AppscapeMain.Designer.cs | 113 | ||||
| -rw-r--r-- | ShiftOS.WinForms/ShiftnetSites/AppscapeMain.cs | 208 | ||||
| -rw-r--r-- | ShiftOS.WinForms/ShiftnetSites/AppscapeMain.resx | 120 | ||||
| -rw-r--r-- | ShiftOS.WinForms/ShiftnetSites/MainHomepage.Designer.cs | 153 | ||||
| -rw-r--r-- | ShiftOS.WinForms/ShiftnetSites/MainHomepage.cs | 89 | ||||
| -rw-r--r-- | ShiftOS.WinForms/ShiftnetSites/MainHomepage.resx | 128 |
6 files changed, 811 insertions, 0 deletions
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 |
