Пример #1
0
        public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, System.Type destinationType)
        {
            if (destinationType == typeof(System.String) &&
                value is NetworkCamera)
            {
                NetworkCamera idd = (NetworkCamera)value;

                return(idd.Name);
            }
            return(base.ConvertTo(context, culture, value, destinationType));
        }
Пример #2
0
 public void RegisterCamera(NetworkCamera theCamera, bool makeNameUnique)
 {
     if (!IsCameraNameUnique(theCamera.Name))
     {
         if (makeNameUnique)
         {
             int uniquenessSuffix = 1;
             while (!IsCameraNameUnique(theCamera.Name + " " + uniquenessSuffix))
             {
                 uniquenessSuffix++;
             }
             theCamera.Name = theCamera.Name + " " + uniquenessSuffix;
         }
         else
         {
             throw new ArgumentException("Another camera already exists with the name '" + theCamera.Name + "'.");
         }
     }
     cameras.Add(theCamera);
 }