aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS.WinForms/ShiftnetSites/MainHomepage.cs
diff options
context:
space:
mode:
authorwilliam341 <[email protected]>2017-05-28 12:37:00 -0700
committerGitHub <[email protected]>2017-05-28 12:37:00 -0700
commit771c20cfb3a703e0f1550fdcf9eb07b78298c944 (patch)
tree59cb532e15ebff313fdba2be264d78ec0033f407 /ShiftOS.WinForms/ShiftnetSites/MainHomepage.cs
parent496b0cbf8659c99203f48210fd39c572400ae623 (diff)
parentc7ba7d733c756d196f98dd4533289a1ef4db715f (diff)
downloadshiftos_thereturn-771c20cfb3a703e0f1550fdcf9eb07b78298c944.tar.gz
shiftos_thereturn-771c20cfb3a703e0f1550fdcf9eb07b78298c944.tar.bz2
shiftos_thereturn-771c20cfb3a703e0f1550fdcf9eb07b78298c944.zip
Merge pull request #1 from shiftos-game/master
welp, no longer a dev.
Diffstat (limited to 'ShiftOS.WinForms/ShiftnetSites/MainHomepage.cs')
-rw-r--r--ShiftOS.WinForms/ShiftnetSites/MainHomepage.cs92
1 files changed, 92 insertions, 0 deletions
diff --git a/ShiftOS.WinForms/ShiftnetSites/MainHomepage.cs b/ShiftOS.WinForms/ShiftnetSites/MainHomepage.cs
new file mode 100644
index 0000000..6e692a7
--- /dev/null
+++ b/ShiftOS.WinForms/ShiftnetSites/MainHomepage.cs
@@ -0,0 +1,92 @@
+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();
+ link.LinkColor = SkinEngine.LoadedSkin.ControlTextColor;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ catch { }
+ }
+ }
+
+ }
+ }
+}
+
+//I COMMITTED MYSELF, RYLAN! \ No newline at end of file