public void addIngredient(Ingredient ingredient) { IngredientModifier ing = new IngredientModifier(); ing.ingredient = ingredient; ing.custom = this; Ingredients.Children.Insert(0, ing); if (Ingredients.Children.Count > 5) { double percHeight = (ActualHeight * 0.7) / Ingredients.Children.Count; for (int j = 0; j < Ingredients.Children.Count; j++) { IngredientModifier ingMod = (Ingredients.Children[j] as IngredientModifier); if (ingMod != null) { ingMod.resize(); ingMod.Height = percHeight; } else { Image img = (Ingredients.Children[j] as Image); if (img != null) { img.Height = percHeight; } } } } // TODO - figure out how to append //pizza.ingredients = pizza.ingredients.Union(new Ingredient[] { ingredient }) as Ingredient[]; }
public void removeIng(IngredientModifier ing) { // TODO - figure out how to remove //pizza.ingredients = pizza.ingredients.Except(new Ingredient[] { ing.ingredient }) as Ingredient[]; Ingredients.Children.Remove(ing); int newLen = _pizza.ingredients.Length - 1; Ingredient[] copyList = new Ingredient[newLen]; Ingredient ingredient = ing.ingredient; bool found = false; for (int j = 0; j < _pizza.ingredients.Length; j++) { Ingredient inJ = _pizza.ingredients[j]; if (inJ.cost == ingredient.cost && inJ.mod == ingredient.mod && inJ.name == ingredient.name && !found) { found = true; } else { copyList[j] = inJ; } } _pizza.ingredients = copyList; }
public void addIngredients(Ingredient[] ings) { for (int j = 0; j < ings.Length; j++) { IngredientModifier ing = new IngredientModifier(); ing.ingredient = ings[j]; ing.custom = this; Ingredients.Children.Insert(0, ing); } }
public void addIngredient(Ingredient ingredient) { IngredientModifier ing = new IngredientModifier(); ing.ingredient = ingredient; ing.custom = this; Ingredients.Children.Insert(0, ing); if (_pizza != null) { int newLen = _pizza.ingredients.Length + 1; Ingredient[] copyList = new Ingredient[newLen]; bool found = false; for (int j = 0; j < _pizza.ingredients.Length; j++) { Ingredient inJ = _pizza.ingredients[j]; copyList[j] = inJ; } copyList[newLen - 1] = ingredient; _pizza.ingredients = copyList; //_pizza.ingredients = _pizza.ingredients.Union(new Ingredient[] { ingredient }) as Ingredient[]; } if (Ingredients.Children.Count > 5) { double percHeight = (ActualHeight * 0.7) / Ingredients.Children.Count; for (int j = 0; j < Ingredients.Children.Count; j++) { IngredientModifier ingMod = (Ingredients.Children[j] as IngredientModifier); if (ingMod != null) { ingMod.resize(); ingMod.Height = percHeight; } else { Image img = (Ingredients.Children[j] as Image); if (img != null) { img.Height = percHeight; } } } } // TODO - figure out how to append //pizza.ingredients = pizza.ingredients.Union(new Ingredient[] { ingredient }) as Ingredient[]; }
public void removeIng(IngredientModifier ing) { // TODO - figure out how to remove //pizza.ingredients = pizza.ingredients.Except(new Ingredient[] { ing.ingredient }) as Ingredient[]; Ingredients.Children.Remove(ing); }