Example #1
0
        public Food()
        {
            InitializeComponent();
            menu = JsonConvert.DeserializeObject <MenuList>(jsonArray);

            for (int i = 0; i < menu.Menu.Length; i++)
            {
                AltLabel header = new AltLabel();
                header.Title.Content = menu.Menu[i].Name;
                header.imgRef        = menu.Menu[i].img;
                Color color = (Color)ColorConverter.ConvertFromString("#FFEFEDCC");
                header.Foreground      = new System.Windows.Media.SolidColorBrush(color);
                header.Labelimg.Source = header.getImage();


                menuList1.Children.Add(header);

                MenuItem[] category = menu.Menu[i].MenuItems;
                for (int j = 0; j < category.Length; j++)
                {
                    MenuFoodItem mf = new MenuFoodItem();

                    mf.menuItem = category[j];
                    if (menu.Menu[i].Name == "Pizza")
                    {
                        mf.MouseDoubleClick += Mf_MouseDoubleClick;
                    }
                    mf.MouseRightButtonDown += Mf_MouseDown;
                    //mf.MouseDown += Mf_MouseDown;
                    menuList1.Children.Add(mf);
                }
            }
        }
Example #2
0
        public Drink()
        {
            InitializeComponent();
            menu = JsonConvert.DeserializeObject <MenuList>(jsonArray);

            for (int i = 0; i < menu.Menu.Length; i++)
            {
                AltLabel header = new AltLabel();
                header.Title.Content = menu.Menu[i].Name;
                Color color = (Color)ColorConverter.ConvertFromString("#FFEFEDCC");
                header.Foreground      = new System.Windows.Media.SolidColorBrush(color);
                header.imgRef          = menu.Menu[i].img;
                header.Labelimg.Source = header.getImage();

                menuList1.Children.Add(header);

                MenuItem[] category = menu.Menu[i].MenuItems;
                for (int j = 0; j < category.Length; j++)
                {
                    MenuFoodItem mf = new MenuFoodItem();
                    category[j].type        = "Drink";
                    mf.menuItem             = category[j];
                    mf.MouseLeftButtonDown += Mf_MouseDown;
                    mf.MouseUp             += Mf_MouseDown;
                    mf.TouchDown           += Mf_TouchDown;
                    menuList1.Children.Add(mf);
                }
            }

            /*for (int i = menu.Menu.Length - 4; i < menu.Menu.Length; i++)
             * {
             *  Label header = new Label();
             *  header.Content = menu.Menu[i].Name;
             *  menuList2.Children.Add(header);
             *  Color color = (Color)ColorConverter.ConvertFromString("#FFEFEDCC");
             *  header.Foreground = new System.Windows.Media.SolidColorBrush(color);
             *
             *  MenuItem[] category = menu.Menu[i].MenuItems;
             *  for (int j = 0; j < category.Length; j++)
             *  {
             *      MenuFoodItem mf = new MenuFoodItem();
             *      mf.menuItem = category[j];
             *      menuList2.Children.Add(mf);
             *  }
             * }*/
        }