Exemple #1
0
        public void Clone <TBuildingBlock>(TBuildingBlock buildingBlockToClone) where TBuildingBlock : class, IPKSimBuildingBlock
        {
            Load(buildingBlockToClone);
            using (var clonePresenter = _applicationController.Start <ICloneBuildingBlockPresenter>())
            {
                var clone = clonePresenter.CreateCloneFor(buildingBlockToClone);
                if (clone == null)
                {
                    return;
                }

                clone.Creation.AsCloneOf(buildingBlockToClone);

                var addCommand = new AddBuildingBlockToProjectCommand(clone, _executionContext).Run(_executionContext);
                var entityType = _entityTask.TypeFor(buildingBlockToClone);
                addCommand.Description = PKSimConstants.Command.CloneEntity(entityType, buildingBlockToClone.Name, clone.Name);

                AddCommandToHistory(addCommand);
            }
        }
        public void RemoveMolecule(IndividualMolecule molecule)
        {
            var viewResult = _dialogCreator.MessageBoxYesNo(PKSimConstants.UI.ReallyDeleteProtein(_entityTask.TypeFor(molecule), molecule.Name));

            if (viewResult == ViewResult.No)
            {
                return;
            }

            AddCommand(_moleculeExpressionTask.RemoveMoleculeFrom(molecule, _simulationSubject));
        }
        public void RemoveProcess(CompoundProcess compoundProcess)
        {
            var question = _dialogCreator.MessageBoxYesNo(PKSimConstants.UI.ReallyDeleteProcess(_entityTask.TypeFor(compoundProcess), compoundProcess.Name));

            if (question == ViewResult.No)
            {
                return;
            }
            AddCommand(_compoundProcessTask.RemoveProcess(_compound, compoundProcess));
        }
Exemple #4
0
        public void ActivateNode(ITreeNode node)
        {
            if (node == null)
            {
                return;
            }

            //one of the root has been selected
            if (nodeRepresentsMoleculeFolder(node))
            {
                _view.LinkedExpressionProfileCaption = string.Empty;
                _view.ActivateView(_noItemInSelectionPresenter.BaseView);
                return;
            }

            var rootNode          = node.ParentNode.DowncastTo <RootNode>();
            var molecule          = moleculeFrom(node);
            var expressionProfile = _simulationSubject.ExpressionProfileFor(molecule);

            if (expressionProfile == null)
            {
                throw new PKSimException(PKSimConstants.Error.ExpressionProfileForMoleculeNotFound(molecule.Name, _simulationSubject.Name, _entityTask.TypeFor(_simulationSubject)));
            }

            _view.LinkedExpressionProfileCaption = PKSimConstants.UI.LinkedExpressionProfileIs(expressionProfile.Name);
            _activePresenter = presenterFor(rootNode);
            //needs to be done as soon as the view is available to allow proper resizing
            _view.ActivateView(_activePresenter.BaseView);
            _activePresenter.DisableEdit();
            _activePresenter.ActivateMolecule(molecule);
            _activePresenter.OntogenyVisible           = _simulationSubject.IsAgeDependent;
            _activePresenter.MoleculeParametersVisible = _simulationSubject.IsAnImplementationOf <Individual>();
        }