コード例 #1
0
        public FoodItemPresenter(IFoodItemView foodItemView, FoodTracker foodTracker)
        {
            FoodItemView = foodItemView;
            FoodTracker = foodTracker;

            FoodItemView.Categories = FoodTracker.GetAllFoodCategories(false);
            FoodItemView.LeaveCategoryField += new EventHandler(CheckExistingCategory);
        }
コード例 #2
0
        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;
            }
        }