public override void LoadData() { mealService.LoadAll(); MenuViewModel.LoadData(); ShoppingViewModel.LoadData(); RecipiesViewModel.LoadData(); FoodStoreViewModel.LoadData(); }
public MainViewModel() { mealService = new MealService(); MenuViewModel = new MenuViewModel(mealService); ShoppingViewModel = new ShoppingViewModel(mealService); RecipiesViewModel = new RecipiesViewModel(mealService); FoodStoreViewModel = new FoodStoreViewModel(mealService.Context); LoadData(); }
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(); }