// Clone Constructor public Category(Category c) { this.name = c.name; this.imagepath = c.imagepath; this.foods = c.foods; this.altimagepath = c.altimagepath; }
private bool HasPosts(Category cat) { foreach (Post post in Post.Posts) { if (post.IsVisible) { foreach (Category category in post.Categories) { if (category == cat) return true; } } } return false; }
private void UserControl_Loaded(object sender, RoutedEventArgs e) { trashBackground = new ImageBrush(); trashBackground.ImageSource = new BitmapImage(new Uri("Images/trashbackground.png", UriKind.Relative)); kinectSensorChooser1.KinectSensorChanged += new DependencyPropertyChangedEventHandler(kinectSensorChooser1_KinectSensorChanged); //test.Text = "CAKE"; SwipeTimer.Tick += new EventHandler(ResetSwipe); SwipeTimer.Interval = TimeSpan.FromSeconds(SwipeDelay); // Amounts Item one = new Item("1", "Images/number1.jpg", 1.0); Item two = new Item("2", "Images/number2.jpg", 2.0); Item three = new Item("3", "Images/number3.jpg", 3.0); ItemList allAmounts = new ItemList(new Item[] { one, two, three }); // Food Sizes Item burgerRegSize = new Item("Regular", null, 4.0); Item burgerJumboSize = new Item("Jumbo", null, 5.5); Item sandwichRegSize = new Item("Regular", null, 4.5); Item sandwichJumboSize = new Item("Jumbo", null, 6.0); Item friesSmallSize = new Item("Small", null, 1.5); Item friesMedSize = new Item("Medium", null, 2.5); Item friesLargeSize = new Item("Large", null, 3.0); Item sodaSmallSize = new Item("Small", null, 1.5); Item sodaMedSize = new Item("Medium", null, 2.0); Item sodaLargeSize = new Item("Large", null, 2.5); Item bobaSmallSize = new Item("Small", null, 2.0); Item bobaMedSize = new Item("Medium", null, 2.5); Item bobaLargeSize = new Item("Large", null, 3.0); // Food Options Item noneOption = new Item("None", null, 0.0); Item cheeseOption = new Item("Cheese", null, 1.0); Item picklesOption = new Item("Pickles", null, 0.0); Item onionsOption = new Item("Onions", null, 0.0); Item ranchOption = new Item("Ranch Dressing", null, 0.0); Item italianOption = new Item("Italian Dressing", null, 0.0); Item chiliCheeseOption = new Item("Chili Cheese", null, 1.5); Item cokeOption = new Item("Coke", null, 0.0); Item pepsiOption = new Item("Pepsi", null, 0.0); Item spriteOption = new Item("Sprite", null, 0.0); Item bobaOption = new Item("With Pearls", null, 0.0); // Foods // Meals ItemList burgerSizes = new ItemList(new Item[] { burgerRegSize, burgerJumboSize }); ItemList burgerOptions = new ItemList(new Item[] { noneOption, cheeseOption, picklesOption, onionsOption }); burger = new Food("Hamburger", "Images/hamburger.png", burgerSizes, allAmounts, burgerOptions); //base price needed? ItemList sandwichSizes = new ItemList(new Item[] { sandwichRegSize, sandwichJumboSize }); chicksandwich = new Food("Chicken Sandwich", "Images/chicken_sandwich.png", sandwichSizes, allAmounts, burgerOptions); ItemList saladOptions = new ItemList(new Item[] { noneOption, cheeseOption, italianOption, ranchOption }); bigsalad = new Food("Big Salad", "Images/big_salad.jpg", null, allAmounts, saladOptions, 5.0); // Sides ItemList friesSizes = new ItemList(new Item[] { friesSmallSize, friesMedSize, friesLargeSize }); ItemList friesOptions = new ItemList(new Item[] { noneOption, chiliCheeseOption }); fries = new Food("French Fries", "Images/french_fries.png", friesSizes, allAmounts, friesOptions); sidesalad = new Food("Side Salad", "Images/side_salad.png", null, allAmounts, saladOptions, 2.5); fruit = new Food("Fruit Salad", "Images/fruit_cup.png", null, allAmounts, null, 3.0); // Drinks ItemList sodaSizes = new ItemList(new Item[] { sodaSmallSize, sodaMedSize, sodaLargeSize }); ItemList sodaOptions = new ItemList(new Item[] { cokeOption, pepsiOption, spriteOption }); soda = new Food("Soft Drink", "Images/soda.png", sodaSizes, allAmounts, sodaOptions); ItemList bobaSizes = new ItemList(new Item[] { bobaSmallSize, bobaMedSize, bobaLargeSize }); ItemList bobaOptions = new ItemList(new Item[] { noneOption, bobaOption }); boba = new Food("Boba Tea", "Images/boba.png", bobaSizes, allAmounts, bobaOptions); water = new Food("Water", "Images/water.png", null, allAmounts, null); // Categories meals = new Category("Meals", "Images/meals.png", new ItemList(new Item[] {burger, chicksandwich, bigsalad})); sides = new Category("Sides", "Images/sides.png", new ItemList(new Item[] {fries, sidesalad, fruit})); drinks = new Category("Drinks", "Images/drinks.png", new ItemList(new Item[] {soda, boba, water})); // The top menu containing the food categories. menu = new ItemList(new Item[] { meals, sides, drinks }); // The list containing items in the order order = new ItemList(); // Set up the stackpanel rows catCol = new Image[] { cat1, cat2, cat3 }; amountCol = new Label[] {amount1, amount2, amount3}; itemCol = new Image[] {item1, item2, item3}; sizeCol = new Label[] {size1, size2, size3}; optionsCol = new Label[] {option1, option2, option3}; // Display logic editing = false; Category.Background = selectedBackground; menu.Display(catCol); // display categories in first row Category selectedCategory = (Category)menu.ReturnSingle(); selectedCategory.DisplayFoods(itemCol); // display selected category's food in item row hideOrderOptions(); }