Last active
November 27, 2016 23:21
-
-
Save dudash/066ea16d8d3be003ea122ab425e392c1 to your computer and use it in GitHub Desktop.
Xamarin RHMAP Init Async - Snippet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public async void initRHMAPAndLogin() | |
{ | |
try | |
{ | |
bool inited = await FHClient.Init(); | |
if (inited) | |
{ | |
Console.WriteLine("FH init success"); | |
FH.SetLogLevel(1); | |
string authPolicy = "XamDemo"; | |
string username = "demo"; | |
string password = "password"; | |
FHResponse authRes = await FH.Auth(authPolicy, username, password); | |
if (null == authRes.Error) | |
{ | |
Console.WriteLine("Login Success"); | |
UIAlertView alert = new UIAlertView() | |
{ | |
Title = "Login", | |
Message = "Login Success" | |
}; | |
alert.AddButton("OK"); | |
alert.Show(); | |
} | |
else | |
{ | |
Console.WriteLine("Login Failed"); | |
UIAlertView alert = new UIAlertView() | |
{ | |
Title = "Login", | |
Message = "Login Failed" | |
}; | |
alert.AddButton("OK"); | |
alert.Show(); | |
} | |
} | |
else | |
{ | |
Console.WriteLine("FH init failed"); | |
} | |
} | |
catch (FHException e) | |
{ | |
//Initialisation failed, handle exception | |
Console.WriteLine("FH init failed"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment