/// <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) { try { StorageFile localFile = await ApplicationData.Current.LocalFolder.GetFileAsync("usersettings.xml"); string localData = await FileIO.ReadTextAsync(localFile); XmlDocument xmlDoc = new XmlDocument(); xmlDoc.LoadXml(localData); XmlNodeList nodeList = xmlDoc.SelectNodes("Categories/Bill"); foreach (IXmlNode node in nodeList) { string type = node.Attributes[0].NodeValue.ToString(); string title = node.Attributes[1].NodeValue.ToString(); string subtitle = node.Attributes[2].NodeValue.ToString(); string imagePath = node.Attributes[3].NodeValue.ToString(); string portalUrl = node.Attributes[4].NodeValue.ToString(); string dueDate = node.FirstChild.InnerText; string isPaid = node.LastChild.InnerText; Bill bill = new Bill(title, subtitle, imagePath, portalUrl, BillType.CreditCard, isPaid == "1", Convert.ToDateTime(dueDate)); this.Bill.Add(bill); } this.DataContext = this.Bill; } catch (FileNotFoundException) { this.Frame.Navigate(typeof(BillCategories)); } }
/// <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 void navigationHelper_LoadState(object sender, LoadStateEventArgs e) { // TODO: Assign a bindable collection of items to this.DefaultViewModel["Items"] }
/// <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 void navigationHelper_LoadState(object sender, LoadStateEventArgs e) { this.uri = new Uri(e.NavigationParameter.ToString()); }