public FoodItemPresenter(IFoodItemView foodItemView, FoodTracker foodTracker) { FoodItemView = foodItemView; FoodTracker = foodTracker; FoodItemView.Categories = FoodTracker.GetAllFoodCategories(false); FoodItemView.LeaveCategoryField += new EventHandler(CheckExistingCategory); }
public FoodPresenter(IFoodView foodView, FoodTracker foodTracker) { FoodView = foodView; FoodTracker = foodTracker; FoodItemPresenter = new FoodItemPresenter(FoodView.FoodItemView, FoodTracker); FoodLookupPresenter = new FoodLookupPresenter(FoodView.FoodLookupView, FoodTracker); FoodSearchPresenter = new FoodSearchPresenter(FoodView.FoodSearchView, FoodTracker, FoodLookupPresenter); FoodView.AddFoodClick += new EventHandler(OnAddFoodButtonClick); FoodView.EditFoodClick += new EventHandler(OnEditFoodButtonClick); FoodView.DeleteFoodClick += new EventHandler(OnDeleteFoodButtonClick); FoodLookupPresenter.FoodSelectedChanged += new System.EventHandler(OnFoodListItemChanged); setFood(); InEditMode = false; if (FoodTracker.GetAllFoodCategories(true).Count == 0) { FoodView.AddFoodButtonEnabled = false; } }