private void initNameEdit(MoleculeBuilderDTO moleculeBuilder) { var name = moleculeBuilder.Name; var nameIsSet = name.IsNullOrEmpty(); btName.Properties.ReadOnly = !nameIsSet; btName.Properties.Buttons[0].Visible = !nameIsSet; }
protected override void Context() { base.Context(); _moleculeBuilderDTO = new MoleculeBuilderDTO(); _transporterMolecule = new TransporterMoleculeContainerDTO().WithName("aa").WithId("bb"); _interactionContainer = new InteractionContainerDTO().WithName("cc").WithId("dd"); _moleculeBuilderDTO.TransporterMolecules = new [] { _transporterMolecule }; _moleculeBuilderDTO.InteractionContainerCollection = new[] { _interactionContainer }; }
public void Show(MoleculeBuilderDTO moleculeBuilder) { _screenBinder.BindToSource(moleculeBuilder); _gridBinder.BindToSource(moleculeBuilder.UsedCalculationMethods); initNameEdit(moleculeBuilder); var size = layoutControlItemCalculationMethod.Size; size.Height = grdCalculationMethodsView.ColumnPanelRowHeight + 3 * 24; layoutControlItemCalculationMethod.MaxSize = size; }
public IMoleculeTreeNode MapFrom(MoleculeBuilderDTO input) { var node = new MoleculeTreeNode(input) { Text = input.Name, Icon = ApplicationIcons.IconByName(input.Icon) }; var children = input.TransporterMolecules.MapAllUsing(_activeTransportBuilderContaienrToMolceculeTreeNodeMapper).ToList(); children = children.Union(input.InteractionContainerCollection.MapAllUsing(_interactionContainerMapper)).ToList(); children.Each(node.AddChild); return(node); }
public IMoleculeBuilder CreateMolecule(IMoleculeBuildingBlock moleculeBuildingBlock) { _moleculeBuildingBlock = moleculeBuildingBlock; _molecule = loadMoleculeFromTemplate(); _moleculeDTO = moleculeBuilderDTOFrom(_molecule); _view.BindTo(_moleculeDTO); _view.Display(); if (_view.Canceled) { return(null); } _molecule.Name = _moleculeDTO.Name; return(_molecule); }
protected override void Context() { base.Context(); _templateFileName = "Template"; _templateParameterToEdit = new Parameter { Formula = new ConstantFormula(double.NaN), Visible = true, Name = "P1" }; _templateParameterToHide = new Parameter { Formula = new ConstantFormula(double.NaN), Visible = false, Name = "P2" }; _aFormulaParameterToHide = new Parameter { Visible = true, Name = "P3" }; _templateMoleculeBuilder = new MoleculeBuilder { _templateParameterToEdit, _templateParameterToHide, _aFormulaParameterToHide }; _parameterDTO = new ParameterDTO(_templateParameterToEdit); A.CallTo(() => _configuration.StandardMoleculeTemplateFile).Returns(_templateFileName); A.CallTo(() => _serializationTask.Load <IMoleculeBuilder>(_templateFileName, true)).Returns(_templateMoleculeBuilder); A.CallTo(() => _moleculeBuilderMapper.MapFrom(_templateMoleculeBuilder)).Returns(new MoleculeBuilderDTO()); A.CallTo(() => _view.BindTo(A <MoleculeBuilderDTO> ._)) .Invokes(x => _dto = x.GetArgument <MoleculeBuilderDTO>(0)); A.CallTo(() => _parameterDTOMapper.MapFrom(_templateParameterToEdit)).Returns(_parameterDTO); A.CallTo(_editTask).WithReturnType <IEnumerable <string> >().Returns(new [] { "A", "B" }); }
public void BindTo(MoleculeBuilderDTO moleculeBuilderDTO) { _gridViewBinder.BindToSource(moleculeBuilderDTO.Parameters); _screenBinder.BindToSource(moleculeBuilderDTO); }
private void OnValueUpdating <T>(MoleculeBuilderDTO moleculeBuilder, PropertyValueSetEventArgs <T> value) { _screenBinder.Validate(); this.DoWithinExceptionHandler(() => _presenter.SetPropertyValueFromView(value.PropertyName, value.NewValue, value.OldValue)); }
private void onIsPresentValueSet(MoleculeBuilderDTO moleculeBuilder, PropertyValueSetEventArgs <bool> value) { _presenter.SetStationaryProperty(value.NewValue, value.OldValue); }
protected override void Because() { _result = sut.MapFrom(_moleculeBuilder); }