Skip to content

Commit

Permalink
Fixes #2143 missing icons (#2146)
Browse files Browse the repository at this point in the history
* Fixes #2143 missing icons

* Fixes #2143 missing icons
  • Loading branch information
msevestre authored Mar 28, 2022
1 parent d97339c commit 6e30306
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 12 deletions.
11 changes: 11 additions & 0 deletions src/PKSim.Presentation/DTO/Simulations/IWithImageDTO.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using System.Drawing;
using DevExpress.XtraEditors.DXErrorProvider;
using OSPSuite.Assets;

namespace PKSim.Presentation.DTO.Simulations
{
public interface IWithImageDTO : IDXDataErrorInfo
{
Image Image { get; }
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Drawing;
using DevExpress.XtraEditors.DXErrorProvider;
using OSPSuite.Assets;
using OSPSuite.Utility.Reflection;
Expand All @@ -7,7 +8,7 @@

namespace PKSim.Presentation.DTO.Simulations
{
public class SimulationPartialProcessSelectionDTO : Notifier, IDXDataErrorInfo
public class SimulationPartialProcessSelectionDTO : Notifier, IWithImageDTO
{
public SimulationPartialProcess SimulationPartialProcess { get; }

Expand Down Expand Up @@ -36,7 +37,7 @@ public SimulationPartialProcessSelectionDTO(SimulationPartialProcess simulationP
/// Status of the selection (Image that will be displayed to the end user indicating if the mapping
/// appears to be allowed or not)
/// </summary>
public ApplicationIcon Image => imageFrom(Status);
public Image Image => imageFrom(Status).ToImage();

public void GetPropertyError(string propertyName, ErrorInfo info)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

namespace PKSim.Presentation.DTO.Simulations
{
public class SimulationSystemicProcessSelectionDTO : Notifier, IDXDataErrorInfo
public class SimulationSystemicProcessSelectionDTO : Notifier, IWithImageDTO
{
public SystemicProcessType SystemicProcessType { get; set; }
private SystemicProcess _selectedProcess;
Expand All @@ -17,7 +17,9 @@ public class SimulationSystemicProcessSelectionDTO : Notifier, IDXDataErrorInfo
/// Status of the selection (Image that will be displayed to the end user indicating if the mapping
/// appears to be allowed or not)
/// </summary>
public ApplicationIcon Image
public Image Image => imageFromType.ToImage();

private ApplicationIcon imageFromType
{
get
{
Expand All @@ -30,7 +32,6 @@ public ApplicationIcon Image
return ApplicationIcons.OK;
}
}

public SystemicProcess SelectedProcess
{
get => _selectedProcess;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using DevExpress.XtraGrid.Views.Base;
using OSPSuite.DataBinding.DevExpress;
using OSPSuite.DataBinding.DevExpress.XtraGrid;
using OSPSuite.UI;
using OSPSuite.UI.Controls;
using OSPSuite.UI.Extensions;
using OSPSuite.UI.RepositoryItems;
Expand Down
10 changes: 4 additions & 6 deletions src/PKSim.UI/Views/Simulations/SimulationCompoundProcessView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,10 @@
using OSPSuite.Assets;
using OSPSuite.DataBinding.DevExpress;
using OSPSuite.DataBinding.DevExpress.XtraGrid;
using OSPSuite.UI;
using OSPSuite.UI.Controls;
using OSPSuite.UI.Extensions;
using OSPSuite.UI.RepositoryItems;
using PKSim.Assets;
using PKSim.Core;
using PKSim.Core.Model;
using PKSim.Presentation.DTO.Simulations;
using PKSim.Presentation.Presenters.Simulations;
Expand All @@ -30,7 +28,7 @@ public partial class SimulationCompoundProcessView<TPartialProcess, TPartialProc
where TPartialProcess : PartialProcess
{
private readonly UxRepositoryItemComboBox _compoundMoleculeRepository;
private readonly RepositoryItemPictureEdit _statusIconRepository;
private readonly RepositoryItemPictureEdit _imageRepository;
private readonly UxRepositoryItemComboBox _systemicProcessRepository;
private readonly RepositoryItemTextEdit _repositoryItemDisabled = new RepositoryItemTextEdit {Enabled = false, ReadOnly = true};
protected readonly GridViewBinder<TPartialProcessDTO> _gridViewPartialBinder;
Expand All @@ -45,7 +43,7 @@ public SimulationCompoundProcessView()
InitializeComponent();
_compoundMoleculeRepository = new UxRepositoryItemComboBox(gridViewPartialProcesses);
_systemicProcessRepository = new UxRepositoryItemComboBox(gridViewSystemicProcesses);
_statusIconRepository = new RepositoryItemPictureEdit();
_imageRepository = new RepositoryItemPictureEdit();
gridViewSystemicProcesses.AllowsFiltering = false;
gridViewSystemicProcesses.HorzScrollVisibility = ScrollVisibility.Never;
gridViewPartialProcesses.AllowsFiltering = false;
Expand Down Expand Up @@ -108,7 +106,7 @@ protected virtual void InitializeSystemicBinding()
{
_gridViewSystemicBinder.Bind(x => x.Image)
.WithCaption(PKSimConstants.UI.EmptyColumn)
.WithRepository(dto => _statusIconRepository)
.WithRepository(dto => _imageRepository)
.WithFixedWidth(EMBEDDED_BUTTON_WIDTH)
.AsReadOnly();

Expand Down Expand Up @@ -152,7 +150,7 @@ protected IGridViewColumn BindToPartialImage()
{
return _gridViewPartialBinder.Bind(x => x.Image)
.WithCaption(PKSimConstants.UI.EmptyColumn)
.WithRepository(dto => _statusIconRepository)
.WithRepository(dto => _imageRepository)
.WithFixedWidth(EMBEDDED_BUTTON_WIDTH)
.AsReadOnly();
}
Expand Down

0 comments on commit 6e30306

Please sign in to comment.