Пример #1
0
        protected void UpdateText()
        {
            if (AssociatedObject.EditMode != EditMode.InplaceInactive)
            {
                return;
            }

            BaseEditHelper.UpdateHighlightingText(AssociatedObject, new TextHighlightingProperties(HighlightedText, FilterCondition.Contains));
        }
Пример #2
0
        public void ShowErrorCallBack(bool isPasswordField, string errorMessage)
        {
            BaseValidationError error = null;

            if (errorMessage != null)
            {
                error = new BaseValidationError(errorMessage, null, ErrorType.Warning);
            }

            if (isPasswordField)
            {
                BaseEditHelper.SetValidationError(txtPassword, error);
            }
            else
            {
                BaseEditHelper.SetValidationError(txtUsername, error);
            }
        }
Пример #3
0
 private static void EnableDisableControl(Control ctrl, bool enable)
 {
     if (!(ctrl is GroupBox) && !(ctrl is GroupControl) && !(ctrl is Panel))
     {
         if (ctrl is BaseEdit)
         {
             BaseEditHelper.GetBaseEditHelper(false).SetReadonly(ctrl, !enable);
         }
         else if (ctrl is VGridControl)
         {
             var vGrid = ctrl as VGridControl;
             VGridControlHelper.SetReadOnly(vGrid, enable);
         }
         else
         {
             ctrl.Enabled = enable;
         }
     }
 }
        public override DataTemplate SelectTemplate(object item, DependencyObject container)
        {
            try
            {
                var cellData = item as GridCellData;
                if (cellData?.RowData?.RowHandle != null && cellData.RowData.RowHandle.Value != DataControlBase.AutoFilterRowHandle && cellData.RowData?.Row != null)
                {
                    var column = cellData.Column;
                    if (column != null)
                    {
                        var row = cellData.RowData.Row as PmConfiguratorData;
                        if (!string.IsNullOrEmpty(column.FieldName) && row?.Owner != null)
                        {
                            if (!row.Owner.ValidatePmMethods(column.FieldName, row))
                            {
                                if (IsNotAccessible(cellData.Value as List <object>))
                                {
                                    return(NotAllowedPmMethodsCellTemplate);
                                }

                                var validationError = BaseEdit.GetValidationError(cellData);
                                if (validationError == null)
                                {
                                    var newError =
                                        new GridCellValidationError(
                                            Properties.Resources.PmMethodIsUnavailableButExists,
                                            null,
                                            ErrorType.Critical, cellData.RowData.RowHandle.Value,
                                            (GridColumn)column);
                                    BaseEditHelper.SetValidationError(cellData, newError);
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                _log.WarnFormat("Error in PmMethodCellTemplateSelector {0}", ExceptionHelper.ExceptionToString(ex));
                _log.Debug(ex);
            }
            return(base.SelectTemplate(item, container));
        }