Example #1
0
 public override void LoadData()
 {
     mealService.LoadAll();
     MenuViewModel.LoadData();
     ShoppingViewModel.LoadData();
     RecipiesViewModel.LoadData();
     FoodStoreViewModel.LoadData();
 }
Example #2
0
        public MainViewModel()
        {
            mealService = new MealService();

            MenuViewModel      = new MenuViewModel(mealService);
            ShoppingViewModel  = new ShoppingViewModel(mealService);
            RecipiesViewModel  = new RecipiesViewModel(mealService);
            FoodStoreViewModel = new FoodStoreViewModel(mealService.Context);

            LoadData();
        }
Example #3
0
        public override void OnProgramShutdownStarted(object sender, EventArgs e)
        {
            MenuViewModel.SaveData();
            ShoppingViewModel.SaveData();
            RecipiesViewModel.SaveData();
            FoodStoreViewModel.SaveData();
            mealService.Save();

            MenuViewModel.Dispose();
            ShoppingViewModel.Dispose();
            RecipiesViewModel.Dispose();
            FoodStoreViewModel.Dispose();
            mealService.Dispose();
        }