private static Func <bool> AddIngredientDelegate() { return(delegate() { Wrapper <bool> Bool = new Wrapper <bool>(false); using (AddIngredient addDialog = new AddIngredient(GetMasterContext()) { ReturnedBool = Bool }) { addDialog.Show(); } return Bool; }); }
private void AddIngredientButton_Click(object sender, EventArgs e) { Wrapper <bool> Bool = new Wrapper <bool>(false); Ingredient ingredient = Ingredient.NULL; ingredient.Name = textBox1.Text; using (AddIngredient addDialog = new AddIngredient(DbContext) { ReturnedBool = Bool, StarterIngredient = ingredient }) { addDialog.ShowDialog(); } if (Bool) { lstUsed.Items.Add(ingredient); textBox1.Text = ""; } }