void winclose() { List <Food> ds = new List <Food>(); String shopName = getname; ds = dgl.GetFoods(sNumber); this.gridList.ItemsSource = ds; //设置列表 this.IsEnabled = true; }
public Page2(String name, String storeNumber) { InitializeComponent(); //连接服务器,创建通讯类 dgl = TransDGL.GetInstance(); //从数据库获取数据 //循环进行列表的初始化操作 List <Food> ds = new List <Food>(); getname = name; sNumber = storeNumber; String shopName = getname; //Food[] foods = dgl.GetFoods(sNumber); ds = dgl.GetFoods(sNumber); /* * foreach (Food f in foods) * { * var d1 = new Food(); * d1.SetFoodNum(f.GetFoodNum()); * d1.SetName(f.GetName()); * d1.SetPrice(f.GetPrice()); * d1.SetId(f.GetId()); * d1.SetFoodClass(f.GetFoodClass()); * d1.SetFoodTip(f.GetFoodTip()); * d1.SetSt(f.GetSt()); * ds.Add(d1); * } */ this.gridList.ItemsSource = ds; //设置列表 }