From 90b5c3c7288b5fa55101f39316d62876cbda5e4c Mon Sep 17 00:00:00 2001 From: Robert McIntosh <261477+rwmcintosh@users.noreply.github.com> Date: Tue, 13 Dec 2022 09:38:54 -0500 Subject: [PATCH] 2475 expression profile from pksim (#2476) * #784_expression_profile_from_pksim * updating with mapper * Fixes #2475 Create expression profile from PK-sim * add dimensions as resource for tests * Add pkparameters for test project * add sqlite db * PR feedback --- PKSim.sln | 12 +- .../PKSim.Assets.Images.csproj | 4 +- src/PKSim.Assets/PKSim.Assets.csproj | 4 +- src/PKSim.Assets/PKSimConstants.cs | 2 - src/PKSim.BatchTool/PKSim.BatchTool.csproj | 4 +- src/PKSim.CLI.Core/PKSim.CLI.Core.csproj | 4 +- src/PKSim.CLI/PKSim.CLI.csproj | 6 +- src/PKSim.Core/PKSim.Core.csproj | 8 +- .../PKSim.Infrastructure.csproj | 18 +-- src/PKSim.Matlab/PKSim.Matlab.csproj | 4 +- .../PKSim.Presentation.csproj | 6 +- .../CreateExpressionProfilePresenter.cs | 3 + .../Repositories/MenuBarItemRepository.cs | 4 +- src/PKSim.R/PKSim.R.csproj | 4 +- src/PKSim.UI.Starter/ApplicationStartup.cs | 115 ++++++++++++++++ .../ExpressionProfileCreator.cs | 42 ++++++ src/PKSim.UI.Starter/PKSim.UI.Starter.csproj | 21 +++ src/PKSim.UI.Starter/UIStarterUserSettings.cs | 50 +++++++ .../BootStrapping/ApplicationStartup.cs | 4 +- src/PKSim.UI/PKSim.UI.csproj | 8 +- src/PKSim/PKSim.csproj | 7 +- .../PKSim.Matlab.Tests.csproj | 4 +- tests/PKSim.R.Tests/PKSim.R.Tests.csproj | 4 +- tests/PKSim.Tests/PKSim.Tests.csproj | 4 +- tests/PKSim.UI.Starter/ApplicationStartup.cs | 82 ------------ .../PKSim.UI.Starter/PKSim.UI.Starter.csproj | 6 +- .../Presenters/StarterMainPresenter.cs | 38 ------ .../StarterRelativeExpressionPresenter.cs | 82 ------------ tests/PKSim.UI.Starter/Program.cs | 40 ------ .../PKSim.UI.Starter/Properties/licenses.licx | 1 - tests/PKSim.UI.Starter/StarterRegister.cs | 20 --- .../Views/IStarterMainView.cs | 10 -- .../Views/IStarterRelativeExpressionView.cs | 10 -- .../Views/StarterMainView.Designer.cs | 119 ----------------- .../PKSim.UI.Starter/Views/StarterMainView.cs | 39 ------ .../Views/StarterMainView.resx | 123 ------------------ .../StarterRelativeExpressionView.Designer.cs | 108 --------------- .../Views/StarterRelativeExpressionView.cs | 27 ---- .../Views/StarterRelativeExpressionView.resx | 123 ------------------ tests/PKSim.UI.Starter/app.config | 6 - tests/PKSim.UI.Tests/PKSim.UI.Tests.csproj | 79 ++++++----- .../ApplicationStartupTests.cs | 59 +++++++++ 42 files changed, 397 insertions(+), 917 deletions(-) create mode 100644 src/PKSim.UI.Starter/ApplicationStartup.cs create mode 100644 src/PKSim.UI.Starter/ExpressionProfileCreator.cs create mode 100644 src/PKSim.UI.Starter/PKSim.UI.Starter.csproj create mode 100644 src/PKSim.UI.Starter/UIStarterUserSettings.cs delete mode 100644 tests/PKSim.UI.Starter/ApplicationStartup.cs delete mode 100644 tests/PKSim.UI.Starter/Presenters/StarterMainPresenter.cs delete mode 100644 tests/PKSim.UI.Starter/Presenters/StarterRelativeExpressionPresenter.cs delete mode 100644 tests/PKSim.UI.Starter/Program.cs delete mode 100644 tests/PKSim.UI.Starter/Properties/licenses.licx delete mode 100644 tests/PKSim.UI.Starter/StarterRegister.cs delete mode 100644 tests/PKSim.UI.Starter/Views/IStarterMainView.cs delete mode 100644 tests/PKSim.UI.Starter/Views/IStarterRelativeExpressionView.cs delete mode 100644 tests/PKSim.UI.Starter/Views/StarterMainView.Designer.cs delete mode 100644 tests/PKSim.UI.Starter/Views/StarterMainView.cs delete mode 100644 tests/PKSim.UI.Starter/Views/StarterMainView.resx delete mode 100644 tests/PKSim.UI.Starter/Views/StarterRelativeExpressionView.Designer.cs delete mode 100644 tests/PKSim.UI.Starter/Views/StarterRelativeExpressionView.cs delete mode 100644 tests/PKSim.UI.Starter/Views/StarterRelativeExpressionView.resx delete mode 100644 tests/PKSim.UI.Starter/app.config create mode 100644 tests/PKSim.UI.Tests/UI.StarterTests/ApplicationStartupTests.cs diff --git a/PKSim.sln b/PKSim.sln index 4952398eb..cbe65b7fe 100644 --- a/PKSim.sln +++ b/PKSim.sln @@ -56,7 +56,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PKSim.R", "src\PKSim.R\PKSi EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PKSim.R.Tests", "tests\PKSim.R.Tests\PKSim.R.Tests.csproj", "{4E310F99-4604-4502-8F0B-A4E4F27B062B}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PKSim.UI.Starter", "tests\PKSim.UI.Starter\PKSim.UI.Starter.csproj", "{795B1096-E236-4A0B-AB67-590F264F9F8E}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PKSim.UI.Starter", "src\PKSim.UI.Starter\PKSim.UI.Starter.csproj", "{35E511E9-0130-4E28-9DB3-EDCCB098D383}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -128,17 +128,17 @@ Global {4E310F99-4604-4502-8F0B-A4E4F27B062B}.Debug|Any CPU.Build.0 = Debug|Any CPU {4E310F99-4604-4502-8F0B-A4E4F27B062B}.Release|Any CPU.ActiveCfg = Release|Any CPU {4E310F99-4604-4502-8F0B-A4E4F27B062B}.Release|Any CPU.Build.0 = Release|Any CPU - {795B1096-E236-4A0B-AB67-590F264F9F8E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {795B1096-E236-4A0B-AB67-590F264F9F8E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {795B1096-E236-4A0B-AB67-590F264F9F8E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {795B1096-E236-4A0B-AB67-590F264F9F8E}.Release|Any CPU.Build.0 = Release|Any CPU + {35E511E9-0130-4E28-9DB3-EDCCB098D383}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {35E511E9-0130-4E28-9DB3-EDCCB098D383}.Debug|Any CPU.Build.0 = Debug|Any CPU + {35E511E9-0130-4E28-9DB3-EDCCB098D383}.Release|Any CPU.ActiveCfg = Release|Any CPU + {35E511E9-0130-4E28-9DB3-EDCCB098D383}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution - VisualSVNWorkingCopyRoot = SolutionGuid = {13620E23-1993-42C6-A4AB-468E29DD24DE} + VisualSVNWorkingCopyRoot = EndGlobalSection GlobalSection(NDepend) = preSolution Project = ".\PKSim.ndproj" diff --git a/src/PKSim.Assets.Images/PKSim.Assets.Images.csproj b/src/PKSim.Assets.Images/PKSim.Assets.Images.csproj index 46eeda8ad..7912b7d71 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 d8a26a570..0a98cdb05 100644 --- a/src/PKSim.Assets/PKSim.Assets.csproj +++ b/src/PKSim.Assets/PKSim.Assets.csproj @@ -26,8 +26,8 @@ - - + + diff --git a/src/PKSim.Assets/PKSimConstants.cs b/src/PKSim.Assets/PKSimConstants.cs index 71903ace8..4e0a56dda 100644 --- a/src/PKSim.Assets/PKSimConstants.cs +++ b/src/PKSim.Assets/PKSimConstants.cs @@ -1150,7 +1150,6 @@ public static class MenuNames public static readonly string NewFormulation = "Add &Formulation..."; public static readonly string NewEvent = "Add &Event..."; public static readonly string NewObservers = "Add &Observers..."; - public static readonly string NewExpressionProfile = "Add &Expression Profile"; public static readonly string AddObservedData = "Add &Observed Data..."; public static readonly string AddObservedDataFor = "Add Observed Data for"; public static readonly string SaveAs = "Save As..."; @@ -1886,7 +1885,6 @@ public static class UI public static readonly string NewFormulationDescription = "Create a new formulation..."; public static readonly string NewEventDescription = "Create a new event..."; public static readonly string NewObserversDescription = "Create a new observer list..."; - public static readonly string NewExpressionProfileDescription = "Create a new expression profile..."; public static readonly string NewCompoundDescription = "Create a new compound..."; public static readonly string OptionsDescription = "Manage the options for the application and the current user..."; public static readonly string ExitDescription = "Exit the application"; diff --git a/src/PKSim.BatchTool/PKSim.BatchTool.csproj b/src/PKSim.BatchTool/PKSim.BatchTool.csproj index 2811719ce..15cbdf2d7 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 b323e0572..114a9def8 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 03c1c2059..1e0a5a818 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/PKSim.Core.csproj b/src/PKSim.Core/PKSim.Core.csproj index 789de4f91..de42c1ac2 100644 --- a/src/PKSim.Core/PKSim.Core.csproj +++ b/src/PKSim.Core/PKSim.Core.csproj @@ -30,10 +30,10 @@ - - - - + + + + diff --git a/src/PKSim.Infrastructure/PKSim.Infrastructure.csproj b/src/PKSim.Infrastructure/PKSim.Infrastructure.csproj index f2e03ba4c..2ba034faa 100644 --- a/src/PKSim.Infrastructure/PKSim.Infrastructure.csproj +++ b/src/PKSim.Infrastructure/PKSim.Infrastructure.csproj @@ -41,15 +41,15 @@ - - - - - - - - - + + + + + + + + + diff --git a/src/PKSim.Matlab/PKSim.Matlab.csproj b/src/PKSim.Matlab/PKSim.Matlab.csproj index 961ea6b69..6bb0327c5 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 6f3b68970..939c7042a 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/Presenters/ExpressionProfiles/CreateExpressionProfilePresenter.cs b/src/PKSim.Presentation/Presenters/ExpressionProfiles/CreateExpressionProfilePresenter.cs index 1b8a6cc69..6a9b5a537 100644 --- a/src/PKSim.Presentation/Presenters/ExpressionProfiles/CreateExpressionProfilePresenter.cs +++ b/src/PKSim.Presentation/Presenters/ExpressionProfiles/CreateExpressionProfilePresenter.cs @@ -47,8 +47,11 @@ public IPKSimCommand Create() where TMolecule : IndividualMolecule _view.Caption = PKSimConstants.UI.CreateExpressionProfile; _view.BindTo(_dto); _view.Display(); + if (_view.Canceled) + { return new PKSimEmptyCommand(); + } //we create a new one with all new features ExpressionProfile = _expressionProfileFactory.Create(_dto.Species, _dto.MoleculeName); diff --git a/src/PKSim.Presentation/Repositories/MenuBarItemRepository.cs b/src/PKSim.Presentation/Repositories/MenuBarItemRepository.cs index ea9afafce..b0915bd83 100644 --- a/src/PKSim.Presentation/Repositories/MenuBarItemRepository.cs +++ b/src/PKSim.Presentation/Repositories/MenuBarItemRepository.cs @@ -175,9 +175,9 @@ protected override IEnumerable AllMenuBarItems() .WithCommand() .WithIcon(ApplicationIcons.LoadFromTemplate); - var newExpressionProfile = CreateSubMenu.WithCaption(PKSimConstants.MenuNames.NewExpressionProfile) + var newExpressionProfile = CreateSubMenu.WithCaption(MenuNames.NewExpressionProfile) .WithIcon(ApplicationIcons.ExpressionProfile) - .WithDescription(PKSimConstants.UI.NewExpressionProfileDescription) + .WithDescription(MenuDescriptions.NewExpressionProfileDescription) .WithId(MenuBarItemIds.NewExpressionProfile); var newEnzyme = CreateMenuButton.WithCaption(PKSimConstants.UI.AddMetabolizingEnzyme) diff --git a/src/PKSim.R/PKSim.R.csproj b/src/PKSim.R/PKSim.R.csproj index 1db65d051..ef08633ae 100644 --- a/src/PKSim.R/PKSim.R.csproj +++ b/src/PKSim.R/PKSim.R.csproj @@ -49,9 +49,9 @@ - + - + diff --git a/src/PKSim.UI.Starter/ApplicationStartup.cs b/src/PKSim.UI.Starter/ApplicationStartup.cs new file mode 100644 index 000000000..eea7790e5 --- /dev/null +++ b/src/PKSim.UI.Starter/ApplicationStartup.cs @@ -0,0 +1,115 @@ +using System.Globalization; +using System.Threading; +using OSPSuite.Assets; +using OSPSuite.Core.Commands.Core; +using OSPSuite.Core.Journal; +using OSPSuite.Core.Services; +using OSPSuite.Infrastructure.Import.Services; +using OSPSuite.Presentation; +using OSPSuite.Presentation.Core; +using OSPSuite.Presentation.DTO; +using OSPSuite.Presentation.Services; +using OSPSuite.Presentation.Views; +using OSPSuite.UI.Mappers; +using OSPSuite.UI.Services; +using OSPSuite.Utility.Container; +using OSPSuite.Utility.Exceptions; +using PKSim.CLI.Core.MinimalImplementations; +using PKSim.Core; +using PKSim.Core.Services; +using PKSim.Infrastructure; +using PKSim.Presentation; +using PKSim.Presentation.DTO.Mappers; +using PKSim.Presentation.Presenters.ExpressionProfiles; +using PKSim.Presentation.Services; +using PKSim.Presentation.Views.ExpressionProfiles; +using PKSim.UI.Views.ExpressionProfiles; + +namespace PKSim.UI.Starter +{ + public static class ApplicationStartup + { + static IContainer _container; + + public static IContainer Initialize(IShell shell) + { + if (_container != null) + return _container; + + _container = initializeForStartup(shell); + + return _container; + } + + private static IContainer initializeForStartup(IShell shell) + { + Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US"); + Thread.CurrentThread.CurrentUICulture = new CultureInfo("en"); + ApplicationIcons.DefaultIcon = ApplicationIcons.PKSim; + + + var container = InfrastructureRegister.Initialize(registerContainerAsStatic: false); + container.RegisterImplementationOf(SynchronizationContext.Current); + + container.Register(LifeStyle.Singleton); + container.Register(LifeStyle.Singleton); + + // registerImplementationsFromCore(container); + registerMinimalImplementations(container); + + + using (container.OptimizeDependencyResolution()) + { + container.RegisterImplementationOf(shell); + container.AddRegister(x => x.FromType()); + container.AddRegister(x => x.FromType()); + container.Register(); + container.Register(); + container.Register(); + container.Register(); + container.Register(LifeStyle.Singleton); + container.Register(); + container.Register(); + container.Register(); + container.Register>(); + InfrastructureRegister.LoadSerializers(container); + } + + return container; + } + + // /// + // /// Use this method to register all dependencies in Core.UI and Core.Presentation + // /// + // private static void registerImplementationsFromCore(IContainer container) + // { + // container.Register(LifeStyle.Singleton); + // container.AddRegister(x => x.FromType()); + // container.AddRegister(x => x.FromType()); + // } + + /// + /// Use this method to register and refine the minimal implementations for dependencies + /// + private static void registerMinimalImplementations(IContainer container) + { + container.Register(); + container.Register(); + container.Register(); + container.Register(); + container.Register(); + container.Register(); + container.Register(); + container.Register(); + } + } + + internal class Workspace : CLIWorkspace, IWorkspace + { + public Workspace(IRegistrationTask registrationTask) : base(registrationTask) + { + } + + public IWorkspaceLayout WorkspaceLayout { get; set; } + } +} \ No newline at end of file diff --git a/src/PKSim.UI.Starter/ExpressionProfileCreator.cs b/src/PKSim.UI.Starter/ExpressionProfileCreator.cs new file mode 100644 index 000000000..bcb843b53 --- /dev/null +++ b/src/PKSim.UI.Starter/ExpressionProfileCreator.cs @@ -0,0 +1,42 @@ +using OSPSuite.Core.Commands.Core; +using OSPSuite.Presentation.Views; +using PKSim.Core.Mappers; +using PKSim.Core.Model; +using PKSim.Presentation; +using PKSim.Presentation.Presenters.ExpressionProfiles; + +namespace PKSim.UI.Starter +{ + public static class ExpressionProfileCreator + { + public static object CreateIndividualEnzymeExpressionProfile(IShell shell) + { + return createExpressionProfile(shell); + } + + public static object CreateTransporterExpressionProfile(IShell shell) + { + return createExpressionProfile(shell); + } + + public static object CreateBindingPartnerExpressionProfile(IShell shell) + { + return createExpressionProfile(shell); + } + + private static object createExpressionProfile(IShell shell) where T : IndividualMolecule + { + var container = ApplicationStartup.Initialize(shell); + + using (var presenter = container.Resolve()) + { + var workspace = container.Resolve(); + workspace.Project = new PKSimProject(); + var mapper = container.Resolve(); + + + return presenter.Create().IsEmpty() ? null : mapper.MapFrom(presenter.ExpressionProfile); + } + } + } +} \ No newline at end of file diff --git a/src/PKSim.UI.Starter/PKSim.UI.Starter.csproj b/src/PKSim.UI.Starter/PKSim.UI.Starter.csproj new file mode 100644 index 000000000..52eda407b --- /dev/null +++ b/src/PKSim.UI.Starter/PKSim.UI.Starter.csproj @@ -0,0 +1,21 @@ + + + + netstandard2.0 + true + 11.1.0 + 11.1.0 + 11.1.0 + + + + + + + + + + + + + diff --git a/src/PKSim.UI.Starter/UIStarterUserSettings.cs b/src/PKSim.UI.Starter/UIStarterUserSettings.cs new file mode 100644 index 000000000..19fef38de --- /dev/null +++ b/src/PKSim.UI.Starter/UIStarterUserSettings.cs @@ -0,0 +1,50 @@ +using System.Collections.Generic; +using System.Drawing; +using OSPSuite.Assets; +using OSPSuite.Core.Comparison; +using OSPSuite.Core.Diagram; +using OSPSuite.Core.Domain; +using OSPSuite.Presentation; +using OSPSuite.Presentation.Diagram.Elements; +using OSPSuite.Presentation.Presenters.ParameterIdentifications; +using OSPSuite.Presentation.Presenters.SensitivityAnalyses; +using OSPSuite.Presentation.Settings; +using PKSim.CLI.Core.MinimalImplementations; + +namespace PKSim.UI.Starter +{ + public class UIStarterUserSettings : CLIUserSettings, IPresentationUserSettings + { + public UIStarterUserSettings() + { + DisplayUnits = new DisplayUnitsManager(); + ComparerSettings = new ComparerSettings { CompareHiddenEntities = false }; + ProjectFiles = new List(); + DiagramOptions = new DiagramOptions(); + JournalPageEditorSettings = new JournalPageEditorSettings(); + ParameterIdentificationFeedbackEditorSettings = new ParameterIdentificationFeedbackEditorSettings(); + SensitivityAnalysisFeedbackEditorSettings = new SensitivityAnalysisFeedbackEditorSettings(); + + ResetToDefault(); + } + + public string DefaultChartEditorLayout { get; set; } + public string ActiveSkin { get; set; } + public Scalings DefaultChartYScaling { get; set; } + public IconSize IconSizeTreeView { get; set; } + public IconSize IconSizeTab { get; set; } + public IconSize IconSizeContextMenu { get; set; } + public Color ChartBackColor { get; set; } + public Color ChartDiagramBackColor { get; set; } + public bool ColorGroupObservedDataFromSameFolder { get; set; } + public DisplayUnitsManager DisplayUnits { get; set; } + public IList ProjectFiles { get; set; } + public uint MRUListItemCount { get; set; } + public ComparerSettings ComparerSettings { get; set; } + public IDiagramOptions DiagramOptions { get; set; } + public string ChartEditorLayout { get; set; } + public JournalPageEditorSettings JournalPageEditorSettings { get; set; } + public ParameterIdentificationFeedbackEditorSettings ParameterIdentificationFeedbackEditorSettings { get; set; } + public SensitivityAnalysisFeedbackEditorSettings SensitivityAnalysisFeedbackEditorSettings { get; set; } + } +} \ No newline at end of file diff --git a/src/PKSim.UI/BootStrapping/ApplicationStartup.cs b/src/PKSim.UI/BootStrapping/ApplicationStartup.cs index 91b2301d1..b5db161ca 100644 --- a/src/PKSim.UI/BootStrapping/ApplicationStartup.cs +++ b/src/PKSim.UI/BootStrapping/ApplicationStartup.cs @@ -122,7 +122,7 @@ public void Start() showStatusMessage(progress, PKSimConstants.UI.RegisterAssembly(PKSimConstants.UI.Infrastructure)); container.AddRegister(x => x.FromType()); - showStatusMessage(progress, message: PKSimConstants.UI.RegisterAssembly(PKSimConstants.UI.Presentation)); + showStatusMessage(progress, PKSimConstants.UI.RegisterAssembly(PKSimConstants.UI.Presentation)); container.AddRegister(x => x.FromType()); showStatusMessage(progress, PKSimConstants.UI.RegisterAssembly(PKSimConstants.UI.UserInterface)); @@ -153,7 +153,7 @@ private void finalizeRegistration(IContainer container) container.Resolve(); var mainPresenter = container.Resolve(); - container.RegisterImplementationOf((IChangePropagator) mainPresenter); + container.RegisterImplementationOf((IChangePropagator)mainPresenter); //This runner is only register when running PKSim as an executable. All other implementation should use the ISimulationRunner container.Register(LifeStyle.Singleton); diff --git a/src/PKSim.UI/PKSim.UI.csproj b/src/PKSim.UI/PKSim.UI.csproj index 43cfbe394..f257ad330 100644 --- a/src/PKSim.UI/PKSim.UI.csproj +++ b/src/PKSim.UI/PKSim.UI.csproj @@ -60,14 +60,14 @@ - + - - - + + + diff --git a/src/PKSim/PKSim.csproj b/src/PKSim/PKSim.csproj index 3d04bf135..095275081 100644 --- a/src/PKSim/PKSim.csproj +++ b/src/PKSim/PKSim.csproj @@ -76,18 +76,19 @@ - - + + - + + diff --git a/tests/PKSim.Matlab.Tests/PKSim.Matlab.Tests.csproj b/tests/PKSim.Matlab.Tests/PKSim.Matlab.Tests.csproj index 4321df250..a30d355b3 100644 --- a/tests/PKSim.Matlab.Tests/PKSim.Matlab.Tests.csproj +++ b/tests/PKSim.Matlab.Tests/PKSim.Matlab.Tests.csproj @@ -22,9 +22,9 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - + - + diff --git a/tests/PKSim.R.Tests/PKSim.R.Tests.csproj b/tests/PKSim.R.Tests/PKSim.R.Tests.csproj index ee451ae5d..6c7f61fd0 100644 --- a/tests/PKSim.R.Tests/PKSim.R.Tests.csproj +++ b/tests/PKSim.R.Tests/PKSim.R.Tests.csproj @@ -22,9 +22,9 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - + - + diff --git a/tests/PKSim.Tests/PKSim.Tests.csproj b/tests/PKSim.Tests/PKSim.Tests.csproj index 1cca4b340..488c36e71 100644 --- a/tests/PKSim.Tests/PKSim.Tests.csproj +++ b/tests/PKSim.Tests/PKSim.Tests.csproj @@ -20,9 +20,9 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - + - + diff --git a/tests/PKSim.UI.Starter/ApplicationStartup.cs b/tests/PKSim.UI.Starter/ApplicationStartup.cs deleted file mode 100644 index e60a723e6..000000000 --- a/tests/PKSim.UI.Starter/ApplicationStartup.cs +++ /dev/null @@ -1,82 +0,0 @@ -using DevExpress.LookAndFeel; -using Microsoft.Extensions.Logging; -using OSPSuite.Core.Diagram; -using OSPSuite.Core.Journal; -using OSPSuite.Core.Serialization.Diagram; -using OSPSuite.Core.Services; -using OSPSuite.Presentation; -using OSPSuite.Presentation.Services; -using OSPSuite.Utility.Container; -using OSPSuite.Utility.Events; -using OSPSuite.Utility.Exceptions; -using PKSim.BatchTool; -using PKSim.CLI.Core.MinimalImplementations; -using PKSim.Core; -using PKSim.Core.Model; -using PKSim.Core.Services; -using PKSim.Infrastructure; -using PKSim.Presentation; -using PKSim.Presentation.Views.Individuals; -using PKSim.Presentation.Views.Parameters; -using PKSim.UI.Views.Individuals; -using PKSim.UI.Views.Parameters; -using CoreRegister = PKSim.Core.CoreRegister; -using IWorkspace = OSPSuite.Core.IWorkspace; -using PresenterRegister = PKSim.Presentation.PresenterRegister; - -namespace PKSim.UI.Starter -{ - public static class ApplicationStartup - { - public static void Start() - { - BootStrapping.ApplicationStartup.Initialize(LogLevel.Debug); - - var container = IoC.Container; - using (container.OptimizeDependencyResolution()) - { - container.AddRegister(x => x.FromType()); - container.AddRegister(x => x.FromType()); - container.AddRegister(x => x.FromType()); - container.AddRegister(x => x.FromType()); - - registerMinimalImplementations(container); - registerUIImplementation(container); - - InfrastructureRegister.LoadSerializers(container); - InfrastructureRegister.RegisterWorkspace(container); - BootStrapping.ApplicationStartup.RegisterCommands(container); - container.RegisterImplementationOf(new DefaultLookAndFeel().LookAndFeel); - } - - container.Register(LifeStyle.Transient); - var skinManager = container.Resolve(); - var userSettings = container.Resolve(); - // skinManager.ActivateSkin(userSettings, Constants.DEFAULT_SKIN); - } - - private static void registerUIImplementation(IContainer container) - { - container.Register(); - container.Register(); - container.Register(); - container.Register(); - container.Register(); - container.Register(); - } - - private static void registerMinimalImplementations(IContainer container) - { - container.Register(LifeStyle.Singleton); - container.Register( - LifeStyle.Singleton); - container.Register(); - container.Register(); - container.Register(); - container.Register(); - container.Register(); - container.Register(); - container.Register(); - } - } -} \ No newline at end of file diff --git a/tests/PKSim.UI.Starter/PKSim.UI.Starter.csproj b/tests/PKSim.UI.Starter/PKSim.UI.Starter.csproj index 3af20f05e..c70feed01 100644 --- a/tests/PKSim.UI.Starter/PKSim.UI.Starter.csproj +++ b/tests/PKSim.UI.Starter/PKSim.UI.Starter.csproj @@ -56,14 +56,14 @@ - - + + - + diff --git a/tests/PKSim.UI.Starter/Presenters/StarterMainPresenter.cs b/tests/PKSim.UI.Starter/Presenters/StarterMainPresenter.cs deleted file mode 100644 index 4037784a8..000000000 --- a/tests/PKSim.UI.Starter/Presenters/StarterMainPresenter.cs +++ /dev/null @@ -1,38 +0,0 @@ -using OSPSuite.Presentation.Core; -using OSPSuite.Presentation.Presenters; -using PKSim.UI.Starter.Views; - -namespace PKSim.UI.Starter.Presenters -{ - - public interface IStarterMainPresenter : IPresenter - { - void ShowRelativeExpression(); - } - - public class StarterMainPresenter : AbstractPresenter, IStarterMainPresenter - { - private readonly IApplicationController _applicationController; - - public StarterMainPresenter(IStarterMainView view, IApplicationController applicationController) : base(view) - { - _applicationController = applicationController; - } - - - - // private T start() where T : IBatchPresenter - // { - // var presenter = _applicationController.Start(); - // View.Hide(); - // presenter.InitializeForStandAloneStart(); - // return presenter; - //} - public void ShowRelativeExpression() - { - using (var presenter = _applicationController.Start()) - presenter.Start(); - - } - } -} \ No newline at end of file diff --git a/tests/PKSim.UI.Starter/Presenters/StarterRelativeExpressionPresenter.cs b/tests/PKSim.UI.Starter/Presenters/StarterRelativeExpressionPresenter.cs deleted file mode 100644 index 43e91c897..000000000 --- a/tests/PKSim.UI.Starter/Presenters/StarterRelativeExpressionPresenter.cs +++ /dev/null @@ -1,82 +0,0 @@ -using OSPSuite.Presentation.Presenters; -using PKSim.Core; -using PKSim.Core.Commands; -using PKSim.Core.Model; -using PKSim.Core.Services; -using PKSim.Core.Snapshots; -using PKSim.Core.Snapshots.Mappers; -using PKSim.Presentation.Presenters.Individuals; -using PKSim.UI.Starter.Views; -using Individual = PKSim.Core.Model.Individual; -using OriginData = PKSim.Core.Snapshots.OriginData; - -namespace PKSim.UI.Starter.Presenters -{ - public interface IStarterRelativeExpressionPresenter : IDisposablePresenter - { - void Start(); - } - - public class StarterRelativeExpressionPresenter : AbstractDisposableCommandCollectorPresenter, - IStarterRelativeExpressionPresenter - { - private readonly OriginDataMapper _originDataMapper; - private readonly IIndividualFactory _individualFactory; - private readonly IIndividualEnzymeFactory _individualEnzymeFactory; - private readonly IIndividualEnzymeExpressionsPresenter _individualEnzymeExpressionsPresenter; - - public StarterRelativeExpressionPresenter( - IStarterRelativeExpressionView view, - OriginDataMapper originDataMapper, - IIndividualFactory individualFactory, - IIndividualEnzymeFactory individualEnzymeFactory, IIndividualEnzymeExpressionsPresenter individualEnzymeExpressionsPresenter) : base(view) - { - _originDataMapper = originDataMapper; - _individualFactory = individualFactory; - _individualEnzymeFactory = individualEnzymeFactory; - _individualEnzymeExpressionsPresenter = individualEnzymeExpressionsPresenter; - AddSubPresenters(individualEnzymeExpressionsPresenter); - InitializeWith(new PKSimMacroCommand()); - } - - public void Start() - { - var individual = createIndividual(); - var enzyme = _individualEnzymeFactory.AddMoleculeTo(individual, "CYP3A4"); - View.AddExpressionPresenter(_individualEnzymeExpressionsPresenter.BaseView); - _individualEnzymeExpressionsPresenter.SimulationSubject = individual; - _individualEnzymeExpressionsPresenter.ActivateMolecule(enzyme); - View.Display(); - } - - private Individual createIndividual() - { - var originData = new OriginData - { - Species = CoreConstants.Species.HUMAN, - Population = CoreConstants.Population.ICRP, - Age = new Parameter - { - Value = 30, - Unit = "year(s)", - }, - Weight = new Parameter - { - Value = 75, - Unit = "kg", - }, - Height = new Parameter - { - Value = 175, - Unit = "cm", - }, - Gender = CoreConstants.Gender.MALE - }; - - var modelOriginData = _originDataMapper.MapToModel(originData, new SnapshotContext()).Result; - var individual = _individualFactory.CreateAndOptimizeFor(modelOriginData); - - return individual; - } - } -} \ No newline at end of file diff --git a/tests/PKSim.UI.Starter/Program.cs b/tests/PKSim.UI.Starter/Program.cs deleted file mode 100644 index 264e214ef..000000000 --- a/tests/PKSim.UI.Starter/Program.cs +++ /dev/null @@ -1,40 +0,0 @@ -using System; -using System.Windows.Forms; -using DevExpress.LookAndFeel; -using DevExpress.XtraEditors; -using Microsoft.Extensions.Logging; -using OSPSuite.Core.Extensions; -using OSPSuite.Utility.Container; -using OSPSuite.Utility.Extensions; -using PKSim.UI.BootStrapping; -using PKSim.UI.Starter.Presenters; - -namespace PKSim.UI.Starter -{ - internal static class Program - { - /// - /// The main entry point for the application. - /// - [STAThread] - private static void Main(string[] args) - { - Application.EnableVisualStyles(); - Application.SetCompatibleTextRenderingDefault(false); - - // WindowsFormsSettings.SetDPIAware(); - WindowsFormsSettings.TouchUIMode = TouchUIMode.False; - - try - { - ApplicationStartup.Start(); - var mainPresenter = IoC.Resolve(); - Application.Run(mainPresenter.BaseView.DowncastTo
()); - } - catch (Exception e) - { - MessageBox.Show(e.ExceptionMessageWithStackTrace(), "Unhandled Exception", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - } - } -} \ No newline at end of file diff --git a/tests/PKSim.UI.Starter/Properties/licenses.licx b/tests/PKSim.UI.Starter/Properties/licenses.licx deleted file mode 100644 index 9092b8de9..000000000 --- a/tests/PKSim.UI.Starter/Properties/licenses.licx +++ /dev/null @@ -1 +0,0 @@ -DevExpress.XtraLayout.LayoutControl, DevExpress.XtraLayout.v20.1, Version=20.1.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a diff --git a/tests/PKSim.UI.Starter/StarterRegister.cs b/tests/PKSim.UI.Starter/StarterRegister.cs deleted file mode 100644 index 5539c3c80..000000000 --- a/tests/PKSim.UI.Starter/StarterRegister.cs +++ /dev/null @@ -1,20 +0,0 @@ -using OSPSuite.Utility.Container; - -namespace PKSim.UI.Starter -{ - - public class StarterRegister : Register - { - public override void RegisterInContainer(IContainer container) - { - container.AddScanner(scan => - { - scan.AssemblyContainingType(); - scan.WithDefaultConvention(); - }); - - - - } - } -} \ No newline at end of file diff --git a/tests/PKSim.UI.Starter/Views/IStarterMainView.cs b/tests/PKSim.UI.Starter/Views/IStarterMainView.cs deleted file mode 100644 index bebe3bed9..000000000 --- a/tests/PKSim.UI.Starter/Views/IStarterMainView.cs +++ /dev/null @@ -1,10 +0,0 @@ -using OSPSuite.Presentation.Views; -using PKSim.UI.Starter.Presenters; - -namespace PKSim.UI.Starter.Views -{ - public interface IStarterMainView : IView - { - - } -} \ No newline at end of file diff --git a/tests/PKSim.UI.Starter/Views/IStarterRelativeExpressionView.cs b/tests/PKSim.UI.Starter/Views/IStarterRelativeExpressionView.cs deleted file mode 100644 index 9de978c10..000000000 --- a/tests/PKSim.UI.Starter/Views/IStarterRelativeExpressionView.cs +++ /dev/null @@ -1,10 +0,0 @@ -using OSPSuite.Presentation.Views; -using PKSim.UI.Starter.Presenters; - -namespace PKSim.UI.Starter.Views -{ - public interface IStarterRelativeExpressionView : IModalView - { - void AddExpressionPresenter(IView view); - } -} \ No newline at end of file diff --git a/tests/PKSim.UI.Starter/Views/StarterMainView.Designer.cs b/tests/PKSim.UI.Starter/Views/StarterMainView.Designer.cs deleted file mode 100644 index edcb38d27..000000000 --- a/tests/PKSim.UI.Starter/Views/StarterMainView.Designer.cs +++ /dev/null @@ -1,119 +0,0 @@ -namespace PKSim.UI.Starter.Views -{ - partial class StarterMainView - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.layoutControl1 = new DevExpress.XtraLayout.LayoutControl(); - this.btnRelativeExpression = new DevExpress.XtraEditors.SimpleButton(); - this.Root = new DevExpress.XtraLayout.LayoutControlGroup(); - this.layoutControlItem1 = new DevExpress.XtraLayout.LayoutControlItem(); - this.emptySpaceItem1 = new DevExpress.XtraLayout.EmptySpaceItem(); - ((System.ComponentModel.ISupportInitialize)(this._errorProvider)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutControl1)).BeginInit(); - this.layoutControl1.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.Root)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem1)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItem1)).BeginInit(); - this.SuspendLayout(); - // - // layoutControl1 - // - this.layoutControl1.Controls.Add(this.btnRelativeExpression); - this.layoutControl1.Dock = System.Windows.Forms.DockStyle.Fill; - this.layoutControl1.Location = new System.Drawing.Point(0, 0); - this.layoutControl1.Name = "layoutControl1"; - this.layoutControl1.Root = this.Root; - this.layoutControl1.Size = new System.Drawing.Size(526, 428); - this.layoutControl1.TabIndex = 0; - this.layoutControl1.Text = "layoutControl1"; - // - // btnRelativeExpression - // - this.btnRelativeExpression.Location = new System.Drawing.Point(12, 12); - this.btnRelativeExpression.Name = "btnRelativeExpression"; - this.btnRelativeExpression.Size = new System.Drawing.Size(502, 22); - this.btnRelativeExpression.StyleController = this.layoutControl1; - this.btnRelativeExpression.TabIndex = 4; - this.btnRelativeExpression.Text = "btnRelativeExpression"; - // - // Root - // - this.Root.EnableIndentsWithoutBorders = DevExpress.Utils.DefaultBoolean.True; - this.Root.GroupBordersVisible = false; - this.Root.Items.AddRange(new DevExpress.XtraLayout.BaseLayoutItem[] { - this.layoutControlItem1, - this.emptySpaceItem1}); - this.Root.Name = "Root"; - this.Root.Size = new System.Drawing.Size(526, 428); - this.Root.TextVisible = false; - // - // layoutControlItem1 - // - this.layoutControlItem1.Control = this.btnRelativeExpression; - this.layoutControlItem1.Location = new System.Drawing.Point(0, 0); - this.layoutControlItem1.Name = "layoutControlItem1"; - this.layoutControlItem1.Size = new System.Drawing.Size(506, 26); - this.layoutControlItem1.TextSize = new System.Drawing.Size(0, 0); - this.layoutControlItem1.TextVisible = false; - // - // emptySpaceItem1 - // - this.emptySpaceItem1.AllowHotTrack = false; - this.emptySpaceItem1.Location = new System.Drawing.Point(0, 26); - this.emptySpaceItem1.Name = "emptySpaceItem1"; - this.emptySpaceItem1.Size = new System.Drawing.Size(506, 382); - this.emptySpaceItem1.TextSize = new System.Drawing.Size(0, 0); - // - // StarterMainView - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Caption = "StarterMainView"; - this.ClientSize = new System.Drawing.Size(526, 428); - this.Controls.Add(this.layoutControl1); - this.Name = "StarterMainView"; - this.Text = "StarterMainView"; - ((System.ComponentModel.ISupportInitialize)(this._errorProvider)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutControl1)).EndInit(); - this.layoutControl1.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.Root)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem1)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItem1)).EndInit(); - this.ResumeLayout(false); - - } - - #endregion - - private DevExpress.XtraLayout.LayoutControl layoutControl1; - private DevExpress.XtraLayout.LayoutControlGroup Root; - private DevExpress.XtraEditors.SimpleButton btnRelativeExpression; - private DevExpress.XtraLayout.LayoutControlItem layoutControlItem1; - private DevExpress.XtraLayout.EmptySpaceItem emptySpaceItem1; - } -} \ No newline at end of file diff --git a/tests/PKSim.UI.Starter/Views/StarterMainView.cs b/tests/PKSim.UI.Starter/Views/StarterMainView.cs deleted file mode 100644 index 00bcbf15b..000000000 --- a/tests/PKSim.UI.Starter/Views/StarterMainView.cs +++ /dev/null @@ -1,39 +0,0 @@ -using System.Windows.Forms; -using OSPSuite.Assets; -using OSPSuite.UI.Views; -using PKSim.Core; -using PKSim.UI.Starter.Presenters; - -namespace PKSim.UI.Starter.Views -{ - public partial class StarterMainView : BaseView, IStarterMainView - { - private IStarterMainPresenter _presenter; - - public StarterMainView() - { - InitializeComponent(); - } - - public override void InitializeBinding() - { - base.InitializeBinding(); - btnRelativeExpression.Click += (o, e) => _presenter.ShowRelativeExpression(); - } - - public void AttachPresenter(IStarterMainPresenter presenter) - { - _presenter = presenter; - } - - public override void InitializeResources() - { - base.InitializeResources(); - Caption = CoreConstants.PRODUCT_NAME; - ShowInTaskbar = true; - StartPosition = FormStartPosition.CenterScreen; - ApplicationIcon = ApplicationIcons.PKSim; - btnRelativeExpression.Text = "Show Relative Expressions"; - } - } -} \ No newline at end of file diff --git a/tests/PKSim.UI.Starter/Views/StarterMainView.resx b/tests/PKSim.UI.Starter/Views/StarterMainView.resx deleted file mode 100644 index 91f678938..000000000 --- a/tests/PKSim.UI.Starter/Views/StarterMainView.resx +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 17, 17 - - \ No newline at end of file diff --git a/tests/PKSim.UI.Starter/Views/StarterRelativeExpressionView.Designer.cs b/tests/PKSim.UI.Starter/Views/StarterRelativeExpressionView.Designer.cs deleted file mode 100644 index 55edf9d96..000000000 --- a/tests/PKSim.UI.Starter/Views/StarterRelativeExpressionView.Designer.cs +++ /dev/null @@ -1,108 +0,0 @@ -namespace PKSim.UI.Starter.Views -{ - partial class StarterRelativeExpressionView - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.layoutControl = new DevExpress.XtraLayout.LayoutControl(); - this.Root = new DevExpress.XtraLayout.LayoutControlGroup(); - this.panelControl = new DevExpress.XtraEditors.PanelControl(); - this.layoutControlItem1 = new DevExpress.XtraLayout.LayoutControlItem(); - ((System.ComponentModel.ISupportInitialize)(this._errorProvider)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutControl)).BeginInit(); - this.layoutControl.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.Root)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.panelControl)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem1)).BeginInit(); - this.SuspendLayout(); - // - // layoutControl1 - // - this.layoutControl.Controls.Add(this.panelControl); - this.layoutControl.Dock = System.Windows.Forms.DockStyle.Fill; - this.layoutControl.Location = new System.Drawing.Point(0, 0); - this.layoutControl.Name = "layoutControl"; - this.layoutControl.Root = this.Root; - this.layoutControl.Size = new System.Drawing.Size(1266, 958); - this.layoutControl.TabIndex = 38; - this.layoutControl.Text = "layoutControl1"; - // - // Root - // - this.Root.EnableIndentsWithoutBorders = DevExpress.Utils.DefaultBoolean.True; - this.Root.GroupBordersVisible = false; - this.Root.Items.AddRange(new DevExpress.XtraLayout.BaseLayoutItem[] { - this.layoutControlItem1}); - this.Root.Name = "Root"; - this.Root.Size = new System.Drawing.Size(1266, 958); - this.Root.TextVisible = false; - // - // panelControl - // - this.panelControl.Location = new System.Drawing.Point(12, 12); - this.panelControl.Name = "panelControl"; - this.panelControl.Size = new System.Drawing.Size(1242, 934); - this.panelControl.TabIndex = 4; - // - // layoutControlItem1 - // - this.layoutControlItem1.Control = this.panelControl; - this.layoutControlItem1.Location = new System.Drawing.Point(0, 0); - this.layoutControlItem1.Name = "layoutControlItem1"; - this.layoutControlItem1.Size = new System.Drawing.Size(1246, 938); - this.layoutControlItem1.TextSize = new System.Drawing.Size(0, 0); - this.layoutControlItem1.TextVisible = false; - // - // StarterRelativeExpressionView - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Caption = "StarterRelativeExpressionView"; - this.ClientSize = new System.Drawing.Size(1266, 1004); - this.Controls.Add(this.layoutControl); - this.Name = "StarterRelativeExpressionView"; - this.Text = "StarterRelativeExpressionView"; - this.Controls.SetChildIndex(this.layoutControl, 0); - ((System.ComponentModel.ISupportInitialize)(this._errorProvider)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutControl)).EndInit(); - this.layoutControl.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.Root)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.panelControl)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem1)).EndInit(); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private DevExpress.XtraLayout.LayoutControl layoutControl; - private DevExpress.XtraEditors.PanelControl panelControl; - private DevExpress.XtraLayout.LayoutControlGroup Root; - private DevExpress.XtraLayout.LayoutControlItem layoutControlItem1; - } -} \ No newline at end of file diff --git a/tests/PKSim.UI.Starter/Views/StarterRelativeExpressionView.cs b/tests/PKSim.UI.Starter/Views/StarterRelativeExpressionView.cs deleted file mode 100644 index a9719276b..000000000 --- a/tests/PKSim.UI.Starter/Views/StarterRelativeExpressionView.cs +++ /dev/null @@ -1,27 +0,0 @@ -using OSPSuite.Presentation.Views; -using OSPSuite.UI.Extensions; -using OSPSuite.UI.Views; -using PKSim.UI.Starter.Presenters; - -namespace PKSim.UI.Starter.Views -{ - public partial class StarterRelativeExpressionView : BaseModalView, IStarterRelativeExpressionView - { - private IStarterRelativeExpressionPresenter _presenter; - - public StarterRelativeExpressionView() - { - InitializeComponent(); - } - - public void AttachPresenter(IStarterRelativeExpressionPresenter presenter) - { - _presenter = presenter; - } - - public void AddExpressionPresenter(IView view) - { - panelControl.FillWith(view); - } - } -} \ No newline at end of file diff --git a/tests/PKSim.UI.Starter/Views/StarterRelativeExpressionView.resx b/tests/PKSim.UI.Starter/Views/StarterRelativeExpressionView.resx deleted file mode 100644 index 91f678938..000000000 --- a/tests/PKSim.UI.Starter/Views/StarterRelativeExpressionView.resx +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 17, 17 - - \ No newline at end of file diff --git a/tests/PKSim.UI.Starter/app.config b/tests/PKSim.UI.Starter/app.config deleted file mode 100644 index 73b1a1d63..000000000 --- a/tests/PKSim.UI.Starter/app.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/tests/PKSim.UI.Tests/PKSim.UI.Tests.csproj b/tests/PKSim.UI.Tests/PKSim.UI.Tests.csproj index 7d53c29a4..53dfe70cf 100644 --- a/tests/PKSim.UI.Tests/PKSim.UI.Tests.csproj +++ b/tests/PKSim.UI.Tests/PKSim.UI.Tests.csproj @@ -1,32 +1,51 @@  - - net472 - - false - bin\$(Configuration) - - PKSim.UI - - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - - - - - - - - - - - + + net472 + + false + bin\$(Configuration) + + PKSim.UI + + + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + + + + + PreserveNewest + + + + + + + + + + + + \ No newline at end of file diff --git a/tests/PKSim.UI.Tests/UI.StarterTests/ApplicationStartupTests.cs b/tests/PKSim.UI.Tests/UI.StarterTests/ApplicationStartupTests.cs new file mode 100644 index 000000000..74595ffea --- /dev/null +++ b/tests/PKSim.UI.Tests/UI.StarterTests/ApplicationStartupTests.cs @@ -0,0 +1,59 @@ +using FakeItEasy; +using OSPSuite.BDDHelper; +using OSPSuite.BDDHelper.Extensions; +using OSPSuite.Presentation.Views; +using OSPSuite.Utility.Container; +using PKSim.Presentation.Presenters.ExpressionProfiles; +using PKSim.UI.Starter; +using System.Threading; +using PKSim.Core.Mappers; + +namespace PKSim.UI.UI.StarterTests +{ + public class concern_for_ApplicationStartup : StaticContextSpecification + { + protected IContainer _container; + + protected override void Context() + { + SynchronizationContext.SetSynchronizationContext(new TestSynchronizationContext()); + _container = ApplicationStartup.Initialize(A.Fake()); + } + } + + public class When_resolving_the_presenter: concern_for_ApplicationStartup + { + private ICreateExpressionProfilePresenter _presenter; + + protected override void Because() + { + _presenter = _container.Resolve(); + } + + [Observation] + public void the_presenter_should_be_resolved() + { + _presenter.ShouldBeAnInstanceOf(); + } + } + + public class When_resolving_the_building_block_mapper : concern_for_ApplicationStartup + { + private IExpressionProfileToExpressionProfileBuildingBlockMapper _mapper; + + protected override void Because() + { + _mapper = _container.Resolve(); + } + + [Observation] + public void the_mapper_should_be_resolved() + { + _mapper.ShouldBeAnInstanceOf(); + } + } + + public class TestSynchronizationContext : SynchronizationContext + { + } +}