/// <summary> /// Populates the page with content passed during navigation. Any saved state is also /// provided when recreating a page from a prior session. /// </summary> /// <param name="sender"> /// The source of the event; typically <see cref="NavigationHelper"/>. /// </param> /// <param name="e">Event data that provides both the navigation parameter passed to /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested and /// a dictionary of state preserved by this page during an earlier /// session. The state will be null the first time a page is visited.</param> private async void NavigationHelper_LoadState(object sender, LoadStateEventArgs e) { // TODO: Create an appropriate data model for your problem domain to replace the sample data //var item = await SampleDataSource.GetItemAsync((string)e.NavigationParameter); var item = await ProductoSource.GetItemAsync((long)e.NavigationParameter); idProducto = (long)e.NavigationParameter; idUsuario = item.IDOfertante; this.DefaultViewModel["Item"] = item; SubastaPrecio.Text = String.Format("{0:C}", item.PrecioActual); }
private void deserializeJsonAsync(string json) { //Toma el json, obtiene los datos de los productos y los guarda en memoria. using (Stream s = GenerateStreamFromString(json)) { string content = String.Empty; List <ProductoItem> myCars; var jsonSerializer = new DataContractJsonSerializer(typeof(List <ProductoItem>)); myCars = (List <ProductoItem>)jsonSerializer.ReadObject(s); foreach (var car in myCars) { content += String.Format("ID: {0}, Make: {1}, Model: {2} ... ", car.ProductoID, car.Nombre, car.Descripcion); ProductoSource.AddItem(car); } Debug.WriteLine(content); this.DefaultViewModel["Productos"] = myCars; } }