Ejemplo n.º 1
0
 public void EhView_ValidatingValue1(ValidationEventArgs <string> e)
 {
     if (!int.TryParse(e.ValueToValidate, out var val))
     {
         e.AddError("Value has to be a valid integer");
     }
 }
Ejemplo n.º 2
0
 private void EhScaleSpanValidating(object sender, ValidationEventArgs <string> e)
 {
     if (!double.TryParse(e.ValueToValidate, System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.CurrentUICulture, out _lastConvertedScaleSpan))
     {
         e.AddError("The entered text could not be converted to a numeric value");
         return;
     }
 }
Ejemplo n.º 3
0
		private void _edDivideBy_Validating(object sender, ValidationEventArgs<string> e)
		{
			var c = new System.ComponentModel.CancelEventArgs();
			if (null != DivideByValidating)
				DivideByValidating(_edDivideBy.Text, c);
			if (c.Cancel)
				e.AddError("The provided text can not be converted");
		}
Ejemplo n.º 4
0
		private void _edColumnSpacing_Validating(object sender, ValidationEventArgs<string> e)
		{
			bool Cancel = false;
			if (null != _controller)
				Cancel |= _controller.EhColumnSpacingChanged(e.ValueToValidate);
			if (Cancel)
				e.AddError("The provided string could not be converted to a numeric value");
		}
Ejemplo n.º 5
0
        public void EhValidatingXEnd(ValidationEventArgs <string> e)
        {
            _xEnd = null;
            if (!Altaxo.Serialization.GUIConversion.IsDouble(e.ValueToValidate, out var var))
            {
                e.AddError("Value has to be a number");
                return;
            }

            if (!var.IsFinite())
            {
                e.AddError("Value has to be a finite number");
                return;
            }

            _xEnd = var;
        }
Ejemplo n.º 6
0
        public void EhValidatingNumberOfPoints(ValidationEventArgs <string> e)
        {
            _numberOfPoints = null;
            if (!Altaxo.Serialization.GUIConversion.IsInteger(e.ValueToValidate, out var var))
            {
                e.AddError("Value has to be an integer!");
                return;
            }

            if (var < 2)
            {
                e.AddError("Value has to be >=2");
                return;
            }

            _numberOfPoints = var;
        }
Ejemplo n.º 7
0
		private void _edTopMargin_Validating(object sender, ValidationEventArgs<string> e)
		{
			bool Cancel = false;
			if (_controller != null)
				Cancel |= _controller.EhTopMarginChanged(e.ValueToValidate);

			if (Cancel)
				e.AddError("The provided string could not be converted to a numeric value");
		}
Ejemplo n.º 8
0
        private void _edDivideBy_Validating(object sender, ValidationEventArgs <string> e)
        {
            var c = new System.ComponentModel.CancelEventArgs();

            if (null != DivideByValidating)
            {
                DivideByValidating(_edDivideBy.Text, c);
            }
            if (c.Cancel)
            {
                e.AddError("The provided text can not be converted");
            }
        }
Ejemplo n.º 9
0
        private void _edColumnSpacing_Validating(object sender, ValidationEventArgs <string> e)
        {
            bool Cancel = false;

            if (null != _controller)
            {
                Cancel |= _controller.EhColumnSpacingChanged(e.ValueToValidate);
            }
            if (Cancel)
            {
                e.AddError("The provided string could not be converted to a numeric value");
            }
        }
Ejemplo n.º 10
0
        private void _edTopMargin_Validating(object sender, ValidationEventArgs <string> e)
        {
            bool Cancel = false;

            if (_controller != null)
            {
                Cancel |= _controller.EhTopMarginChanged(e.ValueToValidate);
            }

            if (Cancel)
            {
                e.AddError("The provided string could not be converted to a numeric value");
            }
        }
