FoodKey addNewFoodKey(Keys key, string ingredient, Point location) { FoodKey keyToCreate; keyToCreate = new FoodKey(); keyToCreate.Init(key, ingredient); keyToCreate.Location = location; return(keyToCreate); }
private void CookingForm_Load(object sender, EventArgs e) { FoodKey randomKey = addNewFoodKey(Keys.None, "random", new Point(0, 0)); int x = ClientSize.Width - randomKey.Width; int y = 0; for (int i = 0; i < possibleIngredients.Count; i++) { Keys keyIndex = (Keys)Enum.Parse(typeof(Keys), possibleIngredients[i].IngredientKey); FoodKey newFoodKey = addNewFoodKey(keyIndex, possibleIngredients[i].IngredientName, new Point(x, y)); Controls.Add(newFoodKey); foodKeys.Add(newFoodKey); y += newFoodKey.Height; } CustomerLabel.Text = test.GetOrder(); }