CredentialsUIImpl.cs
2.0 KB
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
using UnityEditor;
using Codice.Client.Common;
using Codice.Client.Common.Connection;
using PlasticGui;
using Unity.PlasticSCM.Editor.UI;
using Unity.PlasticSCM.Editor.Configuration.CloudEdition.Welcome;
namespace Unity.PlasticSCM.Editor.Configuration
{
internal class CredentialsUiImpl : AskCredentialsToUser.IGui
{
AskCredentialsToUser.DialogData AskCredentialsToUser.IGui.AskUserForCredentials(string servername)
{
AskCredentialsToUser.DialogData result = null;
GUIActionRunner.RunGUIAction(delegate
{
result = CredentialsDialog.RequestCredentials(
servername, ParentWindow.Get());
});
return result;
}
void AskCredentialsToUser.IGui.ShowSaveProfileErrorMessage(string message)
{
GUIActionRunner.RunGUIAction(delegate
{
GuiMessage.ShowError(string.Format(
PlasticLocalization.GetString(
PlasticLocalization.Name.CredentialsErrorSavingProfile),
message));
});
}
AskCredentialsToUser.DialogData AskCredentialsToUser.IGui.AskUserForSSOCredentials(string cloudServer)
{
AskCredentialsToUser.DialogData result = null;
// Check SSO auto login here
GUIActionRunner.RunGUIAction(delegate
{
result = RunCredentialsRequest(cloudServer);
});
return result;
}
private AskCredentialsToUser.DialogData RunCredentialsRequest(string cloudServer)
{
AutoLogin autoLogin = new AutoLogin();
var response = autoLogin.Run();
if (response != ResponseType.None)
{
return autoLogin.BuildCredentialsDialogData(response);
}
else
{
return SSOCredentialsDialog.RequestCredentials(cloudServer, ParentWindow.Get());
}
}
}
}