private void setDisplayValue(ValueEditDTO valueEditDTO, double newValueInDisplayUnit, Unit displayUnit) { var oldDisplayUnit = valueEditDTO.DisplayUnit; valueEditDTO.DisplayUnit = displayUnit; valueEditDTO.Value = newValueInDisplayUnit; this.DoWithinLatch(() => AddCommand(_moBiFormulaTask.SetConstantFormulaValue(_formula, valueEditDTO.KernelValue, displayUnit, oldDisplayUnit, BuildingBlock, _formulaOwner))); }
public void SetDisplayUnit(ValueEditDTO valueEditDTO, Unit newDisplayUnit) { setDisplayValue(valueEditDTO, valueEditDTO.Value, newDisplayUnit); var withDisplayUnit = _formulaOwner as IWithDisplayUnit; if (withDisplayUnit != null) { withDisplayUnit.DisplayUnit = newDisplayUnit; } }
private void onValueUpdating(ValueEditDTO dto, PropertyValueSetEventArgs <double> e) { // Some artifact with this control when values have a lot of digits could lead to an event being raised even though nothing has changed. // This should be fixed in OSPSuite.DataBinding but we'll be done at another time if (ValueComparer.AreValuesEqual(e.OldValue, e.NewValue)) { return; } ValueChanged(dto, e.NewValue); }
public void BindTo(ValueEditDTO value) { if (Equals(value, _valueEditDTO)) { _screenBinder.Update(); } else { _valueEditDTO = value; _screenBinder.BindToSource(_valueEditDTO); } }
public ConstantFormulaBuilderDTO MapFrom(ConstantFormula constantFormula, Unit displayUnit) { var dto = Map <ConstantFormulaBuilderDTO>(constantFormula); dto.Dimension = constantFormula.Dimension ?? _dimensionFactory.Dimension(Constants.Dimension.DIMENSIONLESS); //set the kernel value after the fact (afer display unit); var valueDTO = new ValueEditDTO { Dimension = dto.Dimension, DisplayUnit = displayUnit, KernelValue = constantFormula.Value }; constantFormula.Changed += o => { valueDTO.KernelValue = constantFormula.Value; }; dto.Value = valueDTO; return(dto); }
private void onValueUpdating(ValueEditDTO valueEditDTO, double value) { this.DoWithinExceptionHandler(() => _presenter.SetDisplayValue(valueEditDTO, value)); }
private void onUnitChange(ValueEditDTO valueEditDTO, Unit unit) { this.DoWithinExceptionHandler(() => _presenter.SetDisplayUnit(valueEditDTO, unit)); }
public void SetDisplayValue(ValueEditDTO valueEditDTO, double newValueInDisplayUnit) { setDisplayValue(valueEditDTO, newValueInDisplayUnit, valueEditDTO.DisplayUnit); }
private void parameterUnitSet(ValueEditDTO valueEditDTO, Unit unit) { OnEvent(() => _presenter.SetParameterUnit(valueEditDTO.DowncastTo <DistributionParameterDTO>(), unit)); }
private void parameterValueSet(ValueEditDTO valueEditDTO, double valueInGuiUnit) { OnEvent(() => _presenter.SetParameterValue(valueEditDTO.DowncastTo <DistributionParameterDTO>(), valueInGuiUnit)); }