Exemple #1
0
        public void GenerateButtons()
        {
            /*
             * This function generates buttons in the front end
             */

            food_grid.Children.Clear();
            int index = 0;

            for (int row = 0; row < 4; row += 2)
            {
                for (int column = 0; column < 3; column++)
                {
                    //Make new Button
                    ImageButton button = new FoodItem(foodShop.ElementAt(index).Name, foodShop.ElementAt(index).Type, foodShop.ElementAt(index).Cost);

                    button.Clicked += ButtonClicked;
                    button.Aspect   = Aspect.AspectFit;
                    Grid.SetRow(button, row);       //Sets the ROW
                    Grid.SetColumn(button, column); //Sets the COLUMN
                    food_grid.Children.Add(button);


                    //Make new Label for said button
                    Label label = new Label
                    {
                        HorizontalTextAlignment = TextAlignment.Center,
                        Text = "" + foodShop.ElementAt(index).Name + "\n[$" + foodShop.ElementAt(index).Cost + "]" //Text
                    };
                    Grid.SetRow(label, row + 1);                                                                   //Sets the ROW
                    Grid.SetColumn(label, column);                                                                 //Sets the COLUMN
                    food_grid.Children.Add(label);

                    index++;
                }
            }
        }
Exemple #2
0
 public void ClearCurrent()
 {
     current = null;
 }