windowsphone 7,帮助返回按钮和页面,保存变量

本文关键字:保存 变量 按钮 帮助 返回 windowsphone | 更新日期: 2023-09-27 18:01:13

我的手机应用程序又遇到了一个问题。

我的问题如下:

在一个页面上,我有一个图片列表和一个标记为"收藏夹"的按钮。如果你想喜欢这行的特定图像,图像的边框会改变颜色来表示这一点。

然而,每当我对应用程序进行逻辑删除或点击后退按钮并返回到同一页面时,图像的边框都会恢复到默认颜色。

在你问之前,我不知道这是否是一个孤立的记忆问题。我刚刚开始研究隔离存储,目前我很难理解。

也许这是一个储蓄州的问题?

无论哪种方式,我都希望我的应用程序记住,每当用户退出应用程序、删除应用程序或点击后退按钮时,收藏夹是什么。

有人能提供一段代码来帮助解决这个问题吗?

windowsphone 7,帮助返回按钮和页面,保存变量

您需要保存数据,因为系统基本上正在扼杀您的应用程序。因此,您需要在app.xaml.cs中编写代码以保存和读取metods:中的数据

    // Code to execute when the application is launching (eg, from Start)
    // This code will not execute when the application is reactivated
    private void Application_Launching(object sender, LaunchingEventArgs e)
    {
    }
    // Code to execute when the application is activated (brought to foreground)
    // This code will not execute when the application is first launched
    private void Application_Activated(object sender, ActivatedEventArgs e)
    {
    }
    // Code to execute when the application is deactivated (sent to background)
    // This code will not execute when the application is closing
    private void Application_Deactivated(object sender, DeactivatedEventArgs e)
    {
    }
    // Code to execute when the application is closing (eg, user hit Back)
    // This code will not execute when the application is deactivated
    private void Application_Closing(object sender, ClosingEventArgs e)
    {
    }