Ejemplo n.º 1
0
        private static bool changeUsagesInSumulation(string newName, IModelCoreSimulation simulation, ICommandCollector commandCollector)
        {
            commandCollector.AddCommand(new RenameObjectBaseCommand(simulation.Model, newName, null));
            commandCollector.AddCommand(new RenameModelCommand(simulation.Model, newName));
            // Dont rename core Container to avoid refernce Corruption

            return(true);
        }
        public override bool EditEntityModal(TransporterMoleculeContainer entity, IEnumerable <IObjectBase> existingObjectsInParent, ICommandCollector commandCollector, IBuildingBlock buildingBlock)
        {
            var name = _interactionTaskContext.DialogCreator.AskForInput(AppConstants.Dialog.AskForNewName(ObjectName), AppConstants.Captions.NewWindow(ObjectName),
                                                                         string.Empty, GetForbiddenNamesWithoutSelf(entity, existingObjectsInParent));

            if (name.IsNullOrEmpty())
            {
                return(false);
            }

            entity.Name          = name;
            entity.TransportName = name;
            var moleculesBuildingBlock = buildingBlock.DowncastTo <IMoleculeBuildingBlock>();
            var molecule = moleculesBuildingBlock.FindByName(entity.Name);

            if (molecule != null)
            {
                return(true);
            }

            var moleculeBuilder = _context.Create <IMoleculeBuilder>().WithName(entity.Name).WithIcon(ApplicationIcons.Transporter.IconName);

            moleculeBuilder.QuantityType        = QuantityType.Transporter;
            moleculeBuilder.DefaultStartFormula = _context.Create <ConstantFormula>().WithValue(0).WithDimension(_dimensionRetriever.MoleculeDimension);

            _calculationMethodRepository.GetAllCategoriesDefault().Each(cm => moleculeBuilder.AddUsedCalculationMethod(new UsedCalculationMethod(cm.Category, AppConstants.DefaultNames.EmptyCalculationMethod)));
            commandCollector.AddCommand(new AddMoleculeBuilderCommand(moleculesBuildingBlock, moleculeBuilder).Run(_context));
            return(true);
        }
Ejemplo n.º 3
0
        private T addToProject <T>(ICommandCollector commandCollector, T buildingBlock) where T : class, IBuildingBlock
        {
            if (buildingBlock != null)
            {
                commandCollector.AddCommand(new AddBuildingBlockCommand <T>(buildingBlock));
            }

            return(buildingBlock);
        }
        public void EditTableFor(ICommandCollector presenter, IParameterDTO parameterDTO)
        {
            using (var tablePresenter = _applicationController.Start <IEditTableParameterPresenter>())
            {
                var parameter = ParameterFrom(parameterDTO);
                if (!tablePresenter.Edit(parameter))
                {
                    return;
                }

                presenter.AddCommand(_parameterTask.UpdateTableFormula(parameter, tablePresenter.EditedFormula));
            }
        }
 public void should_Add_Edit_command_toi_command_collector()
 {
     A.CallTo(() => _commandCollector.AddCommand(A <EditObjectBasePropertyInBuildingBlockCommand> ._)).MustHaveHappened();
 }
 public virtual void SetParameterUnit(ICommandCollector presenter, IParameterDTO parameterDTO, Unit displayUnit)
 {
     presenter.AddCommand(_parameterTask.SetParameterUnit(ParameterFrom(parameterDTO), displayUnit));
 }
 public virtual void SetParameterValue(ICommandCollector presenter, IParameterDTO parameterDTO, double valueInGuiUnit)
 {
     presenter.AddCommand(_parameterTask.SetParameterDisplayValue(ParameterFrom(parameterDTO), valueInGuiUnit));
 }
 public void ResetParameter(ICommandCollector presenter, IParameterDTO parameterDTO)
 {
     presenter.AddCommand(_parameterTask.ResetParameter(ParameterFrom(parameterDTO)));
 }
 public void SetParameterValueOrigin(ICommandCollector presenter, IParameterDTO parameterDTO, ValueOrigin valueOrigin)
 {
     presenter.AddCommand(_parameterTask.SetParameterValueOrigin(ParameterFrom(parameterDTO), valueOrigin));
 }
 public virtual void SetParameterPercentile(ICommandCollector presenter, IParameterDTO parameterDTO, double percentileInPercent)
 {
     presenter.AddCommand(_parameterTask.SetParameterPercentile(ParameterFrom(parameterDTO), percentileInPercent / 100));
 }
Ejemplo n.º 11
0
 public void SetParameterName(ICommandCollector presenter, IParameterDTO parameterDTO, string name)
 {
     presenter.AddCommand(_parameterTask.SetParameterName(ParameterFrom(parameterDTO), name));
 }