コード例 #1
0
        private void OnSelect(string dishName, IDishViewController dishViewController, IIngredientSubject ingredientSubject)
        {
            using (IDishController controller = factory.CreateDishController())
            {
                DataControllerMessage <DishEditDTO> controllerMessage = controller.Get(dishName);
                if (controllerMessage.IsSuccess)
                {
                    UIElement view   = dishViewController.GetEditView(ingredientSubject, controllerMessage.Data);
                    Window    window = WindowFactory.CreateByContentsSize(view);

                    window.Title = String.Format("{0} - {1}", dishName, controllerMessage.Data.CategoryName);

                    dishViewController.DishDeleted += (s, e) =>
                    {
                        if (dishName == e.Data)
                        {
                            window.Close();
                        }
                    };

                    window.Show();
                }
                else
                {
                    MessageBox.Show(controllerMessage.Message);
                }
            }
        }
コード例 #2
0
        public AddControlPanel(ICategoryViewController categoryViewController, IDishViewController dishViewController)
        {
            InitializeComponent();
            this.categoryViewController = categoryViewController;
            this.dishViewController     = dishViewController;

            DisplayCategory();
        }
コード例 #3
0
        public UIElement GetMenuView(IDishViewController dishViewController, IIngredientSubject ingredientSubject)
        {
            MenuViewModel viewModel = new MenuViewModel(factory, this);
            MenuView      view      = new MenuView(viewModel);

            viewModel.MenuChanged  += (s, e) => OnMenuUpdate(e.Data, viewModel);
            viewModel.DishSelected += (s, e) => OnSelect(e.Data, dishViewController, ingredientSubject);

            return(view);
        }
コード例 #4
0
        public MenuWindow(IViewControllerFactory factory)
        {
            InitializeComponent();

            this.categoryViewController   = factory.CreateCategoryViewController();
            this.dishViewController       = factory.CreateDishViewController();
            this.ingredientViewController = factory.CreateIngredientViewController();
            this.menuViewController       = factory.CreateMenuViewController();
            this.recipeViewController     = factory.CreateRecipeViewController();
            this.stockViewController      = factory.CreateStockViewController();

            categoryViewController.Subscribe(this);
            dishViewController.Subscribe(this);

            DisplayMenu();
        }