当前位置:Gxlcms > asp.net > asp.net 临时数据保存实现代码

asp.net 临时数据保存实现代码

时间:2021-07-01 10:21:17 帮助过:35人阅读

如果你感觉有用的话拷
走的时候顺便顶一下!
代码如下:

public MainPage()
{
InitializeComponent();
}
PhoneApplicationService phoneAppService = PhoneApplicationService.Current;
protected override void OnNavigatedFrom(System.Windows.Navigation.NavigationEventArgs e)
{
phoneAppService.State["myValue"] = textBox1.Text;
base.OnNavigatedFrom(e);
}
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
{
object someObject;
if (phoneAppService.State.ContainsKey("myValue"))
{
if (phoneAppService.State.TryGetValue("myValue", out someObject))
{
textBox1.Text = someObject.ToString();
}
}
base.OnNavigatedTo(e);
}

作者:MasterMeng

人气教程排行