Ejemplo n.º 11
0
 public override void EhView_ValidatingValue1(ValidationEventArgs <string> e)
 {
     if (Altaxo.Serialization.GUIConversion.IsDouble(e.ValueToValidate, out var vald))
     {
         if (vald < _minimumValue || (!_isMinimumValueIncluded && vald == _minimumValue))
         {
             e.AddError("Value must be {0} than {1}!", (_isMinimumValueIncluded ? "greater or equal" : "greater"), Altaxo.Serialization.GUIConversion.ToString(_minimumValue));
         }
         else if (vald > _maximumValue || (!_isMaximumValueIncluded && vald == _maximumValue))
         {
             e.AddError("Value must be {0} than {1}!", (_isMaximumValueIncluded ? "less or equal" : "less"), Altaxo.Serialization.GUIConversion.ToString(_maximumValue));
         }
         else
         {
             _value1DoubleTemporary = vald;
             return;
         }
     }
     else
     {
         e.AddError("Value must be a valid numeric string");
     }
 }
Ejemplo n.º 12
0
		public override void EhView_ValidatingValue1(ValidationEventArgs<string> e)
		{
			double vald;
			if (Altaxo.Serialization.GUIConversion.IsDouble(e.ValueToValidate, out vald))
			{
				if (vald < _minimumValue || (!_isMinimumValueIncluded && vald == _minimumValue))
				{
					e.AddError("Value must be {0} than {1}!", (_isMinimumValueIncluded ? "greater or equal" : "greater"), Altaxo.Serialization.GUIConversion.ToString(_minimumValue));
				}
				else if (vald > _maximumValue || (!_isMaximumValueIncluded && vald == _maximumValue))
				{
					e.AddError("Value must be {0} than {1}!", (_isMaximumValueIncluded ? "less or equal" : "less"), Altaxo.Serialization.GUIConversion.ToString(_maximumValue));
				}
				else
				{
					_value1DoubleTemporary = vald;
					return;
				}
			}
			else
			{
				e.AddError("Value must be a valid numeric string");
			}
		}
Ejemplo n.º 13
0
 public void EhView_ValidatingValue1(ValidationEventArgs <string> e)
 {
     _isContentsValid = true;
     _contents        = e.ValueToValidate;
     if (_validator != null)
     {
         string err = _validator.Validate(_contents);
         if (null != err)
         {
             _isContentsValid = false;
             e.AddError(err);
             return;
         }
     }
     else // if no validating handler, use some default validation
     {
         if (null == _contents || 0 == _contents.Length)
         {
             _isContentsValid = false;
             e.AddError("You have to enter a value!");
             return;
         }
     }
 }
Ejemplo n.º 14
0
		public void EhView_ValidatingValue1(ValidationEventArgs<string> e)
		{
			int val;
			if (!int.TryParse(e.ValueToValidate, out val))
				e.AddError("Value has to be a valid integer");
		}
Ejemplo n.º 15
0
		public void EhView_ValidatingValue1(ValidationEventArgs<string> e)
		{
			_isContentsValid = true;
			m_Contents = e.ValueToValidate;
			if (m_Validator != null)
			{
				string err = m_Validator.Validate(m_Contents);
				if (null != err)
				{
					_isContentsValid = false;
					e.AddError(err);
					return;
				}
			}
			else // if no validating handler, use some default validation
			{
				if (null == m_Contents || 0 == m_Contents.Length)
				{
					_isContentsValid = false;
					e.AddError("You have to enter a value!");
					return;
				}
			}
		}
Ejemplo n.º 16
0
		public void EhValidatingNumberOfPoints(ValidationEventArgs<string> e)
		{
			_numberOfPoints = null;
			int var;
			if (!Altaxo.Serialization.GUIConversion.IsInteger(e.ValueToValidate, out var))
			{
				e.AddError("Value has to be an integer!");
				return;
			}

			if (var < 2)
			{
				e.AddError("Value has to be >=2");
				return;
			}

			_numberOfPoints = var;
		}
Ejemplo n.º 17
0
		public void EhValidatingXEnd(ValidationEventArgs<string> e)
		{
			_xEnd = null;
			double var;
			if (!Altaxo.Serialization.GUIConversion.IsDouble(e.ValueToValidate, out var))
			{
				e.AddError("Value has to be a number");
				return;
			}

			if (!var.IsFinite())
			{
				e.AddError("Value has to be a finite number");
				return;
			}

			_xEnd = var;
		}