From 31cc9148dd23737df16d8456a42d003cd31dd488 Mon Sep 17 00:00:00 2001 From: Michael VanOverbeek Date: Sun, 21 May 2017 12:21:41 +0000 Subject: holy ashit --- ShiftOS_TheReturn/LoginManager.cs | 65 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 ShiftOS_TheReturn/LoginManager.cs (limited to 'ShiftOS_TheReturn/LoginManager.cs') diff --git a/ShiftOS_TheReturn/LoginManager.cs b/ShiftOS_TheReturn/LoginManager.cs new file mode 100644 index 0000000..d326f2c --- /dev/null +++ b/ShiftOS_TheReturn/LoginManager.cs @@ -0,0 +1,65 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using ShiftOS.Objects; + +namespace ShiftOS.Engine +{ + public static class LoginManager + { + private static ILoginFrontend _login = null; + + public static void Init(ILoginFrontend login) + { + _login = login; + } + + public static void PromptForLogin() + { + _login.LoginComplete += (user) => + { + LoginComplete?.Invoke(user); + }; + _login.Login(); + } + + public static bool ShouldUseGUILogin + { + get + { + if (_login == null) + return false; + return _login.UseGUILogin; + } + } + + public static event Action LoginComplete; + } + + /// + /// Interface for GUI-based logins. + /// + public interface ILoginFrontend + { + /// + /// When implemented, shows the login UI. + /// + void Login(); + + /// + /// Gets whether the ShiftOS engine should use a GUI-based login system or the default one. + /// + bool UseGUILogin { get; } + + + /// + /// Occurs when the login is complete. + /// + event Action LoginComplete; + + + + } +} -- cgit v1.2.3