diff --git a/src/PKSim.Presentation/DTO/Simulations/SimulationIntervalDTO.cs b/src/PKSim.Presentation/DTO/Simulations/SimulationIntervalDTO.cs deleted file mode 100644 index 1ad127c93..000000000 --- a/src/PKSim.Presentation/DTO/Simulations/SimulationIntervalDTO.cs +++ /dev/null @@ -1,62 +0,0 @@ -using OSPSuite.Core.Domain; -using OSPSuite.Presentation.DTO; -using OSPSuite.Utility.Validation; -using PKSim.Assets; -using PKSim.Presentation.DTO.Parameters; - -namespace PKSim.Presentation.DTO.Simulations -{ - public class SimulationIntervalDTO : ValidatableDTO - { - public OutputInterval SimulationInterval { get; set; } - public ParameterDTO StartTimeParameter { get; set; } - public ParameterDTO EndTimeParameter { get; set; } - public ParameterDTO ResolutionParameter { get; set; } - - public SimulationIntervalDTO() - { - Rules.Add(startTimeLessThanEndTime); - Rules.Add(endTimeGreaterThanStartTime); - } - - public double StartTime - { - get { return StartTimeParameter.Value; } - set { StartTimeParameter.Value = value; } - } - - public double EndTime - { - get { return EndTimeParameter.Value; } - set { EndTimeParameter.Value = value; } - } - - public double Resolution - { - get { return ResolutionParameter.Value; } - set { ResolutionParameter.Value = value; } - } - - private IBusinessRule startTimeLessThanEndTime - { - get - { - return CreateRule.For() - .Property(x => x.StartTime) - .WithRule((dto, value) => StartTimeParameter.Parameter.ConvertToBaseUnit(value) < EndTimeParameter.KernelValue) - .WithError(PKSimConstants.Rules.Parameter.StartTimeLessThanOrEqualToEndTime); - } - } - - private IBusinessRule endTimeGreaterThanStartTime - { - get - { - return CreateRule.For() - .Property(x => x.EndTime) - .WithRule((dto, value) => EndTimeParameter.Parameter.ConvertToBaseUnit(value) > StartTimeParameter.KernelValue) - .WithError(PKSimConstants.Rules.Parameter.EndTimeGreaterThanOrEqualToStartTime); - } - } - } -} \ No newline at end of file diff --git a/src/PKSim.UI/Views/Compounds/CompoundParameterWithDefaultAlternativeBaseView.cs b/src/PKSim.UI/Views/Compounds/CompoundParameterWithDefaultAlternativeBaseView.cs index 7ed4e762b..211b76515 100644 --- a/src/PKSim.UI/Views/Compounds/CompoundParameterWithDefaultAlternativeBaseView.cs +++ b/src/PKSim.UI/Views/Compounds/CompoundParameterWithDefaultAlternativeBaseView.cs @@ -111,7 +111,13 @@ protected override bool ColumnIsButton(GridColumn column) { return Equals(_colButtons?.XtraColumn, column); } - + + + protected override bool ColumnIsCheckBox(GridColumn column) + { + return Equals(_colDefault?.XtraColumn, column); + } + public override void InitializeResources() { base.InitializeResources(); diff --git a/src/PKSim.UI/Views/Core/BaseUserControlWithValueInGrid.cs b/src/PKSim.UI/Views/Core/BaseUserControlWithValueInGrid.cs index 689e9ee22..05480c15d 100644 --- a/src/PKSim.UI/Views/Core/BaseUserControlWithValueInGrid.cs +++ b/src/PKSim.UI/Views/Core/BaseUserControlWithValueInGrid.cs @@ -40,6 +40,12 @@ protected virtual void OnGridViewMouseDown(UxGridView gridView, MouseEventArgs e return; } + if (ColumnIsCheckBox(col)) + { + RaiseCheckEditClick(gridView, col, rowHandle, e); + return; + } + if (!ColumnIsValue(col)) { gridView.EditorShowMode = EditorShowMode.Default; @@ -65,14 +71,24 @@ protected virtual void RaiseButtonClick(UxGridView gridView, GridColumn column, edit.PerformClick(ehi.HitObject.DowncastTo().Button); ((DXMouseEventArgs)e).Handled = true; } - return; } - protected virtual bool ColumnIsButton(GridColumn column) + protected virtual void RaiseCheckEditClick(UxGridView gridView, GridColumn column, int rowHandle, MouseEventArgs e) { - return false; + //Adapted from https://supportcenter.devexpress.com/ticket/details/t230842/grid-the-buttonclick-event-is-not-raised-immediately-when-multi-selection-is-enabled + gridView.FocusedRowHandle = rowHandle; + gridView.FocusedColumn = column; + gridView.ShowEditor(); + //force button click + var edit = gridView.ActiveEditor.DowncastTo(); + edit.Toggle(); + ((DXMouseEventArgs) e).Handled = true; } - + + protected virtual bool ColumnIsButton(GridColumn column) => false; + + protected virtual bool ColumnIsCheckBox(GridColumn column) => false; + protected virtual void OnValueColumnMouseDown(UxGridView gridView, GridColumn col, int rowHandle) { gridView.EditorShowMode = EditorShowMode.MouseUp;