private void ListView_ItemClick(object sender, ItemClickEventArgs e) { // The clicked item it is the new selected product _selectedProduct = e.ClickedItem as Product; this.Frame.Navigate( typeof(ProductDetail), _selectedProduct, new DrillInNavigationTransitionInfo()); }
protected override void OnNavigatedTo(NavigationEventArgs e) { //if (e.Parameter is string) { // this.Message = String.Format("Clicked on {0}", e.Parameter); //} else { // this.Message = "Hi!"; //} base.OnNavigatedTo(e); SelectedProduct = e.Parameter as Product; // Register for hardware and software back request from the system SystemNavigationManager systemNavigationManager = SystemNavigationManager.GetForCurrentView(); systemNavigationManager.BackRequested += OnBackRequested; systemNavigationManager.AppViewBackButtonVisibility = AppViewBackButtonVisibility.Visible; }
private async Task GetResponseFromService(ServiceType serviceType, string endpoint) { try { Uri _uri = new Uri(endpoint); HttpClient _httpClient = new HttpClient(); HttpResponseMessage _responseMessage = await _httpClient.GetAsync(_uri); string content = await _responseMessage.Content.ReadAsStringAsync(); Response _response = JsonConvert.DeserializeObject<Response>(content); if (_response.Status == Status.OK) { foreach (dynamic result in _response.Result) { switch (serviceType) { case ServiceType.Store: Store store = new Store(result); this._stores.Add(store); break; case ServiceType.Product: Product product = new Product(result); this._products.Add(product); break; case ServiceType.Inventory: Inventory inventory = new Inventory(result); this._inventories.Add(inventory); break; } } } } catch (JsonSerializationException ex) { throw new JsonSerializationException(ex.Message, ex.InnerException); } catch (JsonException ex) { throw new JsonException(ex.Message, ex.InnerException); } catch (TaskCanceledException ex) { throw new TaskCanceledException(ex.Message, ex.InnerException); } catch (Exception ex) { throw new Exception(ex.Message, ex.InnerException); } }