private void MainWindow_FormClosing(object sender, FormClosingEventArgs e) { if (MasterContext != null) { MasterContext.Dispose(); MasterContext = null; } Application.Exit(); }
public Plan(IMealPlannerContext db) { InitializeComponent(); this.db = db; FillMealList(); dataGridView1.DataSource = dataTable; dataGridView1.Sort(dataGridView1.Columns[0], ListSortDirection.Ascending); dataGridView1.Columns[0].Width = 175; }
private void MainWindow_VisibleChanged(object sender, EventArgs e) { if (Visible == true) { if (MasterContext != null) { MasterContext.Dispose(); MasterContext = null; } } }
private void Ingredients_Click(object sender, EventArgs e) { if (MasterContext == null) { MasterContext = GetMasterContext(); } ManagerWindow mw = ManagerWindow.GetIngredientManager(MasterContext); mw.MyParent = this; mw.Show(); Hide(); }
//public char Type() { return 'I'; } public void DeleteFrom(IMealPlannerContext db) { if (Meals.Count > 0) { if (Dialogs.ConfirmDelete == DialogResult.No) { return; } ; } db.Delete(this); }
public static ManagerWindow GetIngredientManager(IMealPlannerContext db) { ManagerWindow mw = new ManagerWindow() { Text = "Ingredient Manager", db = db, ListBoxDataSource = db.GetIngredients() }; mw.AddClickMethod = mw.AddIngredientDelegate; return(mw); }
private void PlanButton_Click(object sender, EventArgs e) { if (MasterContext == null) { MasterContext = GetMasterContext(); } Form p = new Plan(MasterContext) { MyParent = this }; p.Show(); Hide(); }
public AddMeal(IMealPlannerContext db) { InitializeComponent(); DbContext = db; cboCookTime.DataSource = Meal.CookingTime.GetCookTimes(); }
public void DeleteFrom(IMealPlannerContext db) { db.Delete(this); }
public AddIngredient(IMealPlannerContext db) { DbContext = db; InitializeComponent(); }