Esempio n. 1
0
        public override void InitializeBinding()
        {
            base.InitializeBinding();

            _screenBinder = new ScreenBinder <EventBuilderDTO>();
            _screenBinder.Bind(dto => dto.Name).To(btName).OnValueUpdating            += onPropertyValueSet;
            _screenBinder.Bind(dto => dto.Description).To(htmlEditor).OnValueUpdating += onPropertyValueSet;
            _screenBinder.Bind(dto => dto.OneTime).To(chkOneTime).OnValueUpdating     += onPropertyValueSet;
            _screenBinder.Bind(dto => dto.Condition).To(cmbCondition)
            .WithValues(dto => _presenter.AllFormulaNames())
            .OnValueUpdating += onConditionFormulaNameSet;

            _gridBinder = new GridViewBinder <EventAssignmentBuilderDTO>(gridViewAssignments);
            var selectButtonRepository = createSelectButtonRepository();

            selectButtonRepository.ButtonClick += (o, e) => onSelectButtonClick(_gridBinder.FocusedElement);

            _gridBinder.Bind(dto => dto.ChangedEntityPath)
            .WithCaption(AppConstants.Captions.ChangedEntityPath)
            .WithOnValueUpdating((dto, e) => OnEvent(() => _presenter.SetChangedEntityPath(e.NewValue, dto)))
            .WithRepository(d => selectButtonRepository)
            .WithShowButton(ShowButtonModeEnum.ShowAlways);

            _gridBinder.Bind(dto => dto.NewFormula)
            .WithCaption(AppConstants.Captions.NewFormula)
            .WithRepository(d => getFormulaRepository(gridViewAssignments))
            .WithOnValueUpdating(onAssignmentFormulaSet);

            _gridBinder.Bind(dto => dto.UseAsValue)
            .WithCaption(AppConstants.Captions.UseAsValue)
            .OnValueUpdating += onAssignmentPropertySet;

            var buttonRepository = createAddRemoveButtonRepository();

            _gridBinder.AddUnboundColumn()
            .WithCaption(OSPSuite.UI.UIConstants.EMPTY_COLUMN)
            .WithShowButton(ShowButtonModeEnum.ShowAlways)
            .WithRepository(dto => buttonRepository)
            .WithFixedWidth(OSPSuite.UI.UIConstants.Size.EMBEDDED_BUTTON_WIDTH * 2);
            buttonRepository.ButtonClick += (o, e) => onButtonClicked(e, _gridBinder.FocusedElement);

            RegisterValidationFor(_screenBinder, NotifyViewChanged);
        }