示例#1
0
        public override void InitializeBinding()
        {
            base.InitializeBinding();
            _screenBinder.Bind(dto => dto.Name)
            .To(btName)
            .OnValueUpdating += onNameSet;

            _screenBinder.Bind(dto => dto.Group)
            .To(cbGroup)
            .WithValues(dto => _presenter.AllGroups())
            .AndDisplays(g => _presenter.DisplayFor(g))
            .OnValueUpdating += (o, e) => OnEvent(() => _presenter.SetGroup(e.NewValue));

            _screenBinder.Bind(dto => dto.Dimension)
            .To(cbDimension)
            .WithValues(dto => _presenter.AllDimensions())
            .OnValueUpdating += (o, e) => OnEvent(() => _presenter.SetDimension(e.NewValue));

            _screenBinder.Bind(dto => dto.HasRHS)
            .To(chkHasRHS)
            .OnValueUpdating += (o, e) => OnEvent(() => onRHSValueValueSet(o, e.NewValue));

            _screenBinder.Bind(dto => dto.Persistable)
            .To(chkPersistable)
            .OnValueUpdating += (o, e) => OnEvent(() => _presenter.SetPersistable(e.NewValue));

            _screenBinder.Bind(dto => dto.BuildMode)
            .To(cbParameterBuildMode)
            .WithValues(x => _presenter.ParameterBuildModes)
            .OnValueUpdating += onBuildModeSet;

            _screenBinder.Bind(dto => dto.Description)
            .To(htmlEditor)
            .OnValueUpdating += onDescriptionSet;

            _screenBinder.Bind(dto => dto.IsAdvancedParameter)
            .To(chkAdvancedParameter)
            .OnValueUpdating += (o, e) => OnEvent(() => _presenter.SetIsAdvancedParameter(e.NewValue));

            _screenBinder.Bind(dto => dto.CanBeVariedInPopulation)
            .To(chkCanBeVariedInPopulation)
            .OnValueUpdating += (o, e) => OnEvent(() => _presenter.SetIsVariablePopulation(e.NewValue));

            _screenBinder.Bind(dto => dto.IsFavorite)
            .To(chkIsFavorite)
            .OnValueUpdating += (o, e) => OnEvent(() => _presenter.SetIsFavorite(e.NewValue));

            RegisterValidationFor(_screenBinder, NotifyViewChanged);


            btName.ButtonClick += (o, e) => OnEvent(nameButtonClicked, e);
        }
示例#2
0
        public override void InitializeBinding()
        {
            base.InitializeBinding();
            _screenBinder.Bind(dto => dto.Name)
            .To(btName)
            .OnValueUpdating += onNameSet;

            _screenBinder.Bind(dto => dto.Group)
            .To(cbGroup)
            .WithValues(dto => _presenter.AllGroups())
            .AndDisplays(g => _presenter.DisplayFor(g))
            .OnValueUpdating += (o, e) => OnEvent(() => _presenter.SetGroup(e.NewValue));

            _screenBinder.Bind(dto => dto.Dimension)
            .To(cbDimension)
            .WithValues(dto => _presenter.AllDimensions())
            .OnValueUpdating += (o, e) => OnEvent(() => _presenter.SetDimension(e.NewValue));

            _screenBinder.Bind(dto => dto.HasRHS)
            .To(chkHasRHS)
            .OnValueUpdating += (o, e) => OnEvent(() => onRHSValueValueSet(o, e.NewValue));

            _screenBinder.Bind(dto => dto.Persistable)
            .To(chkPersistable)
            .OnValueUpdating += (o, e) => OnEvent(() => _presenter.SetPersistable(e.NewValue));

            _screenBinder.Bind(dto => dto.BuildMode)
            .To(cbParameterBuildMode)
            .WithValues(x => _presenter.ParameterBuildModes)
            .OnValueUpdating += onBuildModeSet;

            _screenBinder.Bind(dto => dto.Description)
            .To(htmlEditor)
            .OnValueUpdating += onDescriptionSet;

            _screenBinder.Bind(dto => dto.IsAdvancedParameter)
            .To(chkAdvancedParameter)
            .OnValueUpdating += (o, e) => OnEvent(() => _presenter.SetIsAdvancedParameter(e.NewValue));

            _screenBinder.Bind(dto => dto.CanBeVariedInPopulation)
            .To(chkCanBeVariedInPopulation)
            .OnValueUpdating += (o, e) => OnEvent(() => _presenter.SetIsVariablePopulation(e.NewValue));

            _screenBinder.Bind(dto => dto.IsFavorite)
            .To(chkIsFavorite)
            .OnValueUpdating += (o, e) => OnEvent(() => _presenter.SetIsFavorite(e.NewValue));

            RegisterValidationFor(_screenBinder, NotifyViewChanged);

            _gridBinder.Bind(tag => tag.Value).WithCaption(AppConstants.Captions.Tag).AsReadOnly();
            var buttonRepository = createAddRemoveButtonRepository();

            buttonRepository.ButtonClick += (o, e) => OnEvent(() => onButtonClicked(e, _gridBinder.FocusedElement));

            _gridBinder.AddUnboundColumn()
            .WithCaption(OSPSuite.UI.UIConstants.EMPTY_COLUMN)
            .WithShowButton(ShowButtonModeEnum.ShowAlways)
            .WithRepository(dto => buttonRepository)
            .WithFixedWidth(OSPSuite.UI.UIConstants.Size.EMBEDDED_BUTTON_WIDTH * 2);

            btAddTag.Click     += (o, e) => OnEvent(_presenter.AddNewTag);
            btName.ButtonClick += (o, e) => OnEvent(nameButtonClicked, e);
        }