Esempio n. 1
0
 public EditReactionBuilderPresenter(IEditReactionBuilderView view, IEditFormulaPresenter editFormulaPresenter,
                                     ISelectReferenceAtReactionPresenter selectReferencesPresenter, IReactionBuilderToReactionBuilderDTOMapper reactionBuilderToReactionBuilderDTOMapper,
                                     IViewItemContextMenuFactory viewItemContextMenuFactory, IEditTaskFor <IReactionBuilder> editTasks,
                                     IFormulaToFormulaBuilderDTOMapper formulaBuilderMapper, IEditParametersInContainerPresenter editReactionParametersPresenter, IMoBiContext context,
                                     IDescriptorConditionListPresenter <IReactionBuilder> containerCriteriaPresenter, IReactionEductsPresenter reactionEductPresenter, IReactionProductsPresenter reactionProductPresenter,
                                     IReactionModifiersPresenter reactionModifiersPresenter)
     : base(view, editFormulaPresenter, selectReferencesPresenter)
 {
     _reactionBuilderToReactionBuilderDTOMapper = reactionBuilderToReactionBuilderDTOMapper;
     _context = context;
     _containerCriteriaPresenter      = containerCriteriaPresenter;
     _reactionEductPresenter          = reactionEductPresenter;
     _reactionProductPresenter        = reactionProductPresenter;
     _reactionModifiersPresenter      = reactionModifiersPresenter;
     _editReactionParametersPresenter = editReactionParametersPresenter;
     _view.SetParameterView(editReactionParametersPresenter.BaseView);
     _view.SetContainerCriteriaView(_containerCriteriaPresenter.BaseView);
     _view.SetEductView(reactionEductPresenter.View);
     _view.SetProductView(reactionProductPresenter.View);
     _view.SetModifierView(reactionModifiersPresenter.View);
     _editTasks = editTasks;
     _formulaToDTOFormulaBuilderMapper = formulaBuilderMapper;
     _editFormulaPresenter.SetDefaultFormulaType <ExplicitFormula>();
     _editFormulaPresenter.RemoveFormulaType <TableFormula>();
     _viewItemContextMenuFactory = viewItemContextMenuFactory;
     AddSubPresenters(_editReactionParametersPresenter, _containerCriteriaPresenter, _reactionEductPresenter, _reactionProductPresenter, _reactionModifiersPresenter);
 }
 protected override void Context()
 {
     _view = A.Fake <IEditReactionBuilderView>();
     _editFormulaPresenter       = A.Fake <IEditFormulaPresenter>();
     _selectReferencesPresenter  = A.Fake <ISelectReferenceAtReactionPresenter>();
     _reactionBuilderMapper      = A.Fake <IReactionBuilderToReactionBuilderDTOMapper>();
     _viewItemContextMenuFactory = A.Fake <IViewItemContextMenuFactory>();
     _editTasks                  = A.Fake <IEditTaskFor <IReactionBuilder> >();
     _context                    = A.Fake <IMoBiContext>();
     _formulaBuilderMapper       = A.Fake <IFormulaToFormulaBuilderDTOMapper>();
     _editReactionParameters     = A.Fake <IEditParametersInContainerPresenter>();
     _containerCriteriaPresenter = A.Fake <IDescriptorConditionListPresenter <IReactionBuilder> >();
     _reactionEductsPresenter    = A.Fake <IReactionEductsPresenter>();
     _reactionProductsPresenter  = A.Fake <IReactionProductsPresenter>();
     _reactionModifiersPresenter = A.Fake <IReactionModifiersPresenter>();
     sut = new EditReactionBuilderPresenter(_view, _editFormulaPresenter, _selectReferencesPresenter, _reactionBuilderMapper, _viewItemContextMenuFactory, _editTasks,
                                            _formulaBuilderMapper, _editReactionParameters, _context, _containerCriteriaPresenter, _reactionEductsPresenter, _reactionProductsPresenter, _reactionModifiersPresenter);
 }
        private IContextMenu createFor(ReactionModifierBuilderDTO reactionPartnerDTO, IReactionModifiersPresenter presenter)
        {
            var reactionBuilder = presenter.Subject.DowncastTo <IReactionBuilder>();

            var reactionModifier = string.Empty;

            if (reactionPartnerDTO != null)
            {
                reactionModifier = reactionBuilder.ModifierNames.FirstOrDefault(product => Equals(reactionPartnerDTO.ModiferName, product));
            }
            return(new ContextMenuForModifierBuilder(reactionBuilder, reactionModifier));
        }