예제 #1
0
 private void MainWindow_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (MasterContext != null)
     {
         MasterContext.Dispose();
         MasterContext = null;
     }
     Application.Exit();
 }
예제 #2
0
 public Plan(IMealPlannerContext db)
 {
     InitializeComponent();
     this.db = db;
     FillMealList();
     dataGridView1.DataSource = dataTable;
     dataGridView1.Sort(dataGridView1.Columns[0], ListSortDirection.Ascending);
     dataGridView1.Columns[0].Width = 175;
 }
예제 #3
0
 private void MainWindow_VisibleChanged(object sender, EventArgs e)
 {
     if (Visible == true)
     {
         if (MasterContext != null)
         {
             MasterContext.Dispose();
             MasterContext = null;
         }
     }
 }
예제 #4
0
        private void Ingredients_Click(object sender, EventArgs e)
        {
            if (MasterContext == null)
            {
                MasterContext = GetMasterContext();
            }
            ManagerWindow mw = ManagerWindow.GetIngredientManager(MasterContext);

            mw.MyParent = this;
            mw.Show();
            Hide();
        }
예제 #5
0
        //public char Type() { return 'I'; }

        public void DeleteFrom(IMealPlannerContext db)
        {
            if (Meals.Count > 0)
            {
                if (Dialogs.ConfirmDelete == DialogResult.No)
                {
                    return;
                }
                ;
            }
            db.Delete(this);
        }
예제 #6
0
        public static ManagerWindow GetIngredientManager(IMealPlannerContext db)
        {
            ManagerWindow mw = new ManagerWindow()
            {
                Text = "Ingredient Manager",
                db   = db,
                ListBoxDataSource = db.GetIngredients()
            };

            mw.AddClickMethod = mw.AddIngredientDelegate;
            return(mw);
        }
예제 #7
0
        private void PlanButton_Click(object sender, EventArgs e)
        {
            if (MasterContext == null)
            {
                MasterContext = GetMasterContext();
            }
            Form p = new Plan(MasterContext)
            {
                MyParent = this
            };

            p.Show();
            Hide();
        }
예제 #8
0
 public AddMeal(IMealPlannerContext db)
 {
     InitializeComponent();
     DbContext = db;
     cboCookTime.DataSource = Meal.CookingTime.GetCookTimes();
 }
예제 #9
0
 public void DeleteFrom(IMealPlannerContext db)
 {
     db.Delete(this);
 }
예제 #10
0
 public AddIngredient(IMealPlannerContext db)
 {
     DbContext = db;
     InitializeComponent();
 }