Пример #1
0
        private void AddZone()
        {
            double range = 0;

            if (double.TryParse(ZoneRange, out range))
            {
                if (range > 8)
                {
                    Status = "The maximum a zone range can be is 8 meters.  Zone not added.";
                    return;
                }
            }
            else
            {
                Status = "The maximum a zone range must be a number.  Zone not added.";
                return;
            }

            ZoneDefinitions.Add(new ZoneDefinition()
            {
                Name = ZoneName, MaximumRange = range
            });
            ZoneName  = string.Empty;
            ZoneRange = string.Empty;
            Status    = string.Empty;
        }
Пример #2
0
 public ZoneDefinition Add(ZoneDefinition obj)
 {
     if (obj == null)
     {
         return(null);
     }
     if (ZoneDefinitions == null)
     {
         ZoneDefinitions = new List <ZoneDefinition>();
     }
     if (!ZoneDefinitions.Any(i => i.Name == obj.Name))
     {
         ZoneDefinitions.Add(obj);
         return(obj);
     }
     else
     {
         var oc = ZoneDefinitions.Single(o => o.Name == obj.Name);
         CopyObjectData(obj, oc, "", BindingFlags.Public | BindingFlags.Instance);
         return(oc);
     }
 }