Ejemplo n.º 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);
                }
            }
        }
Ejemplo n.º 2
0
 private void OnSelected(DishDisplayDTO dishDisplayDTO, IIngredientSubject subject)
 {
     using (IDishController controller = factory.CreateDishController())
     {
         DataControllerMessage <DishEditDTO> controllerMessage = controller.Get(dishDisplayDTO.Name);
         if (controllerMessage.IsSuccess)
         {
             Edit(controllerMessage.Data, subject);
         }
         else
         {
             MessageBox.Show(controllerMessage.Message);
         }
     }
 }