/// <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="pageInfo">Information on the arguments and state passed to the page.</param> public async void Activate(PageInfo pageInfo) { // TODO: Create an appropriate data model for your problem domain to replace the sample data string itemId = pageInfo.GetArguments<string>(); var item = await SampleDataSource.GetItemAsync(itemId); this.Item = item; }
public void Constructor_SetsArguments_Struct() { PageInfo navigationEntry = new PageInfo("Page Name", new StructState() { Text = "Text Value", Number = 42 }); var args = navigationEntry.GetArguments<StructState>(); Assert.Equal("Text Value", args.Text); Assert.Equal(42, args.Number); }
/// <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="pageInfo">Information on the arguments and state passed to the page.</param> public async void Activate(PageInfo pageInfo) { // TODO: Create an appropriate data model for your problem domain to replace the sample data string groupId = pageInfo.GetArguments<string>(); var group = await SampleDataSource.GetGroupAsync(groupId); this.Group = group; this.Items = group.Items; }
public void Activate(PageInfo pageInfo) { this.Message = String.Format("Clicked on {0}", pageInfo.GetArguments<string>()); }
public void Constructor_SetsArguments_NullReturnsDefaultInt() { PageInfo navigationEntry = new PageInfo("Page Name", null); Assert.Equal(0, navigationEntry.GetArguments<int>()); }
public void Constructor_SetsArguments_NullClass() { PageInfo navigationEntry = new PageInfo("Page Name", (ClassState)null); Assert.Equal(null, navigationEntry.GetArguments<ClassState>()); }
public void Constructor_SetsArguments_Int() { PageInfo navigationEntry = new PageInfo("Page Name", 42); Assert.Equal(42, navigationEntry.GetArguments<int>()); }
public void Constructor_SetsArguments_NullString() { PageInfo navigationEntry = new PageInfo("Page Name", (string)null); Assert.Equal(null, navigationEntry.GetArguments<string>()); }
public void Constructor_SetsArguments_String() { PageInfo navigationEntry = new PageInfo("Page Name", "Arguments"); Assert.Equal("Arguments", navigationEntry.GetArguments<string>()); }
/// <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="pageInfo">Information on the arguments and state passed to the page.</param> public async void Activate(PageInfo pageInfo) { // TODO: Create an appropriate data model for your problem domain to replace the sample data string groupId = pageInfo.GetArguments<string>(); var group = await SampleDataSource.GetGroupAsync(groupId); this.Group = group; this.Items = group.Items; // Restore the selected item string selectedItemId; if (pageInfo.TryGetState<string>("SelectedItem", out selectedItemId)) SelectedItem = await SampleDataSource.GetItemAsync(selectedItemId); else SelectedItem = null; }