async Task LoadComics()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                Comics.Clear();

                var comics = await _dataService.GetComicsBySeries(Character.SeriesId, OrderComicsBy);

                foreach (var c in comics)
                {
                    Comics.Add(c);
                }
            }
            finally
            {
                IsBusy = false;
            }
        }
        private async Task LoadComics()
        {
            var comics = await _backendService.GetComicsForSuperhero(Superhero.Id);

            Comics.Clear();

            foreach (var comic in comics)
            {
                Comics.Add(comic);
            }
        }
        private void LoadSuperheroes()
        {
            _backendService.GetComicsForSuperhero(Superhero.Id).Subscribe((comics) =>
            {
                Device.BeginInvokeOnMainThread(() =>
                {
                    Comics.Clear();

                    foreach (var comic in comics)
                    {
                        Comics.Add(comic);
                    }
                });
            }, async(ex) =>
            {
                await UserDialogs.Instance
                .AlertAsync("Something bad happened", "Nope, sorry!", "OK");
            });
        }
示例#4
0
        async Task GetComics()
        {
            if (!IsBusy)
            {
                Exception Error = null;

                try
                {
                    IsBusy = true;

                    var servico = new Services.AzureService <Comic>();
                    var Items   = await servico.GetComics();

                    Comics.Clear();

                    foreach (var comic in Items)
                    {
                        Comics.Add(comic);
                    }
                }
                catch (Exception ex)
                {
                    Error = ex;

                    if (Error != null)
                    {
                        await Xamarin.Forms.Application.Current.MainPage.DisplayAlert("Error!", Error.Message, "OK");
                    }
                }
                finally
                {
                    IsBusy = false;
                }
            }

            return;
        }