public async void loadProductData() { ServerQuery q = new ServerQuery (); ServerResponse rep = null; try { Dictionary<String, String> urlParams = new Dictionary<String, String>(); urlParams.Add ("category_uid",categoryUid); rep = await q.Get (ServerQuery.SERVER_URL + "/product/list/", urlParams, AuthType.USER); } catch(WebException e) { Console.WriteLine (e.ToString ()); await DisplayAlert ("Erreur", "Impossible de joindre le serveur, veuillez vérifier votre connexion.", "OK"); } catch(UserAuthFailedException e) { Console.WriteLine (e.ToString ()); await DisplayAlert ("Erreur", "Vous n'êtes pas connecté ! Veuillez vous authentifier.", "OK"); App context = ((App)App.Current); context.MainPage = new NavigationPage(new LoginPage()); } if (rep != null) { Device.BeginInvokeOnMainThread( ()=> { list.ItemsSource = null; list.ItemsSource = Product.DeserializeArray (rep.content["result"]); }); } list.EndRefresh(); }
public async void loadStoreData() { ServerQuery q = new ServerQuery (); ServerResponse rep = null; try { rep = await q.Get (ServerQuery.SERVER_URL + "/store/list", null, AuthType.APP); } catch(WebException e) { Console.WriteLine (e.ToString ()); await DisplayAlert ("Erreur", "Impossible de joindre le serveur, veuillez vérifier votre connexion.", "OK"); } if (rep != null) { Device.BeginInvokeOnMainThread( ()=> { list.ItemsSource = null; list.ItemsSource = Store.DeserializeArray (rep.content["result"]); }); } list.EndRefresh(); }
public async void checkUserSession() { ServerQuery q = new ServerQuery (); ServerResponse rep = null; try { Dictionary<String, String> urlParams = new Dictionary<String, String>(); urlParams.Add("search", "test"); rep = await q.Get (ServerQuery.SERVER_URL + "/product/list", urlParams, AuthType.USER); if(rep != null) { App context = ((App)App.Current); context.MainPage = new RootPage(); } } catch(WebException e) { Console.WriteLine (e.ToString()); await DisplayAlert ("Erreur", "Impossible de joindre le serveur, veuillez vérifier votre connexion.", "OK"); } catch(UserAuthFailedException e) { Console.WriteLine (e.ToString ()); } }
public async void loadCategoryData() { ServerQuery q = new ServerQuery (); ServerResponse rep = null; try { Dictionary<String, String> urlParams = new Dictionary<String, String>(); urlParams.Add ("store_uid",storeUid); rep = await q.Get (ServerQuery.SERVER_URL + "/category/list/", urlParams, AuthType.APP); } catch(WebException e) { Console.WriteLine (e.ToString ()); await DisplayAlert ("Erreur", "Impossible de joindre le serveur, veuillez vérifier votre connexion.", "OK"); } if (rep != null) { Device.BeginInvokeOnMainThread( ()=> { list.ItemsSource = null; list.ItemsSource = Category.DeserializeArray (rep.content["result"]); }); } list.EndRefresh(); }