Beispiel #1
0
        /// <summary>
        /// finds the distance range
        /// </summary>
        private void FillOutDistanceRange()
        {
            int min = 0;
            int max = 0;

            //go through the types until a valid min max value is found
            foreach (Task.DistanceRangeType type in Enum.GetValues(typeof(Task.DistanceRangeType)))
            {
                if (Task.RangeTypeToMinMax(type, out min, out max))
                {
                    if (max == -1)//if max = -1 then it is a MINVALUE - > Infinity range
                    {
                        if (Distance >= min)
                        {
                            _distanceRange = type;
                            return;
                        }
                    }
                    else //minvalue - maxvalue
                    {
                        //if it fits then save the type and break
                        if (Distance <= max && Distance >= min)
                        {
                            _distanceRange = type;
                            return;
                        }
                    }
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// Finds the number of objects range
        /// </summary>
        private void FillOutNumberOfObjectsRange()
        {
            int min = 0;
            int max = 0;

            foreach (Task.NumberOfObjectsRangeType type in Enum.GetValues(typeof(Task.NumberOfObjectsRangeType)))
            {
                //go through the types until a valid min max value is found
                if (Task.RangeTypeToMinMax(type, out min, out max))
                {
                    //if max = -1 then it is a MINVALUE - > Infinity range
                    if (max == -1)
                    {
                        //if it fits then save the type and break
                        if (NumberOfObjects >= min)
                        {
                            _numberOfObjectsRange = type;
                            break;
                        }
                    }//else its a min and max
                    else
                    {
                        //if it fits then save the type and break
                        if (NumberOfObjects <= max && NumberOfObjects >= min)
                        {
                            _numberOfObjectsRange = type;
                            break;
                        }
                    }
                }
            }
        }