Skip to content

Instantly share code, notes, and snippets.

@dudash
Last active November 27, 2016 23:21
Show Gist options
  • Save dudash/066ea16d8d3be003ea122ab425e392c1 to your computer and use it in GitHub Desktop.
Save dudash/066ea16d8d3be003ea122ab425e392c1 to your computer and use it in GitHub Desktop.
Xamarin RHMAP Init Async - Snippet
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