コード例 #1
0
        private static void checkThatFormulationIsUsedEitherAsTemplateOrAsSimulationFormulation(IReadOnlyList <Formulation> allFormulationUsed)
        {
            var allFormulationNames = allFormulationUsed.AllNames().Distinct().ToList();

            if (allFormulationNames.Count == allFormulationUsed.Count)
            {
                return;
            }

            throw new PKSimException(PKSimConstants.Error.FormulationShouldBeUsedAsTemplateOrAsSimulationBuildingBlock);
        }
コード例 #2
0
        private PartialDerivatives partialDerivativesFrom(string fullOutputPath, DataColumn outputResult, IReadOnlyList <IdentificationParameter> allIdentificationParameters, OutputMapping outputMapping, ISimModelBatch simModelBatch)
        {
            var partialDerivatives = new PartialDerivatives(fullOutputPath, allIdentificationParameters.AllNames());

            outputResult.Values.Each((outputValue, index) =>
            {
                var derivativeValues = retrievePartialDerivativeFor(allIdentificationParameters, x => retrievePartialDerivativeForOutputs(x, outputMapping, simModelBatch, index));
                partialDerivatives.AddPartialDerivative(derivativeValues);
            });

            return(partialDerivatives);
        }
コード例 #3
0
        public bool Delete(IReadOnlyList <SensitivityAnalysis> sensitivityAnalyses)
        {
            var res = _dialogCreator.MessageBoxYesNo(Captions.SensitivityAnalysis.ReallyDeleteSensitivityAnalyses(sensitivityAnalyses.AllNames()));

            if (res == ViewResult.No)
            {
                return(false);
            }

            sensitivityAnalyses.Each(delete);
            return(true);
        }
コード例 #4
0
 public static IMenuBarButton CompareObjectsMenu(IReadOnlyList <IObjectBase> objectsToCompare, IOSPSuiteExecutionContext context)
 {
     return(CompareObjectsMenu(objectsToCompare, objectsToCompare.AllNames(), context));
 }
コード例 #5
0
        public void Delete(IReadOnlyList <TemplateDTO> templateDTOs)
        {
            var result = _dialogCreator.MessageBoxYesNo(PKSimConstants.UI.ReallyDeleteTemplate(templateDTOs.AllNames()));

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

            templateDTOs.Each(x =>
            {
                var template = x.Template;
                _templateTaskQuery.DeleteTemplate(template);
                _availableTemplates.Remove(template);
                _selectedTemplates.Remove(template);
            });

            updateView();
        }
コード例 #6
0
ファイル: BuildingBlockTask.cs プロジェクト: valdiman/PK-Sim
        public bool Delete <TBuildingBlock>(IReadOnlyList <TBuildingBlock> buildingBlocksToDelete) where TBuildingBlock : class, IPKSimBuildingBlock
        {
            if (!buildingBlocksToDelete.Any())
            {
                return(true);
            }

            var buildingBlockType = _entityTask.TypeFor(buildingBlocksToDelete.First());

            foreach (var buildingBlockToDelete in buildingBlocksToDelete)
            {
                var simulationsUsingBuildingBlockToDelete = _buildingBlockInSimulationManager.SimulationsUsing(buildingBlockToDelete).ToList();
                if (simulationsUsingBuildingBlockToDelete.Any())
                {
                    throw new CannotDeleteBuildingBlockException(buildingBlockToDelete.Name, buildingBlockType, simulationsUsingBuildingBlockToDelete);
                }
            }

            var viewResult = _dialogCreator.MessageBoxYesNo(PKSimConstants.UI.ReallyDeleteObjectOfType(buildingBlockType, buildingBlocksToDelete.AllNames().ToArray()));

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

            buildingBlocksToDelete.OfType <Simulation>().Each(simulation => _simulationReferenceUpdater.RemoveSimulationFromParameterIdentificationsAndSensitivityAnalyses(simulation));

            var macoCommand = new PKSimMacroCommand
            {
                CommandType       = PKSimConstants.Command.CommandTypeDelete,
                ObjectType        = buildingBlockType,
                BuildingBlockType = buildingBlockType,
                Description       = PKSimConstants.Command.ObjectsDeletedFromProject(buildingBlockType),
            };

            buildingBlocksToDelete.Each(x => macoCommand.Add(DeleteCommand(x)));
            AddCommandToHistory(macoCommand.Run(_executionContext));
            buildingBlocksToDelete.Each(RemovePresenterSettings);

            return(true);
        }
コード例 #7
0
        public bool Delete(IReadOnlyList <ParameterIdentification> parameterIdentifications)
        {
            var res = _dialogCreator.MessageBoxYesNo(Captions.ParameterIdentification.ReallyDeleteParameterIdentifications(parameterIdentifications.AllNames()));

            if (res == ViewResult.No)
            {
                return(false);
            }

            parameterIdentifications.Each(delete);
            return(true);
        }
コード例 #8
0
        public bool Delete(IReadOnlyList <ISimulationComparison> simulationComparisons)
        {
            if (!simulationComparisons.Any())
            {
                return(true);
            }

            var res = _dialogCreator.MessageBoxYesNo(PKSimConstants.UI.ReallyDeleteSimulationComparisons(simulationComparisons.AllNames()));

            if (res == ViewResult.No)
            {
                return(false);
            }

            simulationComparisons.Each(deleteSimulationComparison);

            return(true);
        }