public static async Task <int> ShowAsync(string title, object listSource, int defaultItem = 0) { ListPickerDialog dialog = new ListPickerDialog(title, listSource, defaultItem); await dialog.ShowAsync(); return(dialog.SelectedItem); }
private async Task <int> ShowRulesListPicker(string title) { List <string> li = new List <string>(); for (int i = rulesSources.Count - 1; i >= 0; i--) { li.Add(rulesSources[i].Date.ToString("d") + (i == rulesSources.Count - 1 ? " (" + ResourceLoader.GetForCurrentView().GetString("newest") + ")" : "")); } int n = await ListPickerDialog.ShowAsync(title, li, rulesSources.Count - actualRules - 1); return(n >= 0 && n < rulesSources.Count ? rulesSources.Count - n - 1 : -1); }