Esempio n. 1
0
        static private void ValidateElement(object value)
        {
            Debug.Assert((value != null) && (value is DeviceFilterElement));

            DeviceFilterElement elem = (DeviceFilterElement)value;

            // If the filter class is specified, we need the method attribute but
            // not the compare and argument attributes.
            if (elem.FilterClass != null)
            {
                if (string.IsNullOrEmpty(elem.Method))
                {
                    throw new ConfigurationErrorsException(
                              SR.GetString(SR.ConfigSect_MissingAttr, "method"));
                }

                if (!string.IsNullOrEmpty(elem.Compare))
                {
                    throw new ConfigurationErrorsException(SR.GetString(SR.DevCapSect_ExtraCompareDelegator));
                }
                else if (!string.IsNullOrEmpty(elem.Argument))
                {
                    throw new ConfigurationErrorsException(SR.GetString(SR.DevCapSect_ExtraArgumentDelegator));
                }

                // Resolve the method
                elem.GetDelegate();
            }
            // Otherwise, we need the compare and argument attributes but not
            // the method attribute.
            else
            {
                if (string.IsNullOrEmpty(elem.Compare))
                {
                    throw new ConfigurationErrorsException(
                              SR.GetString(SR.DevCapSect_MustSpecify));
                }

                if (!string.IsNullOrEmpty(elem.Method))
                {
                    throw new ConfigurationErrorsException(
                              SR.GetString(SR.DevCapSect_ComparisonAlreadySpecified));
                }
            }
        }
 public void Remove( DeviceFilterElement deviceFilter )  {
     BaseRemove( GetElementKey( deviceFilter ) );
 }
 public void Add( DeviceFilterElement deviceFilter ) {
     BaseAdd( deviceFilter );
 }
Esempio n. 4
0
 public void Remove(DeviceFilterElement deviceFilter)
 {
     BaseRemove(GetElementKey(deviceFilter));
 }
Esempio n. 5
0
 public void Add(DeviceFilterElement deviceFilter)
 {
     BaseAdd(deviceFilter);
 }