//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:2.0.50727.8009
//		Author : Etienne STROBBE
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

namespace WComp.Beans
{
    using System;
    using WComp.Beans;
    
    [Bean(Category="Basic")]
    public class Threshold3State
    {
        #region Property MinValue
        private string _minvalue;
        public string MinValue
        {
            get
            {
                return _minvalue;
            }
            set
            {
                _minvalue = value;
            }
        }
        #endregion
        #region Property MaxValue
        private string _maxvalue;
        public string MaxValue
        {
            get
            {
                return _maxvalue;
            }
            set
            {
                _maxvalue = value;
            }
        }
        #endregion
        
        #region Property value
        private string _value;
        public string Value
        {
            get
            {
                return _value;
            }
            set
            {
                _value = value;
            }
        }
        #endregion
        
        #region Property colorMax
        private string _colorMax;
        public string ColorMax
        {
            get
            {
                return _colorMax;
            }
            set
            {
                _colorMax = value;
            }
        }
        #endregion
        #region Property colorBetween
        private string _colorBetween;
        public string ColorBetween
        {
            get
            {
                return _colorBetween;
            }
            set
            {
                _colorBetween = value;
            }
        }
        #endregion
        
        #region Property colorMin
        private string _colorMin;
        public string ColorMin
        {
            get
            {
                return _colorMin;
            }
            set
            {
                _colorMin = value;
            }
        }
        #endregion
        
        
        public void SetValue(string value)
        {
        	_value = value;
        	FireValueReachedEvent(value);
        }
        public delegate void ValueReachedEventHandler(string value);
        public event ValueReachedEventHandler ValueReached;
        private void FireValueReachedEvent(string value)
        {
            if (ValueReached != null)
            {
            	if(Double.Parse(_value) > Double.Parse(_maxvalue)){
        			this.ValueReached(_colorMax);
	        	}
	        	else if(Double.Parse(_value) < Double.Parse(_minvalue)){
	        		this.ValueReached(_colorMin);
	        	}
	        	else{
	        		this.ValueReached(_colorBetween);
	        	}
            }
        }
        
    }
}
