Пример #1
0
        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;
            }
        }
Пример #2
0
        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();
        }