/// <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) { customer = await CustomerDataSource.GetCustomerDetailsAsync(e.NavigationParameter.ToString()); this.DefaultViewModel["Customer"] = customer; this.DefaultViewModel["CustomerName"] = customer.CustomerName; this.DefaultViewModel["Products"] = await ProductDataSource.GetProductListByIDAsync(customer.ProductSummary.ToList()); }
/// <summary> /// This method is used to create dummy customers list. /// </summary> private async Task PrepareDummyData() { try { //If customer list is already loaded from XML file, skip reloading it again. if (_customerDataSource.AllCustomers != null) return; _allCustomers = new List<Customer>(); for (int i=0; i<7; i++) { Customer customer = new Customer() { CustomerId = i.ToString(), CustomerName = "Customer" + i.ToString(), AccountNumber = "Account" + i.ToString(), AnnualIncome = "100000", ClientSince = DateTime.Now.AddDays(-1*i).ToString(), CustomerAddress = "Address"+i.ToString(), ClientType = "Type" + i.ToString(), CustomerEmail = "Email" + i.ToString() + "@hotmail.com", CustomerImage = "Data/CustomerImages/placeholder.jpg", CustomerPhone = "111-111-1111", MaritalStatus = "Single", Occupation = "Employee", ProductSummary = new List<string> { "00-001", "00-002" } }; _allCustomers.Add(customer); } } catch { _allCustomers = null; } }