Пример #1
0
 /// <summary>
 /// Adds an item for the error messages from the specified validation. If there aren't any error messages, the control getter is not called and no item is
 /// added.
 /// </summary>
 public void AddModificationErrorItem(EwfValidation validation, ErrorDisplayStyle displayStyle)
 {
     items.Add(
         Tuple.Create(
             new Func <ControlListItem>(
                 () => {
         var errors = EwfPage.Instance.AddModificationErrorDisplayAndGetErrors(this, modErrorDisplayKeySuffix++.ToString(), validation);
         return(new ControlListItem(displayStyle.GetControls(errors)));
     }),
             true));
 }
 /// <summary>
 /// Adds an item for the error messages from the specified validation. If there aren't any error messages, the control getter is not called and no item is
 /// added.
 /// </summary>
 public void AddModificationErrorItem(EwfValidation validation, Func <IEnumerable <string>, IEnumerable <Control> > controlGetter)
 {
     items.Add(
         Tuple.Create(
             new Func <ControlListItem>(
                 () => {
         var errors = EwfPage.Instance.AddModificationErrorDisplayAndGetErrors(this, modErrorDisplayKeySuffix++.ToString(), validation);
         return(new ControlListItem(errors.Any() ? controlGetter(errors) : new Control[0]));
     }),
             true));
 }
 /// <summary>
 /// Adds an item for the error messages from the specified validation. If there aren't any error messages, the control getter is not called and no item is
 /// added.
 /// </summary>
 public void AddModificationErrorItem(EwfValidation validation, ErrorDisplayStyle <FlowComponent> displayStyle)
 {
     items.Add(
         Tuple.Create(
             new Func <ControlListItem>(
                 () => {
         var errors = EwfPage.Instance.AddModificationErrorDisplayAndGetErrors(this, modErrorDisplayKeySuffix++.ToString(), validation);
         if (errors.Any())
         {
             EwfPage.Instance.ValidationsWithErrors.Add(validation);
         }
         return(new ControlListItem(
                    errors.Any()
                                                                 ? new PlaceHolder().AddControlsReturnThis(
                        displayStyle.GetComponents(
                            new ErrorSourceSet(validations: validation.ToCollection()),
                            errors.Select(i => new TrustedHtmlString(HttpUtility.HtmlEncode(i))),
                            true)
                        .GetControls())
                    .ToCollection()
                                                                 : Enumerable.Empty <Control>()));
     }),
             true));
 }
 internal LabeledControl(Control label, Control control, EwfValidation validation)
 {
     this.label = label;
     wrappedControls.Add(control);
     this.validation = validation;
 }
 internal LabeledControl( Control label, Control control, EwfValidation validation )
 {
     this.label = label;
     wrappedControls.Add( control );
     this.validation = validation;
 }
 /// <summary>
 /// Adds an item for the error messages from the specified validation. If there aren't any error messages, the control getter is not called and no item is
 /// added.
 /// </summary>
 public void AddModificationErrorItem( EwfValidation validation, ErrorDisplayStyle displayStyle )
 {
     items.Add(
         Tuple.Create(
             new Func<ControlListItem>(
                 () => {
                     var errors = EwfPage.Instance.AddModificationErrorDisplayAndGetErrors( this, modErrorDisplayKeySuffix++.ToString(), validation );
                     return new ControlListItem( displayStyle.GetControls( errors ) );
                 } ),
             true ) );
 }
 /// <summary>
 /// Adds an item for the error messages from the specified validation. If there aren't any error messages, the control getter is not called and no item is
 /// added.
 /// </summary>
 public void AddModificationErrorItem( EwfValidation validation, Func<IEnumerable<string>, IEnumerable<Control>> controlGetter )
 {
     items.Add(
         Tuple.Create(
             new Func<ControlListItem>(
                 () => {
                     var errors = EwfPage.Instance.AddModificationErrorDisplayAndGetErrors( this, modErrorDisplayKeySuffix++.ToString(), validation );
                     return new ControlListItem( errors.Any() ? controlGetter( errors ) : new Control[ 0 ] );
                 } ),
             true ) );
 }