Beispiel #1
0
		public MainForm()
		{
			//
			// The InitializeComponent() call is required for Windows Forms designer support.
			//
			InitializeComponent();
			
			this.myRenderer = new LBMyAnalogMeterRenderer();
						
			LBMeterThreshold threshold = new LBMeterThreshold();
			threshold.Color = Color.Yellow;
			threshold.StartValue = 50;
			threshold.EndValue = 70;
			this.lbAnalogMeter1.Thresholds.Add ( threshold );
			threshold = new LBMeterThreshold();
			threshold.Color = Color.Red;
			threshold.StartValue = 70;
			threshold.EndValue = 100;
			this.lbAnalogMeter1.Thresholds.Add ( threshold );
			this.lbAnalogMeter1.Renderer = this.myRenderer;
								
			threshold = new LBMeterThreshold();
			threshold.Color = Color.Yellow;
			threshold.StartValue = 50;
			threshold.EndValue = 70;
			this.lbAnalogMeter2.Thresholds.Add ( threshold );
			threshold = new LBMeterThreshold();
			threshold.Color = Color.Red;
			threshold.StartValue = 70;
			threshold.EndValue = 100;
			this.lbAnalogMeter2.Thresholds.Add ( threshold );
        }
        /// <summary>
        /// Check if the object is containing in the collection
        /// </summary>
        /// <param name="sector"></param>
        /// <returns></returns>
        public bool Contains(LBMeterThreshold sector)
        {
            //loop through the inner ArrayList
            foreach (LBMeterThreshold obj in InnerList)
            {
                //compare the values of the objects
                if ((obj.StartValue == sector.StartValue) &&
                    (obj.EndValue == sector.EndValue))
                {
                    //if it matches return true
                    return(true);
                }
            }

            //no match
            return(false);
        }
        /// <summary>
        /// Remove an object from the collection
        /// </summary>
        /// <param name="sector"></param>
        /// <returns></returns>
        public virtual bool Remove(LBMeterThreshold sector)
        {
            bool result = false;

            //loop through the inner array's indices
            for (int i = 0; i < InnerList.Count; i++)
            {
                //store current index being checked
                LBMeterThreshold obj = (LBMeterThreshold)InnerList[i];

                //compare the values of the objects
                if ((obj.StartValue == sector.StartValue) &&
                    (obj.EndValue == sector.EndValue))
                {
                    //remove item from inner ArrayList at index i
                    InnerList.RemoveAt(i);
                    result = true;
                    break;
                }
            }

            return(result);
        }
Beispiel #4
0
        /// <summary>
        /// Remove an object from the collection
        /// </summary>
        /// <param name="sector"></param>
        /// <returns></returns>
        public virtual bool Remove(LBMeterThreshold sector)
        {
            bool result = false;

            //loop through the inner array's indices
            for (int i = 0; i < InnerList.Count; i++)
            {
                //store current index being checked
                LBMeterThreshold obj = (LBMeterThreshold)InnerList[i];

                //compare the values of the objects
                if ((obj.StartValue == sector.StartValue) &&
                    (obj.EndValue == sector.EndValue))
                {
                    //remove item from inner ArrayList at index i
                    InnerList.RemoveAt(i);
                    result = true;
                    break;
                }
            }

            return result;
        }
Beispiel #5
0
 /// <summary>
 /// Copy the collection
 /// </summary>
 /// <param name="LBAnalogMeterSectorArray"></param>
 /// <param name="index"></param>
 public virtual void CopyTo(LBMeterThreshold[] MeterThresholdArray, int index)
 {
     throw new Exception("This Method is not valid for this implementation.");
 }
Beispiel #6
0
        /// <summary>
        /// Check if the object is containing in the collection
        /// </summary>
        /// <param name="sector"></param>
        /// <returns></returns>
        public bool Contains(LBMeterThreshold sector)
        {
            //loop through the inner ArrayList
            foreach (LBMeterThreshold obj in InnerList)
            {
                //compare the values of the objects
                if ((obj.StartValue == sector.StartValue) &&
                    (obj.EndValue == sector.EndValue))
                {
                    //if it matches return true
                    return true;
                }
            }

            //no match
            return false;
        }
Beispiel #7
0
 /// <summary>
 /// Add an object to the collection
 /// </summary>
 /// <param name="sector"></param>
 public virtual void Add(LBMeterThreshold sector)
 {
     InnerList.Add(sector);
 }
 /// <summary>
 /// Add an object to the collection
 /// </summary>
 /// <param name="sector"></param>
 public virtual void Add(LBMeterThreshold sector)
 {
     InnerList.Add(sector);
 }