private void lvNoticias_ItemSelected(object sender, SelectedItemChangedEventArgs e) { if (e.SelectedItem != null) { Task<RootDetalle> taskNoticias = ApiRest.GetAsyncFormData<RootDetalle>((string)(App.Current.Resources["APIRoot"]) + "?id=" + ((Detalle)e.SelectedItem).ID); taskNoticias.ContinueWith((task) => { Device.BeginInvokeOnMainThread(() => { try { Navigation.PopModalAsync(true); Navigation.PushAsync(new NoticiaDetalle(((RootDetalle)task.Result).data), true); } catch { Navigation.PopModalAsync(); Navigation.PushModalAsync(new Loading("Error al obtener los detalles de tu noticia.")); } }); }); Navigation.PushModalAsync(new Loading("Cargando los detalles de tu noticia..."), false); //RootDetalle not = ApiRest.GetAsyncFormData<RootDetalle>((string)(App.Current.Resources["APIRoot"]) + "?id=" + ((Detalle)e.SelectedItem).ID).Result; //Navigation.PushAsync(new NoticiaDetalle(not.data)); } ((ListView)sender).SelectedItem = null; }
public CuandoPasa() { InitializeComponent(); UserMobileLocation taskCuandoPasa = ApiRest.GetAsyncFormData <UserMobileLocation>((string)App.Current.Resources["URLUserLocation"] + App.PlayerId).Result; var url = new UrlWebViewSource { Url = (string)Application.Current.Resources["URLCuandoPasa"] + "?lat=" + taskCuandoPasa.Lat + "&long=" + taskCuandoPasa.Lon + "&fa=" + GetActualDateJsonFormated() }; wAreas.Source = url; }
public Noticias () { InitializeComponent (); if (ListaNoticias == null) { ListaNoticias = new ObservableCollection<Detalle>(); } Noticia not = ApiRest.GetAsyncFormData<Noticia>((string)(App.Current.Resources["APIRoot"])).Result; foreach (Detalle d in not.data) { ListaNoticias.Add(d); } lvNoticias.ItemsSource = ListaNoticias; }
public App() { InitializeComponent(); if (!App.Current.Properties.ContainsKey("DireccionUsuario")) { App.Current.Properties.Add("DireccionUsuario", App.DireccionUsuario); } else { DireccionUsuario = App.Current.Properties["DireccionUsuario"].ToString(); } if (DireccionUsuario != string.Empty) { MainPage = new NavigationPage(new MainPage()); } else { MainPage = new NavigationPage(new ConfiguracionInicial()); } MainPage.Appearing += MainPage_Appearing; ThreadStart tsNot = new ThreadStart(() => { try { OneSignal.Current.StartInit((string)(App.Current.Resources["OneSignalId"])).HandleNotificationReceived(async(result) => { if (result.payload.additionalData.Count > 0 && result.payload.additionalData.ContainsKey("noticia")) { try { await ApiRest.GetAsyncFormData <RootDetalle>((string)(App.Current.Resources["APIRoot"]) + "?id=" + result.payload.additionalData["noticia"]) .ContinueWith((task) => { try { App.notificacionNoticia = ((RootDetalle)task.Result); } catch { } }); } catch { } } }).InFocusDisplaying(Com.OneSignal.Abstractions.OSInFocusDisplayOption.Notification) .EndInit(); } catch { } }); Thread tNotificaciones = new Thread(tsNot); tNotificaciones.Start(); OneSignal.Current.IdsAvailable((id, token) => { PlayerId = id; System.Diagnostics.Debug.Write("One Signal Player ID: " + id); }); }