Пример #1
0
        private void OnTapLoQueTenesQueSaber(object sender, EventArgs e)
        {
            Task <Noticia> taskNoticias = ApiRest.GetFormData <Noticia>((string)(App.Current.Resources["APIRoot"]));

            taskNoticias.ContinueWith((task) => {
                try
                {
                    ObservableCollection <Detalle> ListaNoticias = new ObservableCollection <Detalle>();
                    foreach (Detalle d in ((Noticia)task.Result).data)
                    {
                        ListaNoticias.Add(d);
                    }
                    Device.BeginInvokeOnMainThread(() => {
                        Navigation.PopModalAsync(true);
                        Navigation.PushAsync(new Noticias(ListaNoticias), true);
                    });
                }
                catch
                {
                    Device.BeginInvokeOnMainThread(new Action(() => {
                        Navigation.PopModalAsync(false);
                        Navigation.PushModalAsync(new Loading("No se pudieron cargar tus noticias"), false);
                    }));
                }
            });
            Navigation.PushModalAsync(new Loading("Cargando noticias..."), false);
        }