首页 > 编程 > .NET > 正文

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

2024-07-10 12:41:31
字体:
来源:转载
供稿:网友
如果你感觉有用的话拷
走的时候顺便顶一下!
代码如下:
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
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表