本文整理汇总了C#中PivotItem.setState方法的典型用法代码示例。如果您正苦于以下问题:C# PivotItem.setState方法的具体用法?C# PivotItem.setState怎么用?C# PivotItem.setState使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PivotItem
的用法示例。
在下文中一共展示了PivotItem.setState方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: NavigationHelper_LoadState
/// <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)
{
if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons"))
{
HardwareButtons.BackPressed += HardwareButtons_BackPressed;
}
string players = "";
if (e.PageState == null)
{
players = e.NavigationParameter.ToString();
}
else if (e.PageState.ContainsKey("Players"))
{
players = (string)e.PageState["Players"];
}
else
{
// we have screwed up smthing
}
List<string> selectedPlayers = new List<string>();
parseParametersToList(players, ref selectedPlayers);
// create pivot items (came pages) for each player
for (int i = 0; i < selectedPlayers.Count; ++i)
{
PivotItem pivotItem = new PivotItem();
JYLYPivotItem JYLYItem = new JYLYPivotItem();
JYLYItem.PlayerCompletedGame += JYLYItem_PlayerCompletedGame;
JYLYItem.PlayerUncompletedGame += JYLYItem_PlayerUncompletedGame;
pivotItem.Content = JYLYItem;
pivotItem.Header = selectedPlayers[i];
this.pivot.Items.Add(pivotItem);
}
// if there was a saved state, set counters to their values
if (e.PageState != null)
{
for (int i = 0; i < pivot.Items.Count; ++i)
{
//Debug.WriteLine("i: " + i);
PivotItem item = pivot.Items[i] as PivotItem;
JYLYPivotItem pivotItem = item.Content as JYLYPivotItem;
pivotItem.setState((string)e.PageState[i.ToString()]);
}
if (e.PageState.ContainsKey("SelectedIndex"))
{
pivot.SelectedIndex = (int)e.PageState["SelectedIndex"];
}
}
}
示例2: NavigationHelper_LoadState
/// <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)
{
if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons"))
{
HardwareButtons.BackPressed += HardwareButtons_BackPressed;
}
// set results to the viewmodel
//create pivot items based on the selected players
//parse selected players from navigation parameter string or local settings to a list
string players = "";
// first navigation to the page
if (e.PageState == null)
{
players = e.NavigationParameter.ToString();
}
// there is a saved state, resume
else if (e.PageState.ContainsKey("Players"))
{
players = (string)e.PageState["Players"];
}
List<string> selectedPlayers = new List<string>();
parseParametersToList(players, ref selectedPlayers);
// create pivot items (game pages) for each player
for (int i = 0; i < selectedPlayers.Count; ++i)
{
PivotItem pivotItem = new PivotItem();
AboPivotItem cxItem = new AboPivotItem();
pivotItem.Content = cxItem;
pivotItem.Header = selectedPlayers[i];
this.pivot.Items.Add(pivotItem);
}
// if there was a saved state, set counters to their values
if (e.PageState != null)
{
for (int i = 0; i < pivot.Items.Count; ++i)
{
PivotItem item = pivot.Items[i] as PivotItem;
AboPivotItem pivotItem = item.Content as AboPivotItem;
pivotItem.setState((string)e.PageState[i.ToString()]);
}
if (e.PageState.ContainsKey("SelectedIndex"))
{
pivot.SelectedIndex = (int)e.PageState["SelectedIndex"];
}
}
}