首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > Windows Mobile >

wp7 guideline for android developer中一个小疑点

2012-02-22 
wp7 guideline for android developer中一个小问题C# codeprotected override void OnBackKeyPress(System

wp7 guideline for android developer中一个小问题

C# code
protected override void OnBackKeyPress(System.ComponentModel.CancelEventArgs e)        {            base.OnBackKeyPress(e);            Utils.trace("Back key press");            txtItem.Text = "";            Utils.saveShoppingList((App.Current.RootVisual as PhoneApplicationFrame).DataContext as ShoppingListInfo, "ShoppingListInfo.dat");                   }下面是ShoppingListInfo类的定义:public class ShoppingListInfo    {        public ShoppingListInfo(string item, string list) {            this.txtItem = item;            this.txtList = list;        }        public ShoppingListInfo() {         }        public string txtItem;        public string txtList;    }请问下,为什么我该如何定义ShoppingListInfo,才能保存界面信息呢

代码就是这样的,但是我发现在Application_Launching事件中得到的ShoppingListInfo的两个对象都是Null
不知道该如何保存信息,就是说我按back键退回到start界面,然后重新返回到程序得到的界面任然是按back键之前的界面,谢谢各位大侠了啊

[解决办法]
一般类不要用PUBLIC来修饰,我觉得你这个需求应该直接用PUBLIC STATIC的变量来实现全局共享。而不是一个PUBLIC的类,了解?

热点排行