blob: de30cf1048771af54b297378ee170c77c9d69d6c (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
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;
}
}
[Obsolete("Old code.")]
public static event Action<dynamic> LoginComplete;
}
/// <summary>
/// Interface for GUI-based logins.
/// </summary>
public interface ILoginFrontend
{
/// <summary>
/// When implemented, shows the login UI.
/// </summary>
void Login();
/// <summary>
/// Gets whether the ShiftOS engine should use a GUI-based login system or the default one.
/// </summary>
bool UseGUILogin { get; }
/// <summary>
/// Occurs when the login is complete.
/// </summary>
event Action<dynamic> LoginComplete;
}
}
|