async Task ExecuteLoadItemsCommand() { if (IsBusy) { return; } IsBusy = true; try { Items.Clear(); var items = await BusAppService.GetBusListAsync(); foreach (var item in items) { Items.Add(new Item { Description = item.Value, Text = item.Key }); } } catch (Exception ex) { Toast.MakeText(Android.App.Application.Context, ex.Message, ToastLength.Long).Show(); Debug.WriteLine(ex); } finally { IsBusy = false; } }
static void Main(string[] args) { IBusAppService busAppService = new BusAppService(); var result = busAppService.GetBusListAsync().Result; foreach (var item in result) { Console.WriteLine($"{item.Key}:{item.Value}"); } Console.WriteLine("Hello World!"); Console.ReadKey(); }