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 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[]; }