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
        private void resizeFood(object sender, SizeChangedEventArgs e)
        {
            menuList1.Margin = new Thickness(0, this.ActualHeight * 0.06, 0, 0);
            int i = 0;

            while (i < menuList1.Children.Count)
            {
                AltLabel header = menuList1.Children[i] as AltLabel;
                if (header != null)
                {
                    header.Padding         = new Thickness(this.ActualHeight * 0.01);
                    header.FontSize        = this.ActualHeight * 0.04;
                    header.Labelimg.Width  = this.ActualWidth * 0.20;
                    header.Labelimg.Height = this.ActualHeight * 0.20;
                }


                MenuFoodItem mf2 = menuList1.Children[i] as MenuFoodItem;
                if (mf2 != null)
                {
                    mf2.Description.FontSize = this.ActualHeight * 0.03;
                    mf2.Description.Padding  = new Thickness(this.ActualHeight * 0.01);
                    mf2.Image.Width          = this.ActualWidth * 0.12;
                }

                i++;
            }


            menuList2.Margin = new Thickness(this.ActualHeight * 0.05, this.ActualHeight * 0.06, 0, 0);
        }
Example #3
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);
             *  }
             * }*/
        }
Example #4
0
        private void Mf_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            MenuFoodItem item = sender as MenuFoodItem;

            if (item != null)
            {
                Console.WriteLine("Double clicked1");
                Frame          parent    = Parent as Frame;
                CustomizePizza customize = new CustomizePizza();
                customize.order = order;
                customize.pizza = item.menuItem;
                customize.nav   = nav;

                NavigationService.Navigate(customize);
                if (parent != null)
                {
                    Console.WriteLine("Double clicked2");
                    parent.Source = new Uri("CustomizePizza.xaml", UriKind.Relative);
                }

                //item.menuItem
            }
        }