diff --git a/src/PKSim.Assets.Images/PKSim.Assets.Images.csproj b/src/PKSim.Assets.Images/PKSim.Assets.Images.csproj
index eba2299f1..020f4a425 100644
--- a/src/PKSim.Assets.Images/PKSim.Assets.Images.csproj
+++ b/src/PKSim.Assets.Images/PKSim.Assets.Images.csproj
@@ -26,8 +26,8 @@
-
-
+
+
diff --git a/src/PKSim.Assets/PKSim.Assets.csproj b/src/PKSim.Assets/PKSim.Assets.csproj
index 71868d1c8..901cf887a 100644
--- a/src/PKSim.Assets/PKSim.Assets.csproj
+++ b/src/PKSim.Assets/PKSim.Assets.csproj
@@ -26,8 +26,8 @@
-
-
+
+
diff --git a/src/PKSim.BatchTool/BatchRegister.cs b/src/PKSim.BatchTool/BatchRegister.cs
index 8ca16c691..da52b60a4 100644
--- a/src/PKSim.BatchTool/BatchRegister.cs
+++ b/src/PKSim.BatchTool/BatchRegister.cs
@@ -19,7 +19,7 @@ public override void RegisterInContainer(IContainer container)
scan.WithDefaultConvention();
});
- container.Register(LifeStyle.Singleton);
+ container.Register(LifeStyle.Singleton);
container.Register();
container.Register();
container.Register();
diff --git a/src/PKSim.BatchTool/PKSim.BatchTool.csproj b/src/PKSim.BatchTool/PKSim.BatchTool.csproj
index 0c042942f..d04fc407f 100644
--- a/src/PKSim.BatchTool/PKSim.BatchTool.csproj
+++ b/src/PKSim.BatchTool/PKSim.BatchTool.csproj
@@ -59,8 +59,8 @@
-
-
+
+
diff --git a/src/PKSim.CLI.Core/PKSim.CLI.Core.csproj b/src/PKSim.CLI.Core/PKSim.CLI.Core.csproj
index 6d759cbdf..7de5e2a24 100644
--- a/src/PKSim.CLI.Core/PKSim.CLI.Core.csproj
+++ b/src/PKSim.CLI.Core/PKSim.CLI.Core.csproj
@@ -27,9 +27,9 @@
-
+
-
+
diff --git a/src/PKSim.CLI/PKSim.CLI.csproj b/src/PKSim.CLI/PKSim.CLI.csproj
index 81fce9b0e..aa1fa1b8e 100644
--- a/src/PKSim.CLI/PKSim.CLI.csproj
+++ b/src/PKSim.CLI/PKSim.CLI.csproj
@@ -61,9 +61,9 @@
-
-
-
+
+
+
diff --git a/src/PKSim.Core/Model/CompoundProcessParameterMapping.cs b/src/PKSim.Core/Model/CompoundProcessParameterMapping.cs
index 5d4d808f3..8215a05e7 100644
--- a/src/PKSim.Core/Model/CompoundProcessParameterMapping.cs
+++ b/src/PKSim.Core/Model/CompoundProcessParameterMapping.cs
@@ -21,13 +21,13 @@ public interface ICompoundProcessParameterMapping
///
/// Path to the mapped parameter (e.g. ORGANISM/Liver/Volume)
///
- IObjectPath MappedParameterPath { get; set; }
+ ObjectPath MappedParameterPath { get; set; }
}
public class CompoundProcessParameterMapping : ICompoundProcessParameterMapping
{
public string ProcessName { get; set; }
public string ParameterName { get; set; }
- public IObjectPath MappedParameterPath { get; set; }
+ public ObjectPath MappedParameterPath { get; set; }
}
}
\ No newline at end of file
diff --git a/src/PKSim.Core/Model/FormulaFactory.cs b/src/PKSim.Core/Model/FormulaFactory.cs
index 7e815a3d3..29384118f 100644
--- a/src/PKSim.Core/Model/FormulaFactory.cs
+++ b/src/PKSim.Core/Model/FormulaFactory.cs
@@ -210,7 +210,7 @@ public IFormula DoseFromDosePerBodySurfaceAreaFor(IFormulaCache formulaCache)
return RateFor(CoreConstants.CalculationMethod.APPLICATION_PARAMETER_HUMAN, CoreConstants.Rate.APPLICATION_DOSE_FROM_DOSE_PER_BODY_SURFACE_AREA, formulaCache);
}
- private IFormulaUsablePath pathInParentContainerFor(IParameter parameter, string alias)
+ private FormulaUsablePath pathInParentContainerFor(IParameter parameter, string alias)
{
return _objectPathFactory.CreateFormulaUsablePathFrom(ObjectPath.PARENT_CONTAINER, parameter.Name)
.WithAlias(alias)
@@ -338,7 +338,7 @@ private IFormula createFormula(RateKey rateKey)
foreach (var rateObjectPath in _rateObjectPathsRepository.ObjectPathsFor(rateKey))
{
- formula.AddObjectPath(rateObjectPath.Clone());
+ formula.AddObjectPath(rateObjectPath.Clone());
}
addTimeReferenceIfNeeded(formula);
@@ -395,8 +395,8 @@ private IFormula createTableFormulaWithOffset(RateKey rateKey)
if (tableObjectPath == null || offsetObjectPath == null)
throw new ArgumentException(PKSimConstants.Error.TableFormulaWithOffsetMissingRefs(rateKey.ToString(), CoreConstants.Alias.TABLE, CoreConstants.Alias.OFFSET));
- formula.AddTableObjectPath(tableObjectPath.Clone());
- formula.AddOffsetObjectPath(offsetObjectPath.Clone());
+ formula.AddTableObjectPath(tableObjectPath.Clone());
+ formula.AddOffsetObjectPath(offsetObjectPath.Clone());
//Table formula with offest has the same dimension as its referenced table object
formula.Dimension = tableObjectPath.Dimension;
diff --git a/src/PKSim.Core/Model/MoleculeStartFormula.cs b/src/PKSim.Core/Model/MoleculeStartFormula.cs
index 18849ff78..8ddc4af77 100644
--- a/src/PKSim.Core/Model/MoleculeStartFormula.cs
+++ b/src/PKSim.Core/Model/MoleculeStartFormula.cs
@@ -10,7 +10,7 @@ public interface IMoleculeStartFormula
///
/// Database path to the molecule, e.g. "ORGANISM\Liver\Plasma\DRUG"
///
- IObjectPath MoleculePath { get; }
+ ObjectPath MoleculePath { get; }
///
/// Calculation method and rate for given formula
@@ -20,13 +20,13 @@ public interface IMoleculeStartFormula
public class MoleculeStartFormula : IMoleculeStartFormula
{
- public MoleculeStartFormula(IObjectPath moleculePath, string calculationMethod, string rate)
+ public MoleculeStartFormula(ObjectPath moleculePath, string calculationMethod, string rate)
{
MoleculePath = moleculePath;
RateKey = new RateKey(calculationMethod, rate);
}
- public IObjectPath MoleculePath { get; private set; }
+ public ObjectPath MoleculePath { get; private set; }
public RateKey RateKey { get; private set; }
}
}
\ No newline at end of file
diff --git a/src/PKSim.Core/Model/PKSimBuildingBlock.cs b/src/PKSim.Core/Model/PKSimBuildingBlock.cs
index e33672aa7..3259dfd27 100644
--- a/src/PKSim.Core/Model/PKSimBuildingBlock.cs
+++ b/src/PKSim.Core/Model/PKSimBuildingBlock.cs
@@ -125,6 +125,8 @@ public virtual ContainerMode Mode
}
public virtual IReadOnlyList Children => Root.Children;
+
+ public ObjectPath ParentPath { get; set; }
public IEnumerator GetEnumerator()
{
diff --git a/src/PKSim.Core/Model/RateObjectPaths.cs b/src/PKSim.Core/Model/RateObjectPaths.cs
index 7fc376131..36aa06912 100644
--- a/src/PKSim.Core/Model/RateObjectPaths.cs
+++ b/src/PKSim.Core/Model/RateObjectPaths.cs
@@ -7,13 +7,13 @@ public interface IRateObjectPaths
{
string Rate { get; }
string CalculationMethod { get; }
- IEnumerable ObjectPaths { get; }
- void AddObjectPath(IFormulaUsablePath objectPath);
+ IEnumerable ObjectPaths { get; }
+ void AddObjectPath(FormulaUsablePath objectPath);
}
public class RateObjectPaths : IRateObjectPaths
{
- private readonly IList _objectPaths;
+ private readonly IList _objectPaths;
public string Rate { get; private set; }
public string CalculationMethod { get; private set; }
@@ -21,15 +21,15 @@ public RateObjectPaths(string calculationMethod, string rate)
{
CalculationMethod = calculationMethod;
Rate = rate;
- _objectPaths = new List();
+ _objectPaths = new List();
}
- public IEnumerable ObjectPaths
+ public IEnumerable ObjectPaths
{
get { return _objectPaths; }
}
- public void AddObjectPath(IFormulaUsablePath objectPath)
+ public void AddObjectPath(FormulaUsablePath objectPath)
{
_objectPaths.Add(objectPath);
}
@@ -40,12 +40,12 @@ public class NullObjectPaths : IRateObjectPaths
public string Rate { get; private set; }
public string CalculationMethod { get; private set; }
- public IEnumerable ObjectPaths
+ public IEnumerable ObjectPaths
{
- get { return new List(); }
+ get { return new List(); }
}
- public void AddObjectPath(IFormulaUsablePath objectPath)
+ public void AddObjectPath(FormulaUsablePath objectPath)
{
}
}
diff --git a/src/PKSim.Core/PKSim.Core.csproj b/src/PKSim.Core/PKSim.Core.csproj
index a5fc8275e..81ad34f57 100644
--- a/src/PKSim.Core/PKSim.Core.csproj
+++ b/src/PKSim.Core/PKSim.Core.csproj
@@ -30,10 +30,10 @@
-
-
-
-
+
+
+
+
diff --git a/src/PKSim.Core/Repositories/ICompoundProcessParameterMappingRepository.cs b/src/PKSim.Core/Repositories/ICompoundProcessParameterMappingRepository.cs
index d8da312eb..99f126d2c 100644
--- a/src/PKSim.Core/Repositories/ICompoundProcessParameterMappingRepository.cs
+++ b/src/PKSim.Core/Repositories/ICompoundProcessParameterMappingRepository.cs
@@ -13,7 +13,7 @@ public interface ICompoundProcessParameterMappingRepository : IRepository
/// Internal name of the compound process
/// Name of parameter
- IObjectPath MappedParameterPathFor(string compoundProcessName, string processParameterName);
+ ObjectPath MappedParameterPathFor(string compoundProcessName, string processParameterName);
///
/// Returns true if a mapping is available for the give{Process, ParameterName} otherwise false
diff --git a/src/PKSim.Core/Repositories/IModelContainerMoleculeRepository.cs b/src/PKSim.Core/Repositories/IModelContainerMoleculeRepository.cs
index e81e5d3af..822bb2bdd 100644
--- a/src/PKSim.Core/Repositories/IModelContainerMoleculeRepository.cs
+++ b/src/PKSim.Core/Repositories/IModelContainerMoleculeRepository.cs
@@ -31,13 +31,13 @@ public interface IModelContainerMoleculeRepository : IStartableRepository
- bool IsPresent(string modelName, IObjectPath containerPath, string moleculeName);
+ bool IsPresent(string modelName, ObjectPath containerPath, string moleculeName);
///
/// Checks if molecule is available in container (for given model).
/// Default behaviour for the case no entry for {model, container, molecule} is found: return false
///
- bool NegativeValuesAllowed(string modelName, IObjectPath containerPath, string moleculeName);
+ bool NegativeValuesAllowed(string modelName, ObjectPath containerPath, string moleculeName);
}
}
diff --git a/src/PKSim.Core/Repositories/IMoleculeStartFormulaRepository.cs b/src/PKSim.Core/Repositories/IMoleculeStartFormulaRepository.cs
index 0e7def28b..6d8bfc8f8 100644
--- a/src/PKSim.Core/Repositories/IMoleculeStartFormulaRepository.cs
+++ b/src/PKSim.Core/Repositories/IMoleculeStartFormulaRepository.cs
@@ -14,6 +14,6 @@ public interface IMoleculeStartFormulaRepository : IStartableRepository must be a database path to the molecule (e.g. "ORGANISM\Liver\Plasma\DRUG")
///
/// Rate key if found, null if not found
- RateKey RateKeyFor(IObjectPath moleculePath, ModelProperties modelProperties);
+ RateKey RateKeyFor(ObjectPath moleculePath, ModelProperties modelProperties);
}
}
\ No newline at end of file
diff --git a/src/PKSim.Core/Repositories/IRateObjectPathsRepository.cs b/src/PKSim.Core/Repositories/IRateObjectPathsRepository.cs
index 9e30a25e5..c0f8bd188 100644
--- a/src/PKSim.Core/Repositories/IRateObjectPathsRepository.cs
+++ b/src/PKSim.Core/Repositories/IRateObjectPathsRepository.cs
@@ -7,12 +7,12 @@ namespace PKSim.Core.Repositories
{
public interface IRateObjectPathsRepository : IStartableRepository
{
- IEnumerable ObjectPathsFor(string rate, string calculationMethod);
- IEnumerable ObjectPathsFor(RateKey rateKey);
+ IEnumerable ObjectPathsFor(string rate, string calculationMethod);
+ IEnumerable ObjectPathsFor(RateKey rateKey);
///
/// returns the first path defined for the ratekey with the given alias. If not path is found, returns null
///
- IFormulaUsablePath PathWithAlias(RateKey rateKey, string alias);
+ FormulaUsablePath PathWithAlias(RateKey rateKey, string alias);
}
}
\ No newline at end of file
diff --git a/src/PKSim.Core/Services/DataRepositoryFromResultsCreator.cs b/src/PKSim.Core/Services/DataRepositoryFromResultsCreator.cs
index 39d46b63e..e0747d72f 100644
--- a/src/PKSim.Core/Services/DataRepositoryFromResultsCreator.cs
+++ b/src/PKSim.Core/Services/DataRepositoryFromResultsCreator.cs
@@ -87,11 +87,11 @@ private bool columnIsSelected(DataColumn column, OutputSelections outputSelectio
///
///
///
- private Tuple quantityAndPathFrom(Simulation simulation, IEnumerable path)
+ private Tuple quantityAndPathFrom(Simulation simulation, IReadOnlyList path)
{
var objectPath = _objectPathFactory.CreateObjectPathFrom(path).AndAddAtFront(simulation.Name);
var quantity = objectPath.TryResolve(simulation.Model.Root);
- return new Tuple(quantity, objectPath);
+ return new Tuple(quantity, objectPath);
}
private DataRepository createDataRepositoryWithBaseGrid(Simulation simulation)
diff --git a/src/PKSim.Core/Services/DistributedParameterToTableParameterConverter.cs b/src/PKSim.Core/Services/DistributedParameterToTableParameterConverter.cs
index 18cdd798b..c56a78de9 100644
--- a/src/PKSim.Core/Services/DistributedParameterToTableParameterConverter.cs
+++ b/src/PKSim.Core/Services/DistributedParameterToTableParameterConverter.cs
@@ -226,7 +226,7 @@ private void createPlasmaProteinOntogenyTable(IBuildConfiguration buildConfigura
private void createParameterValueVersionOntogenyTableParameter(
IParameter ontogenyFactorParameter,
IBuildConfiguration buildConfiguration,
- IObjectPath ontogenyFactorPath,
+ ObjectPath ontogenyFactorPath,
IndividualMolecule molecule)
{
var psv = buildConfiguration.ParameterStartValues;
@@ -345,7 +345,7 @@ PopulationSimulation populationSimulation
}
}
- private void createPopulationOntogenyTableParameter(IParameter ontogenyFactorParameter, IObjectPath ontogenyFactorPath, IndividualMolecule molecule, PopulationSimulation populationSimulation)
+ private void createPopulationOntogenyTableParameter(IParameter ontogenyFactorParameter, ObjectPath ontogenyFactorPath, IndividualMolecule molecule, PopulationSimulation populationSimulation)
{
addAgingDataToPopulationSimulation(populationSimulation, ontogenyFactorPath.ToString(), ontogenyFactorParameter,
p => createOntogenyTableFormulaFrom(p.Parameter, molecule.Ontogeny, p.OriginData, populationSimulation.RandomGenerator));
diff --git a/src/PKSim.Core/Services/InteractionKineticUpdaterSpecificationBase.cs b/src/PKSim.Core/Services/InteractionKineticUpdaterSpecificationBase.cs
index 33f9ea9f6..651eb289b 100644
--- a/src/PKSim.Core/Services/InteractionKineticUpdaterSpecificationBase.cs
+++ b/src/PKSim.Core/Services/InteractionKineticUpdaterSpecificationBase.cs
@@ -150,24 +150,24 @@ protected virtual IReadOnlyList AllInteractionProcessesFor(s
return _interactionTask.AllInteractionProcessesFor(moleculeName, _interactionType, simulation, compoundName);
}
- private IFormulaUsablePath kiPath(string kiParameter, Compound inhibitor, InteractionProcess process, string kiAlias)
+ private FormulaUsablePath kiPath(string kiParameter, Compound inhibitor, InteractionProcess process, string kiAlias)
{
return _objectPathFactory.CreateFormulaUsablePathFrom(inhibitor.Name, process.Name, kiParameter)
.WithAlias(kiAlias)
.WithDimension(_dimensionRepository.MolarConcentration);
}
- private IFormulaUsablePath inhibitorConcentrationPath(Compound inhibitor, string inhibitorAlias, IContainer processParameterContainer)
+ private FormulaUsablePath inhibitorConcentrationPath(Compound inhibitor, string inhibitorAlias, IContainer processParameterContainer)
{
return localInhibitorParameterPath(inhibitor, Constants.Parameters.CONCENTRATION, inhibitorAlias, processParameterContainer, _dimensionRepository.MolarConcentration);
}
- private IFormulaUsablePath kwaterPath(Compound inhibitor, string kwaterAlias, IContainer processParameterContainer)
+ private FormulaUsablePath kwaterPath(Compound inhibitor, string kwaterAlias, IContainer processParameterContainer)
{
return localInhibitorParameterPath(inhibitor, CoreConstants.Parameters.K_WATER, kwaterAlias, processParameterContainer, _dimensionRepository.NoDimension);
}
- private IFormulaUsablePath localInhibitorParameterPath(Compound inhibitor, string parameterName, string parameterAlias, IContainer processParameterContainer, IDimension dimension)
+ private FormulaUsablePath localInhibitorParameterPath(Compound inhibitor, string parameterName, string parameterAlias, IContainer processParameterContainer, IDimension dimension)
{
var objectPath = _objectPathFactory.CreateFormulaUsablePathFrom(inhibitor.Name, parameterName)
.WithAlias(parameterAlias)
diff --git a/src/PKSim.Core/Services/PKSimMoleculeStartValuesCreator.cs b/src/PKSim.Core/Services/PKSimMoleculeStartValuesCreator.cs
index ced281bb0..cd265e607 100644
--- a/src/PKSim.Core/Services/PKSimMoleculeStartValuesCreator.cs
+++ b/src/PKSim.Core/Services/PKSimMoleculeStartValuesCreator.cs
@@ -58,7 +58,7 @@ public IMoleculeStartValuesBuildingBlock CreateFor(IBuildConfiguration buildConf
return defaultStartValues.WithName(simulation.Name);
}
- private IEnumerable moleculesInvolvedInExpression(Individual individual, IndividualMolecule molecule,
+ private IEnumerable moleculesInvolvedInExpression(Individual individual, IndividualMolecule molecule,
IReadOnlyList compoundPropertiesList)
{
foreach (var container in individual.AllPhysicalContainersWithMoleculeFor(molecule))
@@ -69,7 +69,7 @@ private IEnumerable moleculesInvolvedInExpression(Individual indivi
{
foreach (var moleculeName in compoundProperties.Processes.AllInducedMoleculeNames(molecule))
{
- yield return containerPath.Clone().AndAdd(moleculeName);
+ yield return containerPath.Clone().AndAdd(moleculeName);
}
}
}
@@ -98,7 +98,7 @@ private void setStartFormulasForStaticMolecules(IMoleculeStartValuesBuildingBloc
moleculeStartValue.NegativeValuesAllowed = false;
}
- var moleculeDbPath = moleculeStartValue.ContainerPath.Clone();
+ var moleculeDbPath = moleculeStartValue.ContainerPath.Clone();
moleculeDbPath.Add(dbMoleculeName);
diff --git a/src/PKSim.Core/Services/RenameAbsolutePathVisitor.cs b/src/PKSim.Core/Services/RenameAbsolutePathVisitor.cs
index 9c34870a5..a2c491aef 100644
--- a/src/PKSim.Core/Services/RenameAbsolutePathVisitor.cs
+++ b/src/PKSim.Core/Services/RenameAbsolutePathVisitor.cs
@@ -48,10 +48,10 @@ private void renameAbsolutePathIn(IFormula formula)
if (formula == null || formula.IsConstant())
return;
- formula.ObjectPaths.Where(isAbsolutePath).Each(renameObjectPath);
+ formula.ObjectPaths.Where(x => isAbsolutePath(x.PathAsString)).Each(renameObjectPath);
}
- private void renameObjectPath(IObjectPath objectPath)
+ private void renameObjectPath(ObjectPath objectPath)
{
objectPath.Replace(_oldName, _newName);
}
diff --git a/src/PKSim.Core/Snapshots/Mappers/FormulaUsablePathMapper.cs b/src/PKSim.Core/Snapshots/Mappers/FormulaUsablePathMapper.cs
index e885d9865..944e8c17d 100644
--- a/src/PKSim.Core/Snapshots/Mappers/FormulaUsablePathMapper.cs
+++ b/src/PKSim.Core/Snapshots/Mappers/FormulaUsablePathMapper.cs
@@ -6,7 +6,7 @@
namespace PKSim.Core.Snapshots.Mappers
{
- public class FormulaUsablePathMapper : SnapshotMapperBase
+ public class FormulaUsablePathMapper : SnapshotMapperBase
{
private readonly IDimensionRepository _dimensionRepository;
@@ -15,7 +15,7 @@ public FormulaUsablePathMapper(IDimensionRepository dimensionRepository)
_dimensionRepository = dimensionRepository;
}
- public override Task MapToSnapshot(IFormulaUsablePath formulaUsablePath)
+ public override Task MapToSnapshot(OSPSuite.Core.Domain.FormulaUsablePath formulaUsablePath)
{
return SnapshotFrom(formulaUsablePath, x =>
{
@@ -25,9 +25,9 @@ public override Task MapToSnapshot(IFormulaUsablePath
});
}
- public override Task MapToModel(SnapshotFormulaUsablePath snapshot, SnapshotContext snapshotContext)
+ public override Task MapToModel(SnapshotFormulaUsablePath snapshot, SnapshotContext snapshotContext)
{
- IFormulaUsablePath formulaUsablePath;
+ OSPSuite.Core.Domain.FormulaUsablePath formulaUsablePath;
if (snapshot.Alias == Constants.TIME)
formulaUsablePath = new TimePath();
else
diff --git a/src/PKSim.Infrastructure/ORM/Mappers/FlatObjectPathToObjectPathMapper.cs b/src/PKSim.Infrastructure/ORM/Mappers/FlatObjectPathToObjectPathMapper.cs
index 4ce3ac2c9..18779741e 100644
--- a/src/PKSim.Infrastructure/ORM/Mappers/FlatObjectPathToObjectPathMapper.cs
+++ b/src/PKSim.Infrastructure/ORM/Mappers/FlatObjectPathToObjectPathMapper.cs
@@ -6,7 +6,7 @@
namespace PKSim.Infrastructure.ORM.Mappers
{
- public interface IFlatObjectPathToObjectPathMapper : IMapper
+ public interface IFlatObjectPathToObjectPathMapper : IMapper
{
}
@@ -21,9 +21,9 @@ public FlatObjectPathToObjectPathMapper(IFlatContainerRepository flatContainerRe
_relativeObjectPathMapper = relativeObjectPathMapper;
}
- public IObjectPath MapFrom(FlatObjectPath flatObjectPath)
+ public ObjectPath MapFrom(FlatObjectPath flatObjectPath)
{
- IObjectPath objectPath;
+ ObjectPath objectPath;
if (flatObjectPath.IsAbsolutePath)
{
diff --git a/src/PKSim.Infrastructure/ORM/Mappers/FlatRateObjectPathsToObjectPathsMapper.cs b/src/PKSim.Infrastructure/ORM/Mappers/FlatRateObjectPathsToObjectPathsMapper.cs
index 02076e771..e50a67b3c 100644
--- a/src/PKSim.Infrastructure/ORM/Mappers/FlatRateObjectPathsToObjectPathsMapper.cs
+++ b/src/PKSim.Infrastructure/ORM/Mappers/FlatRateObjectPathsToObjectPathsMapper.cs
@@ -6,7 +6,7 @@
namespace PKSim.Infrastructure.ORM.Mappers
{
- public interface IFlatRateObjectToFormulaUsablePathMapper : IMapper
+ public interface IFlatRateObjectToFormulaUsablePathMapper : IMapper
{
}
@@ -25,7 +25,7 @@ public FlatRateObjectToFormulaUsablePathMapper(IFlatObjectPathToObjectPathMapper
_dimensionRepository = dimensionRepository;
}
- public IFormulaUsablePath MapFrom(FlatRateObjectPath flatRateObjectPath)
+ public FormulaUsablePath MapFrom(FlatRateObjectPath flatRateObjectPath)
{
var rateObjectContainerPath = _objectPathMapper.MapFrom(flatRateObjectPath);
diff --git a/src/PKSim.Infrastructure/ORM/Mappers/FlatRelativeObjectPathToObjectPathMapper.cs b/src/PKSim.Infrastructure/ORM/Mappers/FlatRelativeObjectPathToObjectPathMapper.cs
index 8c6205e33..9ac170d65 100644
--- a/src/PKSim.Infrastructure/ORM/Mappers/FlatRelativeObjectPathToObjectPathMapper.cs
+++ b/src/PKSim.Infrastructure/ORM/Mappers/FlatRelativeObjectPathToObjectPathMapper.cs
@@ -7,7 +7,7 @@
namespace PKSim.Infrastructure.ORM.Mappers
{
- public interface IFlatRelativeObjectPathToObjectPathMapper : IMapper
+ public interface IFlatRelativeObjectPathToObjectPathMapper : IMapper
{
}
@@ -16,13 +16,13 @@ public class FlatRelativeObjectPathToObjectPathMapper : IFlatRelativeObjectPathT
private readonly IFlatRelativeObjectPathRepository _flatObjectPathRepo;
private readonly IObjectPathFactory _objectPathFactory;
- public FlatRelativeObjectPathToObjectPathMapper(IFlatRelativeObjectPathRepository flatRelativeObjectPathRepo,IObjectPathFactory objectPathFactory)
+ public FlatRelativeObjectPathToObjectPathMapper(IFlatRelativeObjectPathRepository flatRelativeObjectPathRepo, IObjectPathFactory objectPathFactory)
{
_flatObjectPathRepo = flatRelativeObjectPathRepo;
_objectPathFactory = objectPathFactory;
}
- public IObjectPath MapFrom(long flatObjectPathId)
+ public ObjectPath MapFrom(long flatObjectPathId)
{
FlatRelativeObjectPath flatObjectPath = _flatObjectPathRepo.FlatRelativeObjectPathFor(flatObjectPathId);
diff --git a/src/PKSim.Infrastructure/ORM/Queries/ModelObserverQuery.cs b/src/PKSim.Infrastructure/ORM/Queries/ModelObserverQuery.cs
index 4afff7a02..b66918001 100644
--- a/src/PKSim.Infrastructure/ORM/Queries/ModelObserverQuery.cs
+++ b/src/PKSim.Infrastructure/ORM/Queries/ModelObserverQuery.cs
@@ -241,7 +241,7 @@ private void addLiverZoneCompartmentObserver(IObserverBuilder observerBuilder, s
observerBuildingBlock.AddFormula(formula);
}
- private IFormulaUsablePath createZoneAmountPath(string compartment, string zone, string alias)
+ private FormulaUsablePath createZoneAmountPath(string compartment, string zone, string alias)
{
return _objectPathFactory.CreateFormulaUsablePathFrom(Constants.ORGANISM, CoreConstants.Organ.LIVER, zone, compartment, ObjectPathKeywords.MOLECULE)
.WithAlias(alias)
@@ -324,7 +324,7 @@ private IFormula getFractionFormula(IObserverBuildingBlock observerBuildingBlock
return fractionFormula;
}
- private IFormulaUsablePath createTotalDrugMassObjectPath(string pathToDrugMass)
+ private FormulaUsablePath createTotalDrugMassObjectPath(string pathToDrugMass)
{
return _objectPathFactory.CreateFormulaUsablePathFrom(pathToDrugMass, CoreConstants.Parameters.TOTAL_DRUG_MASS)
.WithAlias(TOTAL_DRUG_MASS_ALIAS)
diff --git a/src/PKSim.Infrastructure/ORM/Repositories/CompoundProcessParameterMappingRepository.cs b/src/PKSim.Infrastructure/ORM/Repositories/CompoundProcessParameterMappingRepository.cs
index 04e5d0a40..e03778dde 100644
--- a/src/PKSim.Infrastructure/ORM/Repositories/CompoundProcessParameterMappingRepository.cs
+++ b/src/PKSim.Infrastructure/ORM/Repositories/CompoundProcessParameterMappingRepository.cs
@@ -43,7 +43,7 @@ protected override void DoStart()
}
}
- public IObjectPath MappedParameterPathFor(string compoundProcessName, string processParameterName)
+ public ObjectPath MappedParameterPathFor(string compoundProcessName, string processParameterName)
{
Start();
diff --git a/src/PKSim.Infrastructure/ORM/Repositories/FlatContainerRepository.cs b/src/PKSim.Infrastructure/ORM/Repositories/FlatContainerRepository.cs
index 774ba86d5..c672664f6 100644
--- a/src/PKSim.Infrastructure/ORM/Repositories/FlatContainerRepository.cs
+++ b/src/PKSim.Infrastructure/ORM/Repositories/FlatContainerRepository.cs
@@ -15,7 +15,7 @@ public interface IFlatContainerRepository : IMetaDataRepository
FlatContainer ContainerFrom(string containerPath);
- IObjectPath ContainerPathFrom(int? containerId);
+ ObjectPath ContainerPathFrom(int? containerId);
}
public class FlatContainerRepository : MetaDataRepository, IFlatContainerRepository
@@ -65,7 +65,7 @@ public FlatContainer ContainerFrom(string containerPath)
return _flatContainersCachedByPath[containerPath];
}
- public IObjectPath ContainerPathFrom(int? containerId)
+ public ObjectPath ContainerPathFrom(int? containerId)
{
Start();
var path = new ObjectPath();
diff --git a/src/PKSim.Infrastructure/ORM/Repositories/ModelContainerMoleculeRepository.cs b/src/PKSim.Infrastructure/ORM/Repositories/ModelContainerMoleculeRepository.cs
index f5be9396c..70627eb78 100644
--- a/src/PKSim.Infrastructure/ORM/Repositories/ModelContainerMoleculeRepository.cs
+++ b/src/PKSim.Infrastructure/ORM/Repositories/ModelContainerMoleculeRepository.cs
@@ -88,7 +88,7 @@ public bool IsPresent(string modelName, int containerId, string moleculeName)
return _mcmProperties[key].IsPresent;
}
- public bool IsPresent(string modelName, IObjectPath containerPath, string moleculeName)
+ public bool IsPresent(string modelName, ObjectPath containerPath, string moleculeName)
{
Start();
@@ -96,7 +96,7 @@ public bool IsPresent(string modelName, IObjectPath containerPath, string molecu
return IsPresent(modelName, container.Id, moleculeName);
}
- public bool NegativeValuesAllowed(string modelName, IObjectPath containerPath, string moleculeName)
+ public bool NegativeValuesAllowed(string modelName, ObjectPath containerPath, string moleculeName)
{
Start();
diff --git a/src/PKSim.Infrastructure/ORM/Repositories/MoleculeStartFormulaRepository.cs b/src/PKSim.Infrastructure/ORM/Repositories/MoleculeStartFormulaRepository.cs
index 540e48bf6..83122a7f4 100644
--- a/src/PKSim.Infrastructure/ORM/Repositories/MoleculeStartFormulaRepository.cs
+++ b/src/PKSim.Infrastructure/ORM/Repositories/MoleculeStartFormulaRepository.cs
@@ -39,7 +39,7 @@ protected override void DoStart()
}
}
- public RateKey RateKeyFor(IObjectPath moleculePath, ModelProperties modelProperties)
+ public RateKey RateKeyFor(ObjectPath moleculePath, ModelProperties modelProperties)
{
Start();
diff --git a/src/PKSim.Infrastructure/ORM/Repositories/RateObjectPathsRepository.cs b/src/PKSim.Infrastructure/ORM/Repositories/RateObjectPathsRepository.cs
index 7da1194ac..c599c0840 100644
--- a/src/PKSim.Infrastructure/ORM/Repositories/RateObjectPathsRepository.cs
+++ b/src/PKSim.Infrastructure/ORM/Repositories/RateObjectPathsRepository.cs
@@ -66,18 +66,18 @@ private IRateObjectPaths rateObjectPathsFor(string calculationMethod, string rat
return rateObjectPaths;
}
- public IEnumerable ObjectPathsFor(string rate, string calculationMethod)
+ public IEnumerable ObjectPathsFor(string rate, string calculationMethod)
{
return ObjectPathsFor(new RateKey(calculationMethod, rate));
}
- public IEnumerable ObjectPathsFor(RateKey rateKey)
+ public IEnumerable ObjectPathsFor(RateKey rateKey)
{
Start();
return _rateObjectPaths[rateKey].ObjectPaths;
}
- public IFormulaUsablePath PathWithAlias(RateKey rateKey, string alias)
+ public FormulaUsablePath PathWithAlias(RateKey rateKey, string alias)
{
return ObjectPathsFor(rateKey).FirstOrDefault(path => string.Equals(path.Alias, alias));
}
diff --git a/src/PKSim.Infrastructure/PKSim.Infrastructure.csproj b/src/PKSim.Infrastructure/PKSim.Infrastructure.csproj
index f70424cb5..cc9a29c0d 100644
--- a/src/PKSim.Infrastructure/PKSim.Infrastructure.csproj
+++ b/src/PKSim.Infrastructure/PKSim.Infrastructure.csproj
@@ -41,15 +41,15 @@
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
diff --git a/src/PKSim.Infrastructure/Serialization/Xml/Serializers/ObjectPathXmlAttributeMapper.cs b/src/PKSim.Infrastructure/Serialization/Xml/Serializers/ObjectPathXmlAttributeMapper.cs
index b731fa246..b6639fc1b 100644
--- a/src/PKSim.Infrastructure/Serialization/Xml/Serializers/ObjectPathXmlAttributeMapper.cs
+++ b/src/PKSim.Infrastructure/Serialization/Xml/Serializers/ObjectPathXmlAttributeMapper.cs
@@ -5,9 +5,9 @@
namespace PKSim.Infrastructure.Serialization.Xml.Serializers
{
- public class ObjectPathXmlAttributeMapper : AttributeMapper
+ public class ObjectPathXmlAttributeMapper : AttributeMapper
{
- public override string Convert(IObjectPath objectPath, SerializationContext context)
+ public override string Convert(ObjectPath objectPath, SerializationContext context)
{
return objectPath == null ? string.Empty : objectPath.ToString();
}
diff --git a/src/PKSim.Infrastructure/Services/SettingsPersistor.cs b/src/PKSim.Infrastructure/Services/SettingsPersistor.cs
index 04107df51..2896a353e 100644
--- a/src/PKSim.Infrastructure/Services/SettingsPersistor.cs
+++ b/src/PKSim.Infrastructure/Services/SettingsPersistor.cs
@@ -31,9 +31,14 @@ public virtual void Save(TSettings userSettings)
public virtual TSettings Load()
{
+ if (!ExistingFilesForSettings().Any())
+ {
+ return CreateLoadFailDefaultsFrom(_defaultSettings);
+ }
+
try
{
- foreach (var filePath in SettingsFilePaths.Where(FileHelper.FileExists))
+ foreach (var filePath in ExistingFilesForSettings())
{
var xmlContent = XmlHelper.XmlContentFromFile(filePath);
return _stringSerializer.Deserialize(xmlContent);
@@ -42,12 +47,22 @@ public virtual TSettings Load()
//We do not want to have a crash if the user has edited the configuration by hand
catch (Exception)
{
- return _defaultSettings;
+ return CreateLoadFailDefaultsFrom(_defaultSettings);
}
+ return CreateLoadFailDefaultsFrom(_defaultSettings);
+ }
+
+ protected virtual TSettings CreateLoadFailDefaultsFrom(TSettings defaultSettings)
+ {
return _defaultSettings;
}
+ protected IReadOnlyList ExistingFilesForSettings()
+ {
+ return SettingsFilePaths.Where(FileHelper.FileExists).ToList();
+ }
+
protected abstract IEnumerable SettingsFilePaths { get; }
public void SaveCurrent()
diff --git a/src/PKSim.Infrastructure/Services/UserSettingsPersistor.cs b/src/PKSim.Infrastructure/Services/UserSettingsPersistor.cs
index edcddc35e..25eae7944 100644
--- a/src/PKSim.Infrastructure/Services/UserSettingsPersistor.cs
+++ b/src/PKSim.Infrastructure/Services/UserSettingsPersistor.cs
@@ -1,4 +1,5 @@
using System.Collections.Generic;
+using System.Linq;
using PKSim.Core;
using PKSim.Core.Services;
using PKSim.Presentation;
@@ -13,6 +14,12 @@ public UserSettingsPersistor(IStringSerializer stringSerializer, IUserSettings d
{
}
+ protected override IUserSettings CreateLoadFailDefaultsFrom(IUserSettings defaultSettings)
+ {
+ defaultSettings.ActiveSkin = CoreConstants.DEFAULT_SKIN;
+ return defaultSettings;
+ }
+
public override void Save(IUserSettings userSettings)
{
userSettings.SaveLayout();
diff --git a/src/PKSim.Matlab/PKSim.Matlab.csproj b/src/PKSim.Matlab/PKSim.Matlab.csproj
index a04a8e05c..07c32ea1b 100644
--- a/src/PKSim.Matlab/PKSim.Matlab.csproj
+++ b/src/PKSim.Matlab/PKSim.Matlab.csproj
@@ -26,9 +26,9 @@
-
+
-
+
diff --git a/src/PKSim.Presentation/PKSim.Presentation.csproj b/src/PKSim.Presentation/PKSim.Presentation.csproj
index 5929d4759..7aa50a978 100644
--- a/src/PKSim.Presentation/PKSim.Presentation.csproj
+++ b/src/PKSim.Presentation/PKSim.Presentation.csproj
@@ -27,11 +27,11 @@
-
+
-
-
+
+
diff --git a/src/PKSim.Presentation/PresenterRegister.cs b/src/PKSim.Presentation/PresenterRegister.cs
index ede83cee0..abb6bc412 100644
--- a/src/PKSim.Presentation/PresenterRegister.cs
+++ b/src/PKSim.Presentation/PresenterRegister.cs
@@ -1,8 +1,6 @@
using OSPSuite.Assets;
using OSPSuite.Core;
-using OSPSuite.Core.Domain.Mappers;
using OSPSuite.Presentation.Core;
-using OSPSuite.Presentation.Mappers;
using OSPSuite.Presentation.Presenters;
using OSPSuite.Presentation.Presenters.Comparisons;
using OSPSuite.Presentation.Presenters.Journal;
@@ -12,12 +10,9 @@
using OSPSuite.Utility.Format;
using PKSim.Assets;
using PKSim.Core;
-using PKSim.Core.Mappers;
using PKSim.Core.Model;
-using PKSim.Core.Services;
using PKSim.Presentation.Core;
using PKSim.Presentation.DTO.Mappers;
-using PKSim.Presentation.Mappers;
using PKSim.Presentation.Presenters;
using PKSim.Presentation.Presenters.ContextMenus;
using PKSim.Presentation.Presenters.Individuals;
@@ -35,7 +30,7 @@
namespace PKSim.Presentation
{
- public class PresenterRegister : Register
+ public abstract class BasePresenterRegister : Register
{
public override void RegisterInContainer(IContainer container)
{
@@ -43,7 +38,7 @@ public override void RegisterInContainer(IContainer container)
{
scan.AssemblyContainingType();
- //Main Presenters that should be registered as singletong
+ //Main Presenters that should be registered as singleton
scan.ExcludeNamespaceContainingType();
//Context menu will be registered with another convention
@@ -52,20 +47,12 @@ public override void RegisterInContainer(IContainer container)
//UI Commands will be registered with another convention
scan.ExcludeNamespaceContainingType();
- //This specific objects needs to be register as Singleton
- scan.ExcludeType();
- scan.ExcludeType();
- scan.ExcludeType();
-
- //This objects were already registered in Bootstrap
- scan.ExcludeType();
- scan.ExcludeType();
+ ExcludeTypes(scan);
scan.RegisterAs(LifeStyle.Transient);
scan.WithConvention();
});
-
container.AddScanner(scan =>
{
scan.AssemblyContainingType();
@@ -79,15 +66,7 @@ public override void RegisterInContainer(IContainer container)
});
- container.Register(LifeStyle.Singleton);
- container.Register(LifeStyle.Singleton);
- container.Register(LifeStyle.Singleton);
- container.Register(LifeStyle.Singleton);
- container.Register(LifeStyle.Singleton);
- container.Register(LifeStyle.Singleton);
- container.Register(LifeStyle.Singleton);
- container.Register(LifeStyle.Singleton);
- container.Register(LifeStyle.Singleton);
+ RegisterMainViewPresenters(container);
registerContextMenus(container);
@@ -133,6 +112,20 @@ public override void RegisterInContainer(IContainer container)
Captions.MoleculePath = PKSimConstants.UI.Molecule;
}
+ protected virtual void ExcludeTypes(IAssemblyScanner scan)
+ {
+ //This specific objects needs to be register as Singleton
+ scan.ExcludeType();
+ scan.ExcludeType();
+ scan.ExcludeType();
+
+ //This objects were already registered in Bootstrap
+ scan.ExcludeType();
+ scan.ExcludeType();
+ }
+
+ protected abstract void RegisterMainViewPresenters(IContainer container);
+
private static void registerSingleStartPresenters(IContainer container)
{
container.AddScanner(scan =>
@@ -163,4 +156,21 @@ private static void registerContextMenus(IContainer container)
});
}
}
+
+ public class PresenterRegister : BasePresenterRegister
+ {
+
+ protected override void RegisterMainViewPresenters(IContainer container)
+ {
+ container.Register(LifeStyle.Singleton);
+ container.Register(LifeStyle.Singleton);
+ container.Register(LifeStyle.Singleton);
+ container.Register(LifeStyle.Singleton);
+ container.Register(LifeStyle.Singleton);
+ container.Register(LifeStyle.Singleton);
+ container.Register(LifeStyle.Singleton);
+ container.Register(LifeStyle.Singleton);
+ container.Register(LifeStyle.Singleton);
+ }
+ }
}
\ No newline at end of file
diff --git a/src/PKSim.Presentation/Presenters/ContextMenus/BuildingBlockContextMenu.cs b/src/PKSim.Presentation/Presenters/ContextMenus/BuildingBlockContextMenu.cs
index ad02fc46d..760ade4a4 100644
--- a/src/PKSim.Presentation/Presenters/ContextMenus/BuildingBlockContextMenu.cs
+++ b/src/PKSim.Presentation/Presenters/ContextMenus/BuildingBlockContextMenu.cs
@@ -3,6 +3,7 @@
using OSPSuite.Presentation.Core;
using OSPSuite.Presentation.MenuAndBars;
using OSPSuite.Presentation.Presenters.ContextMenus;
+using OSPSuite.Utility.Container;
using PKSim.Assets;
using PKSim.Core.Model;
using PKSim.Presentation.UICommands;
@@ -11,8 +12,8 @@ namespace PKSim.Presentation.Presenters.ContextMenus
{
public abstract class BuildingBlockContextMenu : ContextMenu where TBuildingBlock : class, IPKSimBuildingBlock
{
- protected BuildingBlockContextMenu(TBuildingBlock buildingBlock)
- : base(buildingBlock)
+ protected BuildingBlockContextMenu(TBuildingBlock buildingBlock, IContainer container)
+ : base(buildingBlock, container)
{
}
@@ -74,45 +75,45 @@ protected IEnumerable EditContextMenusFor(TBuildingBlock
protected IMenuBarItem RenameMenuFor(TBuildingBlock buildingBlock)
{
return CreateMenuButton.WithCaption(PKSimConstants.MenuNames.Rename)
- .WithCommandFor(buildingBlock)
+ .WithCommandFor(buildingBlock, _container)
.WithIcon(ApplicationIcons.Rename);
}
protected IMenuBarItem EditMenuFor(TBuildingBlock buildingBlock) where TCommand : IEditBuildingBlockUICommand
{
- return GenericMenu.EditMenuFor(buildingBlock);
+ return GenericMenu.EditMenuFor(buildingBlock, _container);
}
protected IMenuBarItem DescriptionMenuFor(TBuildingBlock buildingBlock)
{
- return GenericMenu.EditDescriptionMenuFor(buildingBlock);
+ return GenericMenu.EditDescriptionMenuFor(buildingBlock, _container);
}
protected IMenuBarItem CloneMenuFor(TBuildingBlock buildingBlock)
{
return CreateMenuButton.WithCaption(PKSimConstants.MenuNames.Clone)
- .WithCommandFor, TBuildingBlock>(buildingBlock)
+ .WithCommandFor, TBuildingBlock>(buildingBlock, _container)
.WithIcon(ApplicationIcons.Clone);
}
protected IMenuBarItem DeleteMenuFor(TBuildingBlock buildingBlock)
{
return CreateMenuButton.WithCaption(PKSimConstants.MenuNames.Delete)
- .WithCommandFor(buildingBlock)
+ .WithCommandFor(buildingBlock, _container)
.WithIcon(ApplicationIcons.Delete);
}
protected IMenuBarItem SaveAsUserTemplateMenuFor(TBuildingBlock buildingBlock)
{
return CreateMenuButton.WithCaption(PKSimConstants.MenuNames.SaveAsTemplate)
- .WithCommandFor, IReadOnlyList>(new[] {buildingBlock,})
+ .WithCommandFor, IReadOnlyList>(new[] {buildingBlock,}, _container)
.WithIcon(ApplicationIcons.SaveAsTemplate);
}
protected IMenuBarItem SaveAsSystemTemplateMenuFor(TBuildingBlock buildingBlock)
{
return CreateMenuButton.WithCaption(PKSimConstants.MenuNames.SaveAsSystemTemplate)
- .WithCommandFor, IReadOnlyList>(new[] {buildingBlock,})
+ .WithCommandFor, IReadOnlyList>(new[] {buildingBlock,}, _container)
.WithIcon(ApplicationIcons.SaveAsTemplate)
.ForDeveloper();
}
@@ -120,14 +121,14 @@ protected IMenuBarItem SaveAsSystemTemplateMenuFor(TBuildingBlock buildingBlock)
protected IMenuBarItem ParameterValueDebugMenuFor(TBuildingBlock buildingBlock)
{
return CreateMenuButton.WithCaption(PKSimConstants.MenuNames.AsDeveloperOnly("Parameter Value Export"))
- .WithCommandFor(buildingBlock)
+ .WithCommandFor(buildingBlock, _container)
.ForDeveloper();
}
- protected IMenuBarItem AddToJournalMenuFor(TBuildingBlock buildingBlock) => GenericMenu.AddToJournal(buildingBlock);
+ protected IMenuBarItem AddToJournalMenuFor(TBuildingBlock buildingBlock) => GenericMenu.AddToJournal(buildingBlock, _container);
- protected IMenuBarItem ExportSnapshotMenuFor(TBuildingBlock buildingBlock) => GenericMenu.ExportSnapshotMenuFor(buildingBlock);
+ protected IMenuBarItem ExportSnapshotMenuFor(TBuildingBlock buildingBlock) => GenericMenu.ExportSnapshotMenuFor(buildingBlock, _container);
- protected IMenuBarItem ExportMarkdownMenuFor(TBuildingBlock buildingBlock) => GenericMenu.ExportMarkdownMenuFor(buildingBlock);
+ protected IMenuBarItem ExportMarkdownMenuFor(TBuildingBlock buildingBlock) => GenericMenu.ExportMarkdownMenuFor(buildingBlock, _container);
}
}
\ No newline at end of file
diff --git a/src/PKSim.Presentation/Presenters/ContextMenus/BuildingBlockFolderContextMenu.cs b/src/PKSim.Presentation/Presenters/ContextMenus/BuildingBlockFolderContextMenu.cs
index 39894b26d..f92651142 100644
--- a/src/PKSim.Presentation/Presenters/ContextMenus/BuildingBlockFolderContextMenu.cs
+++ b/src/PKSim.Presentation/Presenters/ContextMenus/BuildingBlockFolderContextMenu.cs
@@ -2,6 +2,7 @@
using OSPSuite.Presentation.Core;
using OSPSuite.Presentation.Presenters.ContextMenus;
using OSPSuite.Presentation.Repositories;
+using OSPSuite.Utility.Container;
using OSPSuite.Utility.Extensions;
using PKSim.Core.Model;
using PKSim.Core.Repositories;
@@ -10,11 +11,11 @@ namespace PKSim.Presentation.Presenters.ContextMenus
{
public abstract class BuildingBlockFolderContextMenu : ContextMenu where TBuildingBlock : class, IPKSimBuildingBlock
{
- protected BuildingBlockFolderContextMenu(IMenuBarItemRepository repository, IBuildingBlockRepository buildingBlockRepository, params MenuBarItemId[] staticMenus)
+ protected BuildingBlockFolderContextMenu(IMenuBarItemRepository repository, IBuildingBlockRepository buildingBlockRepository, IContainer container, params MenuBarItemId[] staticMenus) : base(container)
{
staticMenus.Each(menu => _view.AddMenuItem(repository[menu]));
- _view.AddMenuItem(GenericMenu.LoadBuildingBlockFromSnapshot());
+ _view.AddMenuItem(GenericMenu.LoadBuildingBlockFromSnapshot(container));
var allBuildingBlocks = buildingBlockRepository.All();
if (!allBuildingBlocks.Any())
diff --git a/src/PKSim.Presentation/Presenters/ContextMenus/ComparisonFolderTreeNodeContextMenu.cs b/src/PKSim.Presentation/Presenters/ContextMenus/ComparisonFolderTreeNodeContextMenu.cs
index 4f8067dec..c6c206387 100644
--- a/src/PKSim.Presentation/Presenters/ContextMenus/ComparisonFolderTreeNodeContextMenu.cs
+++ b/src/PKSim.Presentation/Presenters/ContextMenus/ComparisonFolderTreeNodeContextMenu.cs
@@ -7,12 +7,13 @@
using OSPSuite.Presentation.Presenters.ContextMenus;
using OSPSuite.Presentation.Presenters.Nodes;
using OSPSuite.Presentation.Repositories;
+using OSPSuite.Utility.Container;
namespace PKSim.Presentation.Presenters.ContextMenus
{
public class ComparisonFolderTreeNodeContextMenu : ContextMenu
{
- public ComparisonFolderTreeNodeContextMenu(ITreeNode treeNode, ISimulationExplorerPresenter presenter)
+ public ComparisonFolderTreeNodeContextMenu(ITreeNode treeNode, ISimulationExplorerPresenter presenter, IContainer container) : base(container)
{
_view.AddMenuItem(ClassificationCommonContextMenuItems.CreateClassificationUnderMenu(treeNode, presenter));
_view.AddMenuItem(ClassificationCommonContextMenuItems.RemoveClassificationFolderMainMenu(treeNode, presenter).AsGroupStarter());
@@ -21,14 +22,17 @@ public ComparisonFolderTreeNodeContextMenu(ITreeNode treeNode, ISi
public class ComparisonFolderTreeNodeContextMenuFactory : RootNodeContextMenuFactory
{
- public ComparisonFolderTreeNodeContextMenuFactory(IMenuBarItemRepository repository)
- : base(RootNodeTypes.ComparisonFolder, repository)
+ private readonly IContainer _container;
+
+ public ComparisonFolderTreeNodeContextMenuFactory(IMenuBarItemRepository repository, IContainer container)
+ : base(RootNodeTypes.ComparisonFolder, repository)
{
+ _container = container;
}
public override IContextMenu CreateFor(ITreeNode treeNode, IPresenterWithContextMenu presenter)
{
- return new ComparisonFolderTreeNodeContextMenu(treeNode, presenter.DowncastTo());
+ return new ComparisonFolderTreeNodeContextMenu(treeNode, presenter.DowncastTo(), _container);
}
}
}
\ No newline at end of file
diff --git a/src/PKSim.Presentation/Presenters/ContextMenus/CompoundContextMenu.cs b/src/PKSim.Presentation/Presenters/ContextMenus/CompoundContextMenu.cs
index 10a76a0e3..5288a4a73 100644
--- a/src/PKSim.Presentation/Presenters/ContextMenus/CompoundContextMenu.cs
+++ b/src/PKSim.Presentation/Presenters/ContextMenus/CompoundContextMenu.cs
@@ -5,6 +5,7 @@
using OSPSuite.Presentation.Nodes;
using OSPSuite.Presentation.Presenters;
using OSPSuite.Presentation.Presenters.ContextMenus;
+using OSPSuite.Utility.Container;
using PKSim.Assets;
using PKSim.Core.Model;
using PKSim.Presentation.UICommands;
@@ -13,8 +14,8 @@ namespace PKSim.Presentation.Presenters.ContextMenus
{
public class CompoundContextMenu : BuildingBlockContextMenu
{
- public CompoundContextMenu(Compound compound)
- : base(compound)
+ public CompoundContextMenu(Compound compound, IContainer container)
+ : base(compound, container)
{
}
@@ -27,19 +28,26 @@ protected override IEnumerable AllMenuItemsFor(Compound compound)
return allMenuItems;
}
- private static IMenuBarButton addObservedDataMenuFor(Compound compound)
+ private IMenuBarButton addObservedDataMenuFor(Compound compound)
{
return CreateMenuButton.WithCaption(PKSimConstants.MenuNames.AddObservedData)
- .WithCommandFor(compound)
+ .WithCommandFor(compound, _container)
.WithIcon(ApplicationIcons.ObservedData);
}
}
public class CompoundTreeNodeContextMenuFactory : NodeContextMenuFactory
{
+ private readonly IContainer _container;
+
+ public CompoundTreeNodeContextMenuFactory(IContainer container)
+ {
+ _container = container;
+ }
+
public override IContextMenu CreateFor(Compound compound, IPresenterWithContextMenu presenter)
{
- return new CompoundContextMenu(compound);
+ return new CompoundContextMenu(compound, _container);
}
}
}
\ No newline at end of file
diff --git a/src/PKSim.Presentation/Presenters/ContextMenus/CompoundFolderContextMenu.cs b/src/PKSim.Presentation/Presenters/ContextMenus/CompoundFolderContextMenu.cs
index a9096b088..6cdacc053 100644
--- a/src/PKSim.Presentation/Presenters/ContextMenus/CompoundFolderContextMenu.cs
+++ b/src/PKSim.Presentation/Presenters/ContextMenus/CompoundFolderContextMenu.cs
@@ -7,13 +7,14 @@
using OSPSuite.Presentation.Presenters.ContextMenus;
using OSPSuite.Presentation.Presenters.Nodes;
using OSPSuite.Presentation.Repositories;
+using OSPSuite.Utility.Container;
namespace PKSim.Presentation.Presenters.ContextMenus
{
public class CompoundFolderContextMenu : BuildingBlockFolderContextMenu
{
- public CompoundFolderContextMenu(IMenuBarItemRepository repository, IBuildingBlockRepository buildingBlockRepository)
- : base(repository, buildingBlockRepository, MenuBarItemIds.NewCompound, MenuBarItemIds.LoadCompound)
+ public CompoundFolderContextMenu(IMenuBarItemRepository repository, IBuildingBlockRepository buildingBlockRepository, IContainer container)
+ : base(repository, buildingBlockRepository, container, MenuBarItemIds.NewCompound, MenuBarItemIds.LoadCompound)
{
}
}
@@ -21,16 +22,18 @@ public CompoundFolderContextMenu(IMenuBarItemRepository repository, IBuildingBlo
public class CompoundFolderTreeNodeContextMenuFactory : RootNodeContextMenuFactory
{
private readonly IBuildingBlockRepository _buildingBlockRepository;
+ private readonly IContainer _container;
- public CompoundFolderTreeNodeContextMenuFactory(IMenuBarItemRepository repository, IBuildingBlockRepository buildingBlockRepository)
+ public CompoundFolderTreeNodeContextMenuFactory(IMenuBarItemRepository repository, IBuildingBlockRepository buildingBlockRepository, IContainer container)
: base(PKSimRootNodeTypes.CompoundFolder, repository)
{
_buildingBlockRepository = buildingBlockRepository;
+ _container = container;
}
public override IContextMenu CreateFor(ITreeNode treeNode, IPresenterWithContextMenu presenter)
{
- return new CompoundFolderContextMenu(_repository, _buildingBlockRepository);
+ return new CompoundFolderContextMenu(_repository, _buildingBlockRepository, _container);
}
}
}
\ No newline at end of file
diff --git a/src/PKSim.Presentation/Presenters/ContextMenus/CompoundProcessContextMenu.cs b/src/PKSim.Presentation/Presenters/ContextMenus/CompoundProcessContextMenu.cs
index 2ff2ce4f5..b5ffcd08f 100644
--- a/src/PKSim.Presentation/Presenters/ContextMenus/CompoundProcessContextMenu.cs
+++ b/src/PKSim.Presentation/Presenters/ContextMenus/CompoundProcessContextMenu.cs
@@ -8,13 +8,14 @@
using OSPSuite.Presentation.Core;
using OSPSuite.Presentation.Presenters;
using OSPSuite.Presentation.Presenters.ContextMenus;
+using OSPSuite.Utility.Container;
namespace PKSim.Presentation.Presenters.ContextMenus
{
public abstract class CompoundProcessContextMenu : ContextMenu where TCompoundProcess : PKSim.Core.Model.CompoundProcess
{
- protected CompoundProcessContextMenu(TCompoundProcess compoundProcess, ICompoundProcessesPresenter presenter)
- : base(compoundProcess, presenter)
+ protected CompoundProcessContextMenu(TCompoundProcess compoundProcess, ICompoundProcessesPresenter presenter, IContainer container)
+ : base(compoundProcess, presenter, container)
{
}
diff --git a/src/PKSim.Presentation/Presenters/ContextMenus/EnzymaticStabilityProcessFolderContextMenu.cs b/src/PKSim.Presentation/Presenters/ContextMenus/EnzymaticStabilityProcessFolderContextMenu.cs
index 8520195e1..3a1d06f91 100644
--- a/src/PKSim.Presentation/Presenters/ContextMenus/EnzymaticStabilityProcessFolderContextMenu.cs
+++ b/src/PKSim.Presentation/Presenters/ContextMenus/EnzymaticStabilityProcessFolderContextMenu.cs
@@ -9,13 +9,14 @@
using OSPSuite.Presentation.Presenters.ContextMenus;
using OSPSuite.Presentation.Presenters.Nodes;
using OSPSuite.Presentation.Repositories;
+using OSPSuite.Utility.Container;
namespace PKSim.Presentation.Presenters.ContextMenus
{
public class EnzymaticStabilityProcessFolderContextMenu : ContextMenu
{
- public EnzymaticStabilityProcessFolderContextMenu(ITreeNode nodeRequestingContextMenu, ICompoundProcessesPresenter presenter)
- : base(nodeRequestingContextMenu, presenter)
+ public EnzymaticStabilityProcessFolderContextMenu(ITreeNode nodeRequestingContextMenu, ICompoundProcessesPresenter presenter, IContainer container)
+ : base(nodeRequestingContextMenu, presenter, container)
{
}
@@ -30,13 +31,16 @@ protected override IEnumerable AllMenuItemsFor(ITreeNode nodeReque
public class EnzymaticStabilityProcessFolderTreeNodeContextMenuFactory : CompoundProcessFolderTreeNodeContextMenuFactory
{
- public EnzymaticStabilityProcessFolderTreeNodeContextMenuFactory(IMenuBarItemRepository repository) : base(PKSimRootNodeTypes.CompoundMetabolizingEnzymes, repository)
+ private readonly IContainer _container;
+
+ public EnzymaticStabilityProcessFolderTreeNodeContextMenuFactory(IMenuBarItemRepository repository, IContainer container) : base(PKSimRootNodeTypes.CompoundMetabolizingEnzymes, repository)
{
+ _container = container;
}
protected override IContextMenu CreateFor(ITreeNode treeNode, ICompoundProcessesPresenter presenter)
{
- return new EnzymaticStabilityProcessFolderContextMenu(treeNode, presenter);
+ return new EnzymaticStabilityProcessFolderContextMenu(treeNode, presenter, _container);
}
}
}
\ No newline at end of file
diff --git a/src/PKSim.Presentation/Presenters/ContextMenus/EventContextMenu.cs b/src/PKSim.Presentation/Presenters/ContextMenus/EventContextMenu.cs
index 794a9f3d9..5b50e00ed 100644
--- a/src/PKSim.Presentation/Presenters/ContextMenus/EventContextMenu.cs
+++ b/src/PKSim.Presentation/Presenters/ContextMenus/EventContextMenu.cs
@@ -3,6 +3,7 @@
using OSPSuite.Presentation.Nodes;
using OSPSuite.Presentation.Presenters;
using OSPSuite.Presentation.Presenters.ContextMenus;
+using OSPSuite.Utility.Container;
using PKSim.Core.Model;
using PKSim.Presentation.UICommands;
@@ -10,8 +11,8 @@ namespace PKSim.Presentation.Presenters.ContextMenus
{
public class EventContextMenu : BuildingBlockContextMenu
{
- public EventContextMenu(PKSimEvent pkSimEvent)
- : base(pkSimEvent)
+ public EventContextMenu(PKSimEvent pkSimEvent, IContainer container)
+ : base(pkSimEvent, container)
{
}
@@ -23,9 +24,16 @@ protected override IEnumerable AllMenuItemsFor(PKSimEvent pkSimEve
public class EventTreeNodeContextMenuFactory : NodeContextMenuFactory
{
+ private readonly IContainer _container;
+
+ public EventTreeNodeContextMenuFactory(IContainer container)
+ {
+ _container = container;
+ }
+
public override IContextMenu CreateFor(PKSimEvent pkSimEvent, IPresenterWithContextMenu presenter)
{
- return new EventContextMenu(pkSimEvent);
+ return new EventContextMenu(pkSimEvent, _container);
}
}
}
\ No newline at end of file
diff --git a/src/PKSim.Presentation/Presenters/ContextMenus/EventFolderContextMenu.cs b/src/PKSim.Presentation/Presenters/ContextMenus/EventFolderContextMenu.cs
index 1a9693c3b..b44be1789 100644
--- a/src/PKSim.Presentation/Presenters/ContextMenus/EventFolderContextMenu.cs
+++ b/src/PKSim.Presentation/Presenters/ContextMenus/EventFolderContextMenu.cs
@@ -7,13 +7,14 @@
using OSPSuite.Presentation.Presenters.ContextMenus;
using OSPSuite.Presentation.Presenters.Nodes;
using OSPSuite.Presentation.Repositories;
+using OSPSuite.Utility.Container;
namespace PKSim.Presentation.Presenters.ContextMenus
{
public class EventFolderContextMenu : BuildingBlockFolderContextMenu
{
- public EventFolderContextMenu(IMenuBarItemRepository repository, IBuildingBlockRepository buildingBlockRepository)
- : base(repository, buildingBlockRepository, MenuBarItemIds.NewEvent, MenuBarItemIds.LoadEvent)
+ public EventFolderContextMenu(IMenuBarItemRepository repository, IBuildingBlockRepository buildingBlockRepository, IContainer container)
+ : base(repository, buildingBlockRepository, container, MenuBarItemIds.NewEvent, MenuBarItemIds.LoadEvent)
{
}
}
@@ -21,16 +22,18 @@ public EventFolderContextMenu(IMenuBarItemRepository repository, IBuildingBlockR
public class EventFolderTreeNodeContextMenuFactory : RootNodeContextMenuFactory
{
private readonly IBuildingBlockRepository _buildingBlockRepository;
+ private readonly IContainer _container;
- public EventFolderTreeNodeContextMenuFactory(IMenuBarItemRepository repository, IBuildingBlockRepository buildingBlockRepository)
+ public EventFolderTreeNodeContextMenuFactory(IMenuBarItemRepository repository, IBuildingBlockRepository buildingBlockRepository, IContainer container)
: base(PKSimRootNodeTypes.EventFolder, repository)
{
_buildingBlockRepository = buildingBlockRepository;
+ _container = container;
}
public override IContextMenu CreateFor(ITreeNode treeNode, IPresenterWithContextMenu presenter)
{
- return new EventFolderContextMenu(_repository, _buildingBlockRepository);
+ return new EventFolderContextMenu(_repository, _buildingBlockRepository, _container);
}
}
}
\ No newline at end of file
diff --git a/src/PKSim.Presentation/Presenters/ContextMenus/ExpressionProfileContextMenu.cs b/src/PKSim.Presentation/Presenters/ContextMenus/ExpressionProfileContextMenu.cs
index cba56e97c..190217bd0 100644
--- a/src/PKSim.Presentation/Presenters/ContextMenus/ExpressionProfileContextMenu.cs
+++ b/src/PKSim.Presentation/Presenters/ContextMenus/ExpressionProfileContextMenu.cs
@@ -5,6 +5,7 @@
using OSPSuite.Presentation.Nodes;
using OSPSuite.Presentation.Presenters;
using OSPSuite.Presentation.Presenters.ContextMenus;
+using OSPSuite.Utility.Container;
using PKSim.Assets;
using PKSim.Core.Model;
using PKSim.Presentation.UICommands;
@@ -13,7 +14,7 @@ namespace PKSim.Presentation.Presenters.ContextMenus
{
public class ExpressionProfileContextMenu : BuildingBlockContextMenu
{
- public ExpressionProfileContextMenu(ExpressionProfile expressionProfile) : base(expressionProfile)
+ public ExpressionProfileContextMenu(ExpressionProfile expressionProfile, IContainer container) : base(expressionProfile, container)
{
}
@@ -42,16 +43,23 @@ private IEnumerable extendedExportMenus(ExpressionProfile expressi
private IMenuBarItem ExportToPkml(ExpressionProfile expressionProfile)
{
return CreateMenuButton.WithCaption(PKSimConstants.MenuNames.ExportToPKML)
- .WithCommandFor(expressionProfile)
+ .WithCommandFor(expressionProfile, _container)
.WithIcon(ApplicationIcons.PKMLSave);
}
}
public class ExpressionProfileTreeNodeContextMenuFactory : NodeContextMenuFactory
{
+ private readonly IContainer _container;
+
+ public ExpressionProfileTreeNodeContextMenuFactory(IContainer container)
+ {
+ _container = container;
+ }
+
public override IContextMenu CreateFor(ExpressionProfile expressionProfile, IPresenterWithContextMenu presenter)
{
- return new ExpressionProfileContextMenu(expressionProfile);
+ return new ExpressionProfileContextMenu(expressionProfile, _container);
}
}
}
\ No newline at end of file
diff --git a/src/PKSim.Presentation/Presenters/ContextMenus/ExpressionProfileFolderContextMenu.cs b/src/PKSim.Presentation/Presenters/ContextMenus/ExpressionProfileFolderContextMenu.cs
index f67d160ce..33d29f098 100644
--- a/src/PKSim.Presentation/Presenters/ContextMenus/ExpressionProfileFolderContextMenu.cs
+++ b/src/PKSim.Presentation/Presenters/ContextMenus/ExpressionProfileFolderContextMenu.cs
@@ -3,6 +3,7 @@
using OSPSuite.Presentation.Presenters.ContextMenus;
using OSPSuite.Presentation.Presenters.Nodes;
using OSPSuite.Presentation.Repositories;
+using OSPSuite.Utility.Container;
using PKSim.Core.Model;
using PKSim.Core.Repositories;
using PKSim.Presentation.Core;
@@ -12,8 +13,8 @@ namespace PKSim.Presentation.Presenters.ContextMenus
{
public class ExpressionProfileFolderContextMenu : BuildingBlockFolderContextMenu
{
- public ExpressionProfileFolderContextMenu(IMenuBarItemRepository repository, IBuildingBlockRepository buildingBlockRepository)
- : base(repository, buildingBlockRepository, MenuBarItemIds.NewExpressionProfile, MenuBarItemIds.LoadExpressionProfile)
+ public ExpressionProfileFolderContextMenu(IMenuBarItemRepository repository, IBuildingBlockRepository buildingBlockRepository, IContainer container)
+ : base(repository, buildingBlockRepository, container, MenuBarItemIds.NewExpressionProfile, MenuBarItemIds.LoadExpressionProfile)
{
}
}
@@ -21,16 +22,18 @@ public ExpressionProfileFolderContextMenu(IMenuBarItemRepository repository, IBu
public class ExpressionProfileFolderTreeNodeContextMenuFactory : RootNodeContextMenuFactory
{
private readonly IBuildingBlockRepository _buildingBlockRepository;
+ private readonly IContainer _container;
- public ExpressionProfileFolderTreeNodeContextMenuFactory(IMenuBarItemRepository repository, IBuildingBlockRepository buildingBlockRepository)
+ public ExpressionProfileFolderTreeNodeContextMenuFactory(IMenuBarItemRepository repository, IBuildingBlockRepository buildingBlockRepository, IContainer container)
: base(PKSimRootNodeTypes.ExpressionProfileFolder, repository)
{
_buildingBlockRepository = buildingBlockRepository;
+ _container = container;
}
public override IContextMenu CreateFor(ITreeNode treeNode, IPresenterWithContextMenu presenter)
{
- return new ExpressionProfileFolderContextMenu(_repository, _buildingBlockRepository);
+ return new ExpressionProfileFolderContextMenu(_repository, _buildingBlockRepository, _container);
}
}
}
\ No newline at end of file
diff --git a/src/PKSim.Presentation/Presenters/ContextMenus/FormulationContextMenu.cs b/src/PKSim.Presentation/Presenters/ContextMenus/FormulationContextMenu.cs
index 6ce911da9..37f6a2277 100644
--- a/src/PKSim.Presentation/Presenters/ContextMenus/FormulationContextMenu.cs
+++ b/src/PKSim.Presentation/Presenters/ContextMenus/FormulationContextMenu.cs
@@ -5,12 +5,13 @@
using PKSim.Presentation.UICommands;
using OSPSuite.Presentation.Presenters;
using OSPSuite.Presentation.Presenters.ContextMenus;
+using OSPSuite.Utility.Container;
namespace PKSim.Presentation.Presenters.ContextMenus
{
public class FormulationContextMenu : BuildingBlockContextMenu
{
- public FormulationContextMenu(Formulation formulation) : base(formulation)
+ public FormulationContextMenu(Formulation formulation, IContainer container) : base(formulation, container)
{
}
@@ -22,9 +23,16 @@ protected override IEnumerable AllMenuItemsFor(Formulation formula
public class FormulationTreeNodeContextMenuFactory : NodeContextMenuFactory
{
+ private readonly IContainer _container;
+
+ public FormulationTreeNodeContextMenuFactory(IContainer container)
+ {
+ _container = container;
+ }
+
public override IContextMenu CreateFor(Formulation formulation, IPresenterWithContextMenu presenter)
{
- return new FormulationContextMenu(formulation);
+ return new FormulationContextMenu(formulation, _container);
}
}
}
\ No newline at end of file
diff --git a/src/PKSim.Presentation/Presenters/ContextMenus/FormulationFolderContextMenu.cs b/src/PKSim.Presentation/Presenters/ContextMenus/FormulationFolderContextMenu.cs
index e291e1396..daf4d030c 100644
--- a/src/PKSim.Presentation/Presenters/ContextMenus/FormulationFolderContextMenu.cs
+++ b/src/PKSim.Presentation/Presenters/ContextMenus/FormulationFolderContextMenu.cs
@@ -7,13 +7,14 @@
using OSPSuite.Presentation.Presenters.ContextMenus;
using OSPSuite.Presentation.Presenters.Nodes;
using OSPSuite.Presentation.Repositories;
+using OSPSuite.Utility.Container;
namespace PKSim.Presentation.Presenters.ContextMenus
{
public class FormulationFolderContextMenu : BuildingBlockFolderContextMenu
{
- public FormulationFolderContextMenu(IMenuBarItemRepository repository, IBuildingBlockRepository buildingBlockRepository)
- : base(repository, buildingBlockRepository, MenuBarItemIds.NewFormulation, MenuBarItemIds.LoadFormulationFromTemplate)
+ public FormulationFolderContextMenu(IMenuBarItemRepository repository, IBuildingBlockRepository buildingBlockRepository, IContainer container)
+ : base(repository, buildingBlockRepository, container, MenuBarItemIds.NewFormulation, MenuBarItemIds.LoadFormulationFromTemplate)
{
}
}
@@ -21,16 +22,18 @@ public FormulationFolderContextMenu(IMenuBarItemRepository repository, IBuilding
public class FormulationFolderTreeNodeContextMenuFactory : RootNodeContextMenuFactory
{
private readonly IBuildingBlockRepository _buildingBlockRepository;
+ private readonly IContainer _container;
- public FormulationFolderTreeNodeContextMenuFactory(IMenuBarItemRepository repository, IBuildingBlockRepository buildingBlockRepository)
+ public FormulationFolderTreeNodeContextMenuFactory(IMenuBarItemRepository repository, IBuildingBlockRepository buildingBlockRepository, IContainer container)
: base(PKSimRootNodeTypes.FormulationFolder, repository)
{
_buildingBlockRepository = buildingBlockRepository;
+ _container = container;
}
public override IContextMenu CreateFor(ITreeNode treeNode, IPresenterWithContextMenu presenter)
{
- return new FormulationFolderContextMenu(_repository, _buildingBlockRepository);
+ return new FormulationFolderContextMenu(_repository, _buildingBlockRepository, _container);
}
}
}
\ No newline at end of file
diff --git a/src/PKSim.Presentation/Presenters/ContextMenus/GenericMenu.cs b/src/PKSim.Presentation/Presenters/ContextMenus/GenericMenu.cs
index 4b2b00045..fe3b3df65 100644
--- a/src/PKSim.Presentation/Presenters/ContextMenus/GenericMenu.cs
+++ b/src/PKSim.Presentation/Presenters/ContextMenus/GenericMenu.cs
@@ -7,59 +7,61 @@
using OSPSuite.Presentation.UICommands;
using OSPSuite.Assets;
using PKSim.Core.Model;
+using IContainer = OSPSuite.Utility.Container.IContainer;
+using System.ComponentModel;
namespace PKSim.Presentation.Presenters.ContextMenus
{
public static class GenericMenu
{
- public static IMenuBarItem EditDescriptionMenuFor(T objectBase) where T : IObjectBase
+ public static IMenuBarItem EditDescriptionMenuFor(T objectBase, IContainer container) where T : IObjectBase
{
return CreateMenuButton.WithCaption(PKSimConstants.MenuNames.Description)
.WithIcon(ApplicationIcons.Description)
- .WithCommandFor(objectBase);
+ .WithCommandFor(objectBase, container);
}
- public static IMenuBarItem ExportSnapshotMenuFor(T objectToExport) where T : class, IObjectBase
+ public static IMenuBarItem ExportSnapshotMenuFor(T objectToExport, IContainer container) where T : class, IObjectBase
{
return CreateMenuButton.WithCaption(PKSimConstants.MenuNames.AsDeveloperOnly("Save Snapshot"))
- .WithCommandFor, T>(objectToExport)
+ .WithCommandFor, T>(objectToExport, container)
.WithIcon(ApplicationIcons.SnapshotExport)
.ForDeveloper();
}
- public static IMenuBarItem ExportMarkdownMenuFor(T objectToExport) where T : class, IObjectBase
+ public static IMenuBarItem ExportMarkdownMenuFor(T objectToExport, IContainer container) where T : class, IObjectBase
{
return CreateMenuButton.WithCaption(PKSimConstants.MenuNames.AsDeveloperOnly("Save Markdown"))
- .WithCommandFor, T>(objectToExport)
+ .WithCommandFor, T>(objectToExport, container)
// .WithIcon(ApplicationIcons.SnapshotExport)
.ForDeveloper();
}
- public static IMenuBarItem LoadBuildingBlockFromSnapshot() where T:class, IPKSimBuildingBlock
+ public static IMenuBarItem LoadBuildingBlockFromSnapshot(IContainer container) where T:class, IPKSimBuildingBlock
{
return CreateMenuButton.WithCaption(PKSimConstants.MenuNames.AsDeveloperOnly("Load from Snapshot"))
- .WithCommand>()
+ .WithCommand>(container)
.WithIcon(ApplicationIcons.SnapshotImport)
.ForDeveloper();
}
- public static IMenuBarItem EditMenuFor(T objectToEdit) where T : class where TCommand : IObjectUICommand
+ public static IMenuBarItem EditMenuFor(T objectToEdit, IContainer container) where T : class where TCommand : IObjectUICommand
{
return CreateMenuButton.WithCaption(MenuNames.Edit)
- .WithCommandFor(objectToEdit)
+ .WithCommandFor(objectToEdit, container)
.WithIcon(ApplicationIcons.Edit);
}
- public static IMenuBarItem AddToJournal(T objectBase) where T : IObjectBase
+ public static IMenuBarItem AddToJournal(T objectBase, IContainer container) where T : IObjectBase
{
- return ObjectBaseCommonContextMenuItems.AddToJournal(objectBase);
+ return ObjectBaseCommonContextMenuItems.AddToJournal(objectBase, container);
}
- public static IMenuBarItem RenameMenuFor(T objectToRename) where T : IWithName
+ public static IMenuBarItem RenameMenuFor(T objectToRename, IContainer container) where T : IWithName
{
return CreateMenuButton.WithCaption(PKSimConstants.MenuNames.Rename)
- .WithCommandFor(objectToRename)
+ .WithCommandFor(objectToRename, container)
.WithIcon(ApplicationIcons.Rename);
}
}
diff --git a/src/PKSim.Presentation/Presenters/ContextMenus/ImportPopulationContextMenu.cs b/src/PKSim.Presentation/Presenters/ContextMenus/ImportPopulationContextMenu.cs
index 4457fe8b6..634b8fcbe 100644
--- a/src/PKSim.Presentation/Presenters/ContextMenus/ImportPopulationContextMenu.cs
+++ b/src/PKSim.Presentation/Presenters/ContextMenus/ImportPopulationContextMenu.cs
@@ -2,22 +2,30 @@
using PKSim.Core.Model;
using OSPSuite.Presentation.Presenters;
using OSPSuite.Presentation.Presenters.ContextMenus;
+using OSPSuite.Utility.Container;
namespace PKSim.Presentation.Presenters.ContextMenus
{
public class ImportPopulationContextMenu : PopulationContextMenu
{
- public ImportPopulationContextMenu(ImportPopulation randomPopulation)
- : base(randomPopulation)
+ public ImportPopulationContextMenu(ImportPopulation randomPopulation, IContainer container)
+ : base(randomPopulation, container)
{
}
}
public class ImportPopulationTreeNodeContextMenuFactory : NodeContextMenuFactory
{
+ private readonly IContainer _container;
+
+ public ImportPopulationTreeNodeContextMenuFactory(IContainer container)
+ {
+ _container = container;
+ }
+
public override IContextMenu CreateFor(ImportPopulation importPopulation, IPresenterWithContextMenu presenter)
{
- return new ImportPopulationContextMenu(importPopulation);
+ return new ImportPopulationContextMenu(importPopulation, _container);
}
}
}
\ No newline at end of file
diff --git a/src/PKSim.Presentation/Presenters/ContextMenus/IndividualContextMenu.cs b/src/PKSim.Presentation/Presenters/ContextMenus/IndividualContextMenu.cs
index fce821b30..68a2db978 100644
--- a/src/PKSim.Presentation/Presenters/ContextMenus/IndividualContextMenu.cs
+++ b/src/PKSim.Presentation/Presenters/ContextMenus/IndividualContextMenu.cs
@@ -6,6 +6,7 @@
using OSPSuite.Presentation.Nodes;
using OSPSuite.Presentation.Presenters;
using OSPSuite.Presentation.Presenters.ContextMenus;
+using OSPSuite.Utility.Container;
using PKSim.Assets;
using PKSim.Core.Model;
using PKSim.Presentation.UICommands;
@@ -14,7 +15,7 @@ namespace PKSim.Presentation.Presenters.ContextMenus
{
public class IndividualContextMenu : BuildingBlockContextMenu
{
- public IndividualContextMenu(Individual individual) : base(individual)
+ public IndividualContextMenu(Individual individual, IContainer container) : base(individual, container)
{
}
@@ -40,31 +41,38 @@ protected override IEnumerable AllMenuItemsFor(Individual individu
private IMenuBarItem exportToPkml(Individual individual)
{
return CreateMenuButton.WithCaption(PKSimConstants.MenuNames.ExportToPKML)
- .WithCommandFor(individual)
+ .WithCommandFor(individual, _container)
.WithIcon(ApplicationIcons.PKMLSave);
}
- private static IMenuBarButton newPopulationMenuFor(Individual individual)
+ private IMenuBarButton newPopulationMenuFor(Individual individual)
{
return CreateMenuButton.WithCaption(PKSimConstants.MenuNames.NewPopulation)
.WithIcon(ApplicationIcons.Population)
- .WithCommandFor(individual);
+ .WithCommandFor(individual, _container);
}
- private static IMenuBarButton scaleIndividualMenuFor(Individual individual)
+ private IMenuBarButton scaleIndividualMenuFor(Individual individual)
{
return CreateMenuButton.WithCaption(PKSimConstants.MenuNames.Scale)
.WithIcon(ApplicationIcons.ScaleIndividual)
- .WithCommandFor(individual)
+ .WithCommandFor(individual, _container)
.AsGroupStarter();
}
}
public class IndividualTreeNodeContextMenuFactory : NodeContextMenuFactory
{
+ private readonly IContainer _container;
+
+ public IndividualTreeNodeContextMenuFactory(IContainer container)
+ {
+ _container = container;
+ }
+
public override IContextMenu CreateFor(Individual individual, IPresenterWithContextMenu presenter)
{
- return new IndividualContextMenu(individual);
+ return new IndividualContextMenu(individual, _container);
}
}
}
\ No newline at end of file
diff --git a/src/PKSim.Presentation/Presenters/ContextMenus/IndividualFolderContextMenu.cs b/src/PKSim.Presentation/Presenters/ContextMenus/IndividualFolderContextMenu.cs
index 9b11c94fd..174283db7 100644
--- a/src/PKSim.Presentation/Presenters/ContextMenus/IndividualFolderContextMenu.cs
+++ b/src/PKSim.Presentation/Presenters/ContextMenus/IndividualFolderContextMenu.cs
@@ -7,13 +7,14 @@
using OSPSuite.Presentation.Presenters.ContextMenus;
using OSPSuite.Presentation.Presenters.Nodes;
using OSPSuite.Presentation.Repositories;
+using OSPSuite.Utility.Container;
namespace PKSim.Presentation.Presenters.ContextMenus
{
public class IndividualFolderContextMenu : BuildingBlockFolderContextMenu
{
- public IndividualFolderContextMenu(IMenuBarItemRepository repository, IBuildingBlockRepository buildingBlockRepository)
- : base(repository, buildingBlockRepository, MenuBarItemIds.NewIndividual, MenuBarItemIds.LoadIndividual)
+ public IndividualFolderContextMenu(IMenuBarItemRepository repository, IBuildingBlockRepository buildingBlockRepository, IContainer container)
+ : base(repository, buildingBlockRepository, container, MenuBarItemIds.NewIndividual, MenuBarItemIds.LoadIndividual)
{
}
}
@@ -21,16 +22,18 @@ public IndividualFolderContextMenu(IMenuBarItemRepository repository, IBuildingB
public class IndividualFolderTreeNodeContextMenuFactory : RootNodeContextMenuFactory
{
private readonly IBuildingBlockRepository _buildingBlockRepository;
+ private readonly IContainer _container;
- public IndividualFolderTreeNodeContextMenuFactory(IMenuBarItemRepository repository, IBuildingBlockRepository buildingBlockRepository)
+ public IndividualFolderTreeNodeContextMenuFactory(IMenuBarItemRepository repository, IBuildingBlockRepository buildingBlockRepository, IContainer container)
: base(PKSimRootNodeTypes.IndividualFolder, repository)
{
_buildingBlockRepository = buildingBlockRepository;
+ _container = container;
}
public override IContextMenu CreateFor(ITreeNode treeNode, IPresenterWithContextMenu presenter)
{
- return new IndividualFolderContextMenu(_repository, _buildingBlockRepository);
+ return new IndividualFolderContextMenu(_repository, _buildingBlockRepository, _container);
}
}
}
\ No newline at end of file
diff --git a/src/PKSim.Presentation/Presenters/ContextMenus/IndividualMoleculeContextMenu.cs b/src/PKSim.Presentation/Presenters/ContextMenus/IndividualMoleculeContextMenu.cs
index 5cf228134..5f5231f01 100644
--- a/src/PKSim.Presentation/Presenters/ContextMenus/IndividualMoleculeContextMenu.cs
+++ b/src/PKSim.Presentation/Presenters/ContextMenus/IndividualMoleculeContextMenu.cs
@@ -9,13 +9,14 @@
using OSPSuite.Presentation.Presenters;
using OSPSuite.Presentation.Presenters.ContextMenus;
using OSPSuite.Assets;
+using OSPSuite.Utility.Container;
namespace PKSim.Presentation.Presenters.ContextMenus
{
public class IndividualMoleculeContextMenu : ContextMenu
{
- public IndividualMoleculeContextMenu(IndividualMolecule molecule, IMoleculesPresenter moleculesPresenter)
- : base(molecule, moleculesPresenter)
+ public IndividualMoleculeContextMenu(IndividualMolecule molecule, IMoleculesPresenter moleculesPresenter, IContainer container)
+ : base(molecule, moleculesPresenter, container)
{
}
@@ -31,6 +32,13 @@ protected override IEnumerable AllMenuItemsFor(IndividualMolecule
public class IndividualMoleculeTreeNodeContextMenuFactory : NodeContextMenuFactory
{
+ private readonly IContainer _container;
+
+ public IndividualMoleculeTreeNodeContextMenuFactory(IContainer container)
+ {
+ _container = container;
+ }
+
public override bool IsSatisfiedBy(ITreeNode treeNode, IPresenterWithContextMenu presenter)
{
return base.IsSatisfiedBy(treeNode, presenter) && presenter.IsAnImplementationOf();
@@ -38,7 +46,7 @@ public override bool IsSatisfiedBy(ITreeNode treeNode, IPresenterWithContextMenu
public override IContextMenu CreateFor(IndividualMolecule individualMolecule, IPresenterWithContextMenu presenter)
{
- return new IndividualMoleculeContextMenu(individualMolecule, presenter.DowncastTo());
+ return new IndividualMoleculeContextMenu(individualMolecule, presenter.DowncastTo(), _container);
}
}
}
\ No newline at end of file
diff --git a/src/PKSim.Presentation/Presenters/ContextMenus/IndividualMoleculesContextMenu.cs b/src/PKSim.Presentation/Presenters/ContextMenus/IndividualMoleculesContextMenu.cs
index dd8caa3c2..ed0e08629 100644
--- a/src/PKSim.Presentation/Presenters/ContextMenus/IndividualMoleculesContextMenu.cs
+++ b/src/PKSim.Presentation/Presenters/ContextMenus/IndividualMoleculesContextMenu.cs
@@ -12,6 +12,7 @@
using OSPSuite.Presentation.Presenters.ContextMenus;
using OSPSuite.Presentation.Presenters.Nodes;
using OSPSuite.Presentation.Repositories;
+using OSPSuite.Utility.Container;
namespace PKSim.Presentation.Presenters.ContextMenus
{
@@ -21,7 +22,7 @@ public abstract class IndividualMoleculesContextMenu : ContextMenu wh
private readonly string _addProteinCaption;
private readonly ApplicationIcon _addProteinIcon;
- protected IndividualMoleculesContextMenu(IMoleculesPresenter presenter, string addProteinCaption, ApplicationIcon addProteinIcon)
+ protected IndividualMoleculesContextMenu(IMoleculesPresenter presenter, string addProteinCaption, ApplicationIcon addProteinIcon, IContainer container) : base(container)
{
_addProteinCaption = addProteinCaption;
_addProteinIcon = addProteinIcon;
@@ -40,24 +41,24 @@ private IEnumerable allMenuItemsFor(IMoleculesPresenter presenter)
public class EnzymesContextMenu : IndividualMoleculesContextMenu
{
- public EnzymesContextMenu(IMoleculesPresenter presenter)
- : base(presenter, PKSimConstants.UI.AddMetabolizingEnzyme, ApplicationIcons.Enzyme)
+ public EnzymesContextMenu(IMoleculesPresenter presenter, IContainer container)
+ : base(presenter, PKSimConstants.UI.AddMetabolizingEnzyme, ApplicationIcons.Enzyme, container)
{
}
}
public class OtherProteinsContextMenu : IndividualMoleculesContextMenu
{
- public OtherProteinsContextMenu(IMoleculesPresenter presenter)
- : base(presenter, PKSimConstants.UI.AddSpecificBindingPartner, ApplicationIcons.Protein)
+ public OtherProteinsContextMenu(IMoleculesPresenter presenter, IContainer container)
+ : base(presenter, PKSimConstants.UI.AddSpecificBindingPartner, ApplicationIcons.Protein, container)
{
}
}
public class TransportersContextMenu : IndividualMoleculesContextMenu
{
- public TransportersContextMenu(IMoleculesPresenter presenter)
- : base(presenter, PKSimConstants.UI.AddTransportProtein, ApplicationIcons.Transporter)
+ public TransportersContextMenu(IMoleculesPresenter presenter, IContainer container)
+ : base(presenter, PKSimConstants.UI.AddTransportProtein, ApplicationIcons.Transporter, container)
{
}
}
@@ -84,37 +85,46 @@ public override IContextMenu CreateFor(ITreeNode treeNode, IPresen
public class EnzymesTreeNodeContextMenuFactory : IndividualMoleculesContextMenuContextMenuFactory
{
- public EnzymesTreeNodeContextMenuFactory(IMenuBarItemRepository repository) : base(PKSimRootNodeTypes.IndividualMetabolizingEnzymes, repository)
+ private readonly IContainer _container;
+
+ public EnzymesTreeNodeContextMenuFactory(IMenuBarItemRepository repository, IContainer container) : base(PKSimRootNodeTypes.IndividualMetabolizingEnzymes, repository)
{
+ _container = container;
}
public override IContextMenu CreateFor(RootNode proteinsNode, IMoleculesPresenter moleculesPresenter)
{
- return new EnzymesContextMenu(moleculesPresenter);
+ return new EnzymesContextMenu(moleculesPresenter, _container);
}
}
public class OtherProteinsContextMenuFactory : IndividualMoleculesContextMenuContextMenuFactory
{
- public OtherProteinsContextMenuFactory(IMenuBarItemRepository repository) : base(PKSimRootNodeTypes.IndividualProteinBindingPartners, repository)
+ private readonly IContainer _container;
+
+ public OtherProteinsContextMenuFactory(IMenuBarItemRepository repository, IContainer container) : base(PKSimRootNodeTypes.IndividualProteinBindingPartners, repository)
{
+ _container = container;
}
public override IContextMenu CreateFor(RootNode proteinsNode, IMoleculesPresenter presenter)
{
- return new OtherProteinsContextMenu(presenter);
+ return new OtherProteinsContextMenu(presenter, _container);
}
}
public class TransportersContextMenuFactory : IndividualMoleculesContextMenuContextMenuFactory
{
- public TransportersContextMenuFactory(IMenuBarItemRepository repository) : base(PKSimRootNodeTypes.IndividualTransportProteins, repository)
+ private readonly IContainer _container;
+
+ public TransportersContextMenuFactory(IMenuBarItemRepository repository, IContainer container) : base(PKSimRootNodeTypes.IndividualTransportProteins, repository)
{
+ _container = container;
}
public override IContextMenu CreateFor(RootNode proteinsNode, IMoleculesPresenter presenter)
{
- return new TransportersContextMenu(presenter);
+ return new TransportersContextMenu(presenter, _container);
}
}
}
\ No newline at end of file
diff --git a/src/PKSim.Presentation/Presenters/ContextMenus/IndividualSimulationContextMenu.cs b/src/PKSim.Presentation/Presenters/ContextMenus/IndividualSimulationContextMenu.cs
index ae5c17d5a..b6ff7e9a2 100644
--- a/src/PKSim.Presentation/Presenters/ContextMenus/IndividualSimulationContextMenu.cs
+++ b/src/PKSim.Presentation/Presenters/ContextMenus/IndividualSimulationContextMenu.cs
@@ -5,6 +5,7 @@
using OSPSuite.Presentation.Nodes;
using OSPSuite.Presentation.Presenters;
using OSPSuite.Presentation.Presenters.ContextMenus;
+using OSPSuite.Utility.Container;
using PKSim.Assets;
using PKSim.Core.Model;
using PKSim.Presentation.UICommands;
@@ -13,7 +14,7 @@ namespace PKSim.Presentation.Presenters.ContextMenus
{
public class IndividualSimulationContextMenu : SimulationContextMenu
{
- public IndividualSimulationContextMenu(IndividualSimulation individualSimulation) : base(individualSimulation)
+ public IndividualSimulationContextMenu(IndividualSimulation individualSimulation, IContainer container) : base(individualSimulation, container)
{
}
@@ -26,14 +27,14 @@ protected override IEnumerable ActionMenuItemsSpecificToType(Indiv
protected override IEnumerable ExportMenuItemsSpecificToType(IndividualSimulation individualSimulation)
{
var exportToExcel = CreateMenuButton.WithCaption(PKSimConstants.MenuNames.ExportSimulationResultsToExcel)
- .WithCommandFor(individualSimulation)
+ .WithCommandFor(individualSimulation, _container)
.WithIcon(ApplicationIcons.ExportToExcel);
exportToExcel.Enabled = simulationHasResult(individualSimulation);
yield return exportToExcel;
var exportToCSV = CreateMenuButton.WithCaption(PKSimConstants.MenuNames.ExportSimulationResultsToCSV)
- .WithCommandFor(individualSimulation)
+ .WithCommandFor(individualSimulation, _container)
.WithIcon(ApplicationIcons.ExportToCSV);
exportToCSV.Enabled = simulationHasResult(individualSimulation);
@@ -41,13 +42,13 @@ protected override IEnumerable ExportMenuItemsSpecificToType(Indiv
yield return CreateMenuButton.WithCaption(PKSimConstants.MenuNames.ExportSimulationModelToFile)
.WithIcon(ApplicationIcons.Report)
- .WithCommandFor(individualSimulation);
+ .WithCommandFor(individualSimulation, _container);
}
protected override IEnumerable DebugMenuFor(IndividualSimulation simulation)
{
yield return CreateMenuButton.WithCaption(MenuNames.ExportSimModelXml)
- .WithCommandFor(simulation)
+ .WithCommandFor(simulation, _container)
.AsGroupStarter()
.ForDeveloper();
@@ -56,19 +57,19 @@ protected override IEnumerable DebugMenuFor(IndividualSimulation s
yield return ExportODEForRMenuItem(simulation);
yield return CreateMenuButton.WithCaption(PKSimConstants.MenuNames.AsDeveloperOnly("Parameter Ids Export"))
- .WithCommandFor(simulation)
+ .WithCommandFor(simulation, _container)
.ForDeveloper();
yield return CreateMenuButton.WithCaption(PKSimConstants.MenuNames.AsDeveloperOnly("Simulation Serialization Xml Export"))
- .WithCommandFor(simulation)
+ .WithCommandFor(simulation, _container)
.ForDeveloper();
yield return CreateMenuButton.WithCaption(PKSimConstants.MenuNames.AsDeveloperOnly("Simulation Parameter Export To CSV"))
- .WithCommandFor(simulation)
+ .WithCommandFor(simulation, _container)
.ForDeveloper();
yield return CreateMenuButton.WithCaption(PKSimConstants.MenuNames.AsDeveloperOnly("Save Snapshot"))
- .WithCommandFor(simulation)
+ .WithCommandFor(simulation, _container)
.WithIcon(ApplicationIcons.SnapshotExport)
.ForDeveloper();
@@ -77,12 +78,12 @@ protected override IEnumerable DebugMenuFor(IndividualSimulation s
protected IMenuBarItem CreateParameterIdentificationMenuItemFor(IndividualSimulation simulation)
{
- return ParameterIdentificationContextMenuItems.CreateParameterIdentificationFor(new[] {simulation});
+ return ParameterIdentificationContextMenuItems.CreateParameterIdentificationFor(new[] {simulation}, _container);
}
protected IMenuBarItem CreateSensitivityAnalysisMenuItemFor(IndividualSimulation simulation)
{
- return SensitivityAnalysisContextMenuItems.CreateSensitivityAnalysisFor(simulation);
+ return SensitivityAnalysisContextMenuItems.CreateSensitivityAnalysisFor(simulation, _container);
}
private bool simulationHasResult(Simulation simulation)
@@ -96,9 +97,16 @@ private bool simulationHasResult(Simulation simulation)
public class IndividualSimulationTreeNodeContextMenuFactory : SimulationTreeNodeContextMenuFactory
{
+ private readonly IContainer _container;
+
+ public IndividualSimulationTreeNodeContextMenuFactory(IContainer container)
+ {
+ _container = container;
+ }
+
protected override IContextMenu CreateFor(IndividualSimulation simulation, IPresenterWithContextMenu presenter)
{
- return new IndividualSimulationContextMenu(simulation);
+ return new IndividualSimulationContextMenu(simulation, _container);
}
}
}
\ No newline at end of file
diff --git a/src/PKSim.Presentation/Presenters/ContextMenus/InductionProcessFolderContextMenu.cs b/src/PKSim.Presentation/Presenters/ContextMenus/InductionProcessFolderContextMenu.cs
index 73b3984d0..68aae2580 100644
--- a/src/PKSim.Presentation/Presenters/ContextMenus/InductionProcessFolderContextMenu.cs
+++ b/src/PKSim.Presentation/Presenters/ContextMenus/InductionProcessFolderContextMenu.cs
@@ -11,13 +11,14 @@
using OSPSuite.Presentation.Presenters.Nodes;
using OSPSuite.Presentation.Repositories;
using OSPSuite.Assets;
+using OSPSuite.Utility.Container;
namespace PKSim.Presentation.Presenters.ContextMenus
{
public class InductionProcessFolderContextMenu : ContextMenu
{
- public InductionProcessFolderContextMenu(ITreeNode nodeRequestingContextMenu, ICompoundProcessesPresenter context)
- : base(nodeRequestingContextMenu, context)
+ public InductionProcessFolderContextMenu(ITreeNode nodeRequestingContextMenu, ICompoundProcessesPresenter context, IContainer container)
+ : base(nodeRequestingContextMenu, context, container)
{
}
@@ -32,13 +33,16 @@ protected override IEnumerable AllMenuItemsFor(ITreeNode nodeReque
public class InductionProcessFolderTreeNodeContextMenuFactory : CompoundProcessFolderTreeNodeContextMenuFactory
{
- public InductionProcessFolderTreeNodeContextMenuFactory(IMenuBarItemRepository repository) : base(PKSimRootNodeTypes.InductionProcess, repository)
+ private readonly IContainer _container;
+
+ public InductionProcessFolderTreeNodeContextMenuFactory(IMenuBarItemRepository repository, IContainer container) : base(PKSimRootNodeTypes.InductionProcess, repository)
{
+ _container = container;
}
protected override IContextMenu CreateFor(ITreeNode treeNode, ICompoundProcessesPresenter presenter)
{
- return new InductionProcessFolderContextMenu(treeNode, presenter);
+ return new InductionProcessFolderContextMenu(treeNode, presenter, _container);
}
}
}
\ No newline at end of file
diff --git a/src/PKSim.Presentation/Presenters/ContextMenus/InhibitionProcessFolderContextMenu.cs b/src/PKSim.Presentation/Presenters/ContextMenus/InhibitionProcessFolderContextMenu.cs
index 87c75d65b..d341b8c6f 100644
--- a/src/PKSim.Presentation/Presenters/ContextMenus/InhibitionProcessFolderContextMenu.cs
+++ b/src/PKSim.Presentation/Presenters/ContextMenus/InhibitionProcessFolderContextMenu.cs
@@ -11,13 +11,14 @@
using OSPSuite.Presentation.Presenters.ContextMenus;
using OSPSuite.Presentation.Presenters.Nodes;
using OSPSuite.Presentation.Repositories;
+using OSPSuite.Utility.Container;
namespace PKSim.Presentation.Presenters.ContextMenus
{
public class InhibitionProcessFolderContextMenu : ContextMenu
{
- public InhibitionProcessFolderContextMenu(ITreeNode nodeRequestingContextMenu, ICompoundProcessesPresenter context)
- : base(nodeRequestingContextMenu, context)
+ public InhibitionProcessFolderContextMenu(ITreeNode nodeRequestingContextMenu, ICompoundProcessesPresenter context, IContainer container)
+ : base(nodeRequestingContextMenu, context, container)
{
}
@@ -32,14 +33,17 @@ protected override IEnumerable AllMenuItemsFor(ITreeNode nodeReque
public class InhibitionProcessFolderTreeNodeContextMenuFactory : CompoundProcessFolderTreeNodeContextMenuFactory
{
- public InhibitionProcessFolderTreeNodeContextMenuFactory(IMenuBarItemRepository repository)
+ private readonly IContainer _container;
+
+ public InhibitionProcessFolderTreeNodeContextMenuFactory(IMenuBarItemRepository repository, IContainer container)
: base(PKSimRootNodeTypes.InhibitionProcess, repository)
{
+ _container = container;
}
protected override IContextMenu CreateFor(ITreeNode treeNode, ICompoundProcessesPresenter presenter)
{
- return new InhibitionProcessFolderContextMenu(treeNode, presenter);
+ return new InhibitionProcessFolderContextMenu(treeNode, presenter, _container);
}
}
}
\ No newline at end of file
diff --git a/src/PKSim.Presentation/Presenters/ContextMenus/MdiChildViewContextMenu.cs b/src/PKSim.Presentation/Presenters/ContextMenus/MdiChildViewContextMenu.cs
index d533744a0..07f90fce0 100644
--- a/src/PKSim.Presentation/Presenters/ContextMenus/MdiChildViewContextMenu.cs
+++ b/src/PKSim.Presentation/Presenters/ContextMenus/MdiChildViewContextMenu.cs
@@ -8,12 +8,13 @@
using OSPSuite.Presentation.Presenters.ContextMenus;
using OSPSuite.Presentation.UICommands;
using OSPSuite.Presentation.Views;
+using OSPSuite.Utility.Container;
namespace PKSim.Presentation.Presenters.ContextMenus
{
public class MdiChildViewContextMenu : ContextMenu
{
- public MdiChildViewContextMenu(IMdiChildView view) : base(view)
+ public MdiChildViewContextMenu(IMdiChildView view, IContainer container) : base(view, container)
{
}
@@ -21,16 +22,16 @@ protected override IEnumerable AllMenuItemsFor(IMdiChildView view)
{
yield return CreateMenuButton.WithCaption(PKSimConstants.UI.CloseView)
.WithIcon(ApplicationIcons.Close)
- .WithCommandFor(view);
+ .WithCommandFor(view, _container);
yield return CreateMenuButton.WithCaption(PKSimConstants.UI.CloseAll)
- .WithCommand();
+ .WithCommand(_container);
yield return CreateMenuButton.WithCaption(PKSimConstants.UI.CloseAllButThis)
- .WithCommandFor(view);
+ .WithCommandFor(view, _container);
yield return CreateMenuButton.WithCaption(PKSimConstants.MenuNames.Rename)
- .WithCommandFor(view)
+ .WithCommandFor(view, _container)
.WithIcon(ApplicationIcons.Rename)
.AsGroupStarter();
}
@@ -38,9 +39,16 @@ protected override IEnumerable AllMenuItemsFor(IMdiChildView view)
public class MdiChildViewContextMenuFactory : IContextMenuSpecificationFactory
{
+ private readonly IContainer _container;
+
+ public MdiChildViewContextMenuFactory(IContainer container)
+ {
+ _container = container;
+ }
+
public IContextMenu CreateFor(IMdiChildView view, IPresenterWithContextMenu presenter)
{
- return new MdiChildViewContextMenu(view);
+ return new MdiChildViewContextMenu(view, _container);
}
public bool IsSatisfiedBy(IMdiChildView view, IPresenterWithContextMenu presenter)
diff --git a/src/PKSim.Presentation/Presenters/ContextMenus/MultipleBuildingBlockNodeContextMenu.cs b/src/PKSim.Presentation/Presenters/ContextMenus/MultipleBuildingBlockNodeContextMenu.cs
index d336f6074..99067aab5 100644
--- a/src/PKSim.Presentation/Presenters/ContextMenus/MultipleBuildingBlockNodeContextMenu.cs
+++ b/src/PKSim.Presentation/Presenters/ContextMenus/MultipleBuildingBlockNodeContextMenu.cs
@@ -9,18 +9,20 @@
using PKSim.Core;
using PKSim.Core.Model;
using PKSim.Presentation.UICommands;
+using IContainer = OSPSuite.Utility.Container.IContainer;
namespace PKSim.Presentation.Presenters.ContextMenus
{
public abstract class MultipleBuildingBlockNodeContextMenu : ContextMenu>, IExecutionContext> where TBuildingBlock : class, IPKSimBuildingBlock
{
- protected MultipleBuildingBlockNodeContextMenu(IReadOnlyList buildingBlocks, IExecutionContext executionContext)
- : this(buildingBlocks.Select(bb => new NamedBuildingBlock(bb, bb.Name)).ToList(), executionContext)
+
+ protected MultipleBuildingBlockNodeContextMenu(IReadOnlyList buildingBlocks, IExecutionContext executionContext, IContainer container)
+ : this(buildingBlocks.Select(bb => new NamedBuildingBlock(bb, bb.Name)).ToList(), executionContext, container)
{
}
- protected MultipleBuildingBlockNodeContextMenu(IReadOnlyList> buildingBlocks, IExecutionContext executionContext)
- : base(buildingBlocks, executionContext)
+ protected MultipleBuildingBlockNodeContextMenu(IReadOnlyList> buildingBlocks, IExecutionContext executionContext, IContainer container)
+ : base(buildingBlocks, executionContext, container)
{
}
@@ -37,7 +39,7 @@ protected override IEnumerable AllMenuItemsFor(IReadOnlyList> buildingBlocks, IExecutionContext executionContext)
+ protected IMenuBarItem CompareBuildingBlocks(IReadOnlyList> buildingBlocks, IExecutionContext executionContext)
{
var buildingBlockList = buildingBlocks.Select(x => x.BuildingBlock).ToList();
var objectBaseList = buildingBlockList.Cast().ToList();
@@ -45,7 +47,7 @@ protected static IMenuBarItem CompareBuildingBlocks(IReadOnlyList x.Name).ToList();
if (canStartComparisonFor(buildingBlockList))
- return ComparisonCommonContextMenuItems.CompareObjectsMenu(objectBaseList, buildingBlockNames, executionContext);
+ return ComparisonCommonContextMenuItems.CompareObjectsMenu(objectBaseList, buildingBlockNames, executionContext, _container);
return comparisonNotPossibleMenu(buildingBlockList, executionContext);
}
@@ -54,7 +56,7 @@ protected IMenuBarItem SaveAsUserTemplateMenuFor(IReadOnlyList x.BuildingBlock).ToList();
return CreateMenuButton.WithCaption(PKSimConstants.MenuNames.SaveAsTemplate)
- .WithCommandFor, IReadOnlyList>(buildingBlockList)
+ .WithCommandFor, IReadOnlyList>(buildingBlockList, _container)
.WithIcon(ApplicationIcons.SaveAsTemplate);
}
@@ -62,24 +64,24 @@ protected IMenuBarItem SaveAsSystemTemplateMenuFor(IReadOnlyList x.BuildingBlock).ToList();
return CreateMenuButton.WithCaption(PKSimConstants.MenuNames.SaveAsSystemTemplate)
- .WithCommandFor, IReadOnlyList>(buildingBlockList)
+ .WithCommandFor, IReadOnlyList>(buildingBlockList, _container)
.WithIcon(ApplicationIcons.SaveAsTemplate)
.ForDeveloper();
}
- protected static IMenuBarItem AddToJournal(IReadOnlyList> buildingBlocks)
+ protected IMenuBarItem AddToJournal(IReadOnlyList> buildingBlocks)
{
var objectBaseList = buildingBlocks.Select(x => x.BuildingBlock).Cast().ToList();
- return ObjectBaseCommonContextMenuItems.AddToJournal(objectBaseList);
+ return ObjectBaseCommonContextMenuItems.AddToJournal(objectBaseList, _container);
}
- protected static IMenuBarButton DeleteSelectedBuildingBlockMenuItem(IReadOnlyList> buildingBlocks)
+ protected IMenuBarButton DeleteSelectedBuildingBlockMenuItem(IReadOnlyList> buildingBlocks)
{
var buildingBlockList = buildingBlocks.Select(x => x.BuildingBlock).ToList();
return CreateMenuButton.WithCaption(MenuNames.Delete)
- .WithCommandFor>(buildingBlockList)
+ .WithCommandFor>(buildingBlockList, _container)
.WithIcon(ApplicationIcons.Delete)
.AsGroupStarter();
}
diff --git a/src/PKSim.Presentation/Presenters/ContextMenus/MultipleComparisonNodeContextMenu.cs b/src/PKSim.Presentation/Presenters/ContextMenus/MultipleComparisonNodeContextMenu.cs
index 1b1920a36..dd96e775f 100644
--- a/src/PKSim.Presentation/Presenters/ContextMenus/MultipleComparisonNodeContextMenu.cs
+++ b/src/PKSim.Presentation/Presenters/ContextMenus/MultipleComparisonNodeContextMenu.cs
@@ -9,19 +9,20 @@
using OSPSuite.Presentation.Presenters;
using OSPSuite.Presentation.Presenters.ContextMenus;
using OSPSuite.Assets;
+using OSPSuite.Utility.Container;
namespace PKSim.Presentation.Presenters.ContextMenus
{
public class MultipleComparisonNodeContextMenu : ContextMenu, IExecutionContext>
{
- public MultipleComparisonNodeContextMenu(IReadOnlyList simulationComparisons, IExecutionContext executionContext) : base(simulationComparisons, executionContext)
+ public MultipleComparisonNodeContextMenu(IReadOnlyList simulationComparisons, IExecutionContext executionContext, IContainer container) : base(simulationComparisons, executionContext, container)
{
}
protected override IEnumerable AllMenuItemsFor(IReadOnlyList simulationComparisons, IExecutionContext executionContext)
{
yield return CreateMenuButton.WithCaption(MenuNames.Delete)
- .WithCommandFor>(simulationComparisons)
+ .WithCommandFor>(simulationComparisons, _container)
.WithIcon(ApplicationIcons.Delete);
}
}
@@ -29,15 +30,17 @@ protected override IEnumerable AllMenuItemsFor(IReadOnlyList
{
private readonly IExecutionContext _executionContext;
+ private readonly IContainer _container;
- public MultipleComparisonNodeContextMenuFactory(IExecutionContext executionContext)
+ public MultipleComparisonNodeContextMenuFactory(IExecutionContext executionContext, IContainer container)
{
_executionContext = executionContext;
+ _container = container;
}
protected override IContextMenu CreateFor(IReadOnlyList classifiableComparisons, IPresenterWithContextMenu> presenter)
{
- return new MultipleComparisonNodeContextMenu(classifiableComparisons.Select(x => x.Subject).ToList(), _executionContext);
+ return new MultipleComparisonNodeContextMenu(classifiableComparisons.Select(x => x.Subject).ToList(), _executionContext, _container);
}
}
}
\ No newline at end of file
diff --git a/src/PKSim.Presentation/Presenters/ContextMenus/MultipleCompoundNodeContextMenu.cs b/src/PKSim.Presentation/Presenters/ContextMenus/MultipleCompoundNodeContextMenu.cs
index a9203281f..8b07e97ef 100644
--- a/src/PKSim.Presentation/Presenters/ContextMenus/MultipleCompoundNodeContextMenu.cs
+++ b/src/PKSim.Presentation/Presenters/ContextMenus/MultipleCompoundNodeContextMenu.cs
@@ -2,6 +2,7 @@
using OSPSuite.Presentation.Nodes;
using OSPSuite.Presentation.Presenters;
using OSPSuite.Presentation.Presenters.ContextMenus;
+using OSPSuite.Utility.Container;
using PKSim.Core;
using PKSim.Core.Model;
@@ -9,13 +10,13 @@ namespace PKSim.Presentation.Presenters.ContextMenus
{
public class MultipleCompoundNodeContextMenu : MultipleBuildingBlockNodeContextMenu
{
- public MultipleCompoundNodeContextMenu(IReadOnlyList buildingBlocks, IExecutionContext executionContext)
- : base(buildingBlocks, executionContext)
+ public MultipleCompoundNodeContextMenu(IReadOnlyList buildingBlocks, IExecutionContext executionContext, IContainer container)
+ : base(buildingBlocks, executionContext, container)
{
}
- public MultipleCompoundNodeContextMenu(IReadOnlyList> buildingBlocks, IExecutionContext executionContext)
- : base(buildingBlocks, executionContext)
+ public MultipleCompoundNodeContextMenu(IReadOnlyList> buildingBlocks, IExecutionContext executionContext, IContainer container)
+ : base(buildingBlocks, executionContext, container)
{
}
}
@@ -23,15 +24,17 @@ public MultipleCompoundNodeContextMenu(IReadOnlyList