Example #1
0
        public ExpressionProfile SelectExpressionProfile <TMolecule>(ISimulationSubject simulationSubject) where TMolecule : IndividualMolecule
        {
            _moleculeType                  = typeof(TMolecule);
            _simulationSubject             = simulationSubject;
            _createExpressionProfileAction = () =>
            {
                _expressionProfileTask.AddForMoleculeToProject <TMolecule>();
                refreshExpressionProfilesForMolecule();
            };

            _loadExpressionProfileAsync = async() =>
            {
                await _expressionProfileTask.LoadSingleFromTemplateAsync();

                refreshExpressionProfilesForMolecule();
            };

            refreshExpressionProfilesForMolecule();

            var moleculeDisplay = _moleculePropertiesMapper.MoleculeDisplayFor <TMolecule>();

            _view.Caption         = PKSimConstants.UI.AddMolecule(moleculeDisplay);
            _view.ApplicationIcon = _moleculePropertiesMapper.MoleculeIconFor <TMolecule>();
            _expressionProfileSelectionDTO.AllExistingMolecules = simulationSubject.AllMolecules().AllNames();
            _view.BindTo(_expressionProfileSelectionDTO);
            _view.Display();
            if (_view.Canceled)
            {
                return(null);
            }

            return(_expressionProfileSelectionDTO.ExpressionProfile);
        }
Example #2
0
        public ExpressionProfileDTO MapFrom(ExpressionProfile expressionProfile)
        {
            var dto = new ExpressionProfileDTO
            {
                Icon          = _moleculePropertiesMapper.MoleculeIconFor(expressionProfile.Molecule),
                Species       = expressionProfile.Species,
                Category      = expressionProfile.Category,
                MoleculeName  = moleculeNameFor(expressionProfile),
                AllMolecules  = _usedMoleculeRepository.All(),
                AllCategories = _usedExpressionProfileCategoryRepository.All(),
                AllSpecies    = _speciesRepository.All(),
                MoleculeType  = _moleculePropertiesMapper.MoleculeDisplayFor(expressionProfile.Molecule),
            };

            dto.AddExistingExpressionProfileNames(_projectRetriever.Current.All <ExpressionProfile>().AllNames().Except(new[] { expressionProfile.Name }));
            return(dto);
        }