Exemplo n.º 1
0
        //Then the interesting bit. We simply iterate over the IDictionary, creating a property descriptor for each entry:
        public PropertyDescriptorCollection GetProperties(Attribute[] attributes)
        {
            ArrayList properties = new ArrayList();
            foreach (KeyValuePair<string, UAVSingleParameter> e in _dictionary)
            {
                bool usethis = true;
                if (this.selectedProperties != null)
                {
                    if (SelectedContains(e.Key))
                    {

                        DictionaryPropertyDescriptor descriptor = new DictionaryPropertyDescriptor(_dictionary, e.Value.GetStringPath());

                        properties.Add(descriptor);
                    }
                }
            }

            PropertyDescriptor[] props =
                (PropertyDescriptor[])properties.ToArray(typeof(PropertyDescriptor));

            return new PropertyDescriptorCollection(props);
        }
Exemplo n.º 2
0
        PropertyDescriptorCollection System.ComponentModel.ICustomTypeDescriptor.GetProperties()
        {
            ArrayList properties = new ArrayList();
            foreach (KeyValuePair<string, UAVSingleParameter> e in _dictionary)
            {
                bool usethis = true;
                if (this.selectedProperties != null)
                {
                    if (!this.selectedProperties.Contains(e.Key)) usethis = false;
                }

                if (usethis)
                {
                    DictionaryPropertyDescriptor descriptor = new DictionaryPropertyDescriptor(_dictionary, e.Value.GetStringPath());

                    properties.Add(descriptor);
                }
            }

            PropertyDescriptor[] props =
                (PropertyDescriptor[])properties.ToArray(typeof(PropertyDescriptor));

            return new PropertyDescriptorCollection(props);
               // return ((ICustomTypeDescriptor)this).GetProperties(new Attribute[0]);
        }