Пример #1
0
 private void changeAssignment(bool useAsValue, double value, IAssignment assignment)
 {
     if (assignment == null)
     {
         return;
     }
     assignment.ObjectPath.Replace(GallbladderEmptyingRate, GallbladderEmptyingActive);
     assignment.UseAsValue = useAsValue;
     assignment.Formula    = _context.Create <ConstantFormula>().WithValue(value);
 }
Пример #2
0
        private IFormula createFormulaFromType(Type formulaType)
        {
            if (formulaType == typeof(ConstantFormula))
            {
                return(_context.Create <ConstantFormula>());
            }

            if (formulaType == typeof(BlackBoxFormula))
            {
                return(_context.Create <BlackBoxFormula>());
            }

            if (formulaType == typeof(TableFormula))
            {
                return(createTableFormula());
            }

            if (formulaType == typeof(SumFormula))
            {
                return(_context.Create <SumFormula>());
            }

            if (formulaType == typeof(TableFormulaWithOffset))
            {
                return(createTableFormulaWithOffset());
            }

            if (formulaType == typeof(TableFormulaWithXArgument))
            {
                return(createTableFormulaWithXArgument());
            }

            //default
            return(_context.Create <ExplicitFormula>());
        }
Пример #3
0
        public void AddConditionFormula()
        {
            string newName = _dialogCreator.AskForInput(AppConstants.Captions.NewName, AppConstants.Captions.EnterNewFormulaName, string.Empty, AllFormulaNames());

            checkFormulaName(newName);
            if (string.IsNullOrEmpty(newName))
            {
                return;
            }

            var newFormula        = _context.Create <ExplicitFormula>().WithName(newName);
            var newFormulaCommand = new MoBiMacroCommand
            {
                Description = AppConstants.Commands.EditDescription(ObjectTypes.EventBuilder, _formulaPropertyName, string.Empty, newName, _eventBuilder.Name),
                CommandType = AppConstants.Commands.EditCommand,
                ObjectType  = ObjectTypes.EventBuilder
            };

            newFormulaCommand.AddCommand(new AddFormulaToFormulaCacheCommand(BuildingBlock, newFormula).Run(_context));
            newFormulaCommand.AddCommand(new EditObjectBasePropertyInBuildingBlockCommand(_formulaPropertyName, newFormula, _eventBuilder.Formula, _eventBuilder, BuildingBlock).Run(_context));
            AddCommand(newFormulaCommand);
            Edit(_eventBuilder);
        }