예제 #1
0
        public FoodList()
        {
            isSelected         = false;
            selectedFoodId     = "null";
            lastSelectedFoodId = "null";

            CurrentFoodClass = new FoodClass("null");
            FoodClassCount   = 0;
            foodsMenu        = new BindingList <Food>();
            //foodMenu = new FoodMenu();
            currentMenuSelectedIndex = -1;
            currentPage   = 0;
            order         = new Dictionary <string, BindingList <Food> >();
            foodClassPage = new Dictionary <int, BindingList <FoodClass> >();
            //获取菜品
            Test_GetFoodOrder();
        }
예제 #2
0
 //绑定菜品类
 public BindingList <Food> FoodBindByClass(FoodClass foodClass)
 {
     if (FoodClassCount != 0)
     {
         if (!HasFoodClass(foodClass.FClass))
         {
             foodClass = foodClassPage[currentPage][0];
         }
         CurrentFoodClass = foodClass;
         selectedFoodId   = "null";
         isSelected       = false;
         return(GetFoodListByClass(foodClass.FClass));
     }
     else
     {
         return(null);
     }
 }
예제 #3
0
        //设置选中菜品类的效果
        private void SetSelectedFoodClass()
        {
            var items = this.FoodClassDiv.ItemContainerGenerator.Items;

            if (items != null)
            {
                for (int i = 0; i < items.Count; i++)
                {
                    ListBoxItem boxItem = this.FoodClassDiv.ItemContainerGenerator.ContainerFromIndex(i) as ListBoxItem;
                    Button      b       = TreeHelpUtils.FindVisualTree <Button>(boxItem);
                    if (b == null)
                    {
                        break;
                    }
                    //全消除
                    b.Background = new SolidColorBrush(Color.FromArgb(255, 221, 221, 221));
                    FoodClass f = (FoodClass)items[i];
                    if (f == foodList.CurrentFoodClass)
                    {
                        b.Background = Brushes.Orange;
                    }
                }
            }
        }