读书人

wp7 guideline for android developer

发布时间: 2012-02-22 19:36:56 作者: rapoo

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的类,了解?

读书人网 >Windows Mobile

热点推荐