本文整理汇总了C#中System.PageInfo.GetArguments方法的典型用法代码示例。如果您正苦于以下问题:C# PageInfo.GetArguments方法的具体用法?C# PageInfo.GetArguments怎么用?C# PageInfo.GetArguments使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.PageInfo
的用法示例。
在下文中一共展示了PageInfo.GetArguments方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Activate
/// <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;
}
示例2: Constructor_SetsArguments_Struct
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);
}
示例3: Activate
/// <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;
}
示例4: Activate
public void Activate(PageInfo pageInfo)
{
this.Message = String.Format("Clicked on {0}", pageInfo.GetArguments<string>());
}
示例5: Constructor_SetsArguments_NullReturnsDefaultInt
public void Constructor_SetsArguments_NullReturnsDefaultInt()
{
PageInfo navigationEntry = new PageInfo("Page Name", null);
Assert.Equal(0, navigationEntry.GetArguments<int>());
}
示例6: Constructor_SetsArguments_NullClass
public void Constructor_SetsArguments_NullClass()
{
PageInfo navigationEntry = new PageInfo("Page Name", (ClassState)null);
Assert.Equal(null, navigationEntry.GetArguments<ClassState>());
}
示例7: Constructor_SetsArguments_Int
public void Constructor_SetsArguments_Int()
{
PageInfo navigationEntry = new PageInfo("Page Name", 42);
Assert.Equal(42, navigationEntry.GetArguments<int>());
}
示例8: Constructor_SetsArguments_NullString
public void Constructor_SetsArguments_NullString()
{
PageInfo navigationEntry = new PageInfo("Page Name", (string)null);
Assert.Equal(null, navigationEntry.GetArguments<string>());
}
示例9: Constructor_SetsArguments_String
public void Constructor_SetsArguments_String()
{
PageInfo navigationEntry = new PageInfo("Page Name", "Arguments");
Assert.Equal("Arguments", navigationEntry.GetArguments<string>());
}
示例10: Activate
/// <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;
}