Esempio n. 1
0
        public IPKSimBuildingBlock CreateCloneFor(IPKSimBuildingBlock buildingBlockToClone)
        {
            //This should never fail
            var expressionProfile = buildingBlockToClone.DowncastTo <ExpressionProfile>();

            var(molecule, _) = expressionProfile;
            _dto             = _expressionProfileDTOMapper.MapFrom(expressionProfile);
            _view.Caption    = Captions.CloneObjectBase(PKSimConstants.ObjectTypes.ExpressionProfile, buildingBlockToClone.Name);

            _view.BindTo(_dto);
            _view.Display();

            if (_view.Canceled)
            {
                return(null);
            }

            //create a new expression profile using the same molecule name as the original so that we can update the values. Then we rename
            var newExpressionProfile = _expressionProfileFactory.Create(molecule.MoleculeType, _dto.Species.Name, molecule.Name);

            newExpressionProfile.Category = _dto.Category;

            //synchronize values
            _expressionProfileUpdater.SynchronizeExpressionProfileWithExpressionProfile(expressionProfile, newExpressionProfile);

            //rename using the new name
            _expressionProfileUpdater.UpdateMoleculeName(newExpressionProfile, _dto.MoleculeName);

            return(newExpressionProfile);
        }
        private void renameMoleculeNameInExpressionProfile(IPKSimBuildingBlock templateBuildingBlock, string newExpressionProfileName)
        {
            var expressionProfile = templateBuildingBlock as ExpressionProfile;

            if (expressionProfile == null)
            {
                return;
            }

            var(newMoleculeName, _, _) = CoreConstants.ContainerName.NamesFromExpressionProfileName(newExpressionProfileName);
            _expressionProfileUpdater.UpdateMoleculeName(expressionProfile, newMoleculeName);
        }
 public void Save()
 {
     _expressionProfile.Category = _expressionProfileDTO.Category;
     _expressionProfileUpdater.UpdateMoleculeName(_expressionProfile, _expressionProfileDTO.MoleculeName);
 }