/// <summary>
/// User selected a language from the list. If reqd,
/// ask the user to confirm the switch
/// </summary>
/// <param name="cultureInfo">Cultureinfo of the language selected</param>
/// <returns>true on success</returns>
private void onLanguageSelected(CultureInfo cultureInfo)
{
if (DialogUtils.ConfirmScanner(String.Format(R.GetString("ConfirmSwitchLanguage"), cultureInfo.DisplayName)))
{
Windows.SetVisible(this, false);
var toastForm = new ToastForm(R.GetString("PleaseWait"), -1);
Windows.SetWindowPosition(toastForm, Windows.WindowPosition.CenterScreen);
toastForm.Show();
Invoke(new MethodInvoker(delegate
{
Context.ChangeCulture(cultureInfo);
}));
toastForm.Close();
var prefs = ACATPreferences.Load();
prefs.Language = cultureInfo.Name;
prefs.Save();
Windows.CloseAsync(this);
}
}