Esempio n. 1
0
 private void ValidationHandler(object sender, ObjectValidatedEventArgs e)
 {
     IEnumerator enumerator = this.fixed1.GetEnumerator();
     while(enumerator.MoveNext()){
         if(enumerator.Current is IFTextBox) {
             IFTextBox tb = (IFTextBox) enumerator.Current;
             if(e.InvalidProperties.Exists(delegate(PropertyStatus ps){ return (ps.PropertyName == tb.PropertyName);})) {
                 tb.ModifyBase(StateType.Normal, new Gdk.Color(249,204,202));
             } else {
                 tb.ModifyBase(StateType.Normal, new Gdk.Color(255,255,255));
             }
         }
     }
 }
 public void SetUp()
 {
     e = new ObjectValidatedEventArgs();
 }
        public bool Validate()
        {
            _objectValidatedEventArgs = new ObjectValidatedEventArgs();

            switch(this.FirstStringInteger) {
            case "Zero":
            case "":
                _firstInteger = 0;
                break;
            case "One":
                _firstInteger = 1;
                break;
            case "Two":
                _firstInteger = 2;
                break;
            case "Three":
                _firstInteger = 3;
                break;
            case "Four":
                _firstInteger = 4;
                break;
            case "Five":
                _firstInteger = 5;
                break;
            default:
                _firstInteger = 0;
                _objectValidatedEventArgs.InvalidProperties.Add(new PropertyStatus("FirstStringInteger", PropertyStatusValues.Errored));
                break;
            }

            switch(this.SecondStringInteger) {
            case "Zero":
            case "":
                _secondInteger = 0;
                break;
            case "One":
                _secondInteger = 1;
                break;
            case "Two":
                _secondInteger = 2;
                break;
            case "Three":
                _secondInteger = 3;
                break;
            case "Four":
                _secondInteger = 4;
                break;
            case "Five":
                _secondInteger = 5;
                break;
            default:
                _secondInteger = 0;
                _objectValidatedEventArgs.InvalidProperties.Add(new PropertyStatus("SecondStringInteger", PropertyStatusValues.Errored));
                break;
            }

            if(5 < this.Result()) {
                _objectValidatedEventArgs.InvalidProperties.Add(new PropertyStatus("FirstStringInteger", PropertyStatusValues.Errored));
                _objectValidatedEventArgs.InvalidProperties.Add(new PropertyStatus("SecondStringInteger", PropertyStatusValues.Errored));
            }

            OnObjectValidated(_objectValidatedEventArgs);
            return true;
        }
 protected virtual void OnObjectValidated(ObjectValidatedEventArgs e)
 {
     if(ObjectValidated != null)
     {
         ObjectValidated(this, e);
     }
 }