Пример #1
0
        public PropertyDescriptorCollection GetProperties(Attribute[] attributes)
        {
            PropertyDescriptorCollection ps  = TypeDescriptor.GetProperties(this, attributes, true);
            List <PropertyDescriptor>    lst = new List <PropertyDescriptor>();

            foreach (PropertyDescriptor p in ps)
            {
                if (_propertyNames.Contains(p.Name))
                {
                    if (string.CompareOrdinal(p.Name, "Controls") == 0)
                    {
                        List <Attribute> al = new List <Attribute>();
                        if (p.Attributes != null)
                        {
                            foreach (Attribute a in p.Attributes)
                            {
                                al.Add(a);
                            }
                        }
                        al.Add(new NotForProgrammingAttribute());
                        lst.Add(new PropertyDescriptorWrapper(p, this, al.ToArray()));
                    }
                    else
                    {
                        lst.Add(p);
                    }
                }
            }
            WebClientValueCollection.AddPropertyDescs(lst, this.CustomValues);
            return(new PropertyDescriptorCollection(lst.ToArray()));
        }
        public static PropertyDescriptorCollection GetWebClientProperties(IWebClientComponent obj, StringCollection names, Attribute[] attributes)
        {
            PropertyDescriptorCollection ps  = TypeDescriptor.GetProperties(obj, attributes, true);
            List <PropertyDescriptor>    lst = new List <PropertyDescriptor>();

            foreach (PropertyDescriptor p in ps)
            {
                if (names == null || names.Contains(p.Name))
                {
                    if (VPLUtil.IsCompiling)
                    {
                        lst.Add(p);
                    }
                    else
                    {
                        if (VPLUtil.HasAttribute(p, typeof(ReadOnlyInProgrammingAttribute)))
                        {
                            lst.Add(new ReadOnlyPropertyDesc(p));
                        }
                        else
                        {
                            lst.Add(p);
                        }
                    }
                }
            }
            WebClientValueCollection.AddPropertyDescs(lst, obj.CustomValues);
            return(new PropertyDescriptorCollection(lst.ToArray()));
        }
 public PropertyDescriptorNewClientVariable(WebClientValueCollection owner)
     : base("New variable", new Attribute[] { new EditorAttribute(typeof(TypeEditorWebClientValue), typeof(UITypeEditor))
                                              , new RefreshPropertiesAttribute(RefreshProperties.All)
                                              , new NotForProgrammingAttribute()
                                              , new ParenthesizePropertyNameAttribute(true) })
 {
     _owner = owner;
 }
 public PropertyDescriptorClientVariable(string name, IJavascriptType type, WebClientValueCollection owner)
     : base(name, new Attribute[] {
     new WebClientMemberAttribute(), new BindableAttribute(true)
 })
 {
     _owner = owner;
     _type  = type;
     _name  = name;
 }
 public static void AddPropertyDescs(List <PropertyDescriptor> lst, WebClientValueCollection cs)
 {
     if (cs != null && cs.Count > 0)
     {
         foreach (KeyValuePair <string, IJavascriptType> s in cs)
         {
             lst.Add(new PropertyDescriptorClientVariable(s.Key, s.Value, cs));
         }
     }
 }
Пример #6
0
 public void LoadData(WebClientValueCollection data, string name)
 {
     Text = string.Format(CultureInfo.InvariantCulture, "Manage cutom values for {0}", name);
     if (data != null)
     {
         foreach (KeyValuePair <string, IJavascriptType> kv in data)
         {
             this.listBox1.Items.Add(new WebClientValue(kv));
         }
         Return = data;
     }
 }
Пример #7
0
 public PropertyDescriptorCollection GetProperties(Attribute[] attributes)
 {
     return(WebClientValueCollection.GetWebClientProperties(this, _propertyNames, attributes));
     //PropertyDescriptorCollection ps = TypeDescriptor.GetProperties(this, attributes,true);
     //List<PropertyDescriptor> lst = new List<PropertyDescriptor>();
     //foreach (PropertyDescriptor p in ps)
     //{
     //    if (_propertyNames.Contains(p.Name))
     //    {
     //        lst.Add(p);
     //    }
     //}
     //WebClientValueCollection.AddPropertyDescs(lst, _customValues);
     //return new PropertyDescriptorCollection(lst.ToArray());
 }
Пример #8
0
        public PropertyDescriptorCollection GetProperties(Attribute[] attributes)
        {
            PropertyDescriptorCollection ps = TypeDescriptor.GetProperties(this, attributes, true);
            //return ps;
            List <PropertyDescriptor> lst = new List <PropertyDescriptor>();

            foreach (PropertyDescriptor p in ps)
            {
                if (_propertyNames.Contains(p.Name))
                {
                    lst.Add(p);
                }
            }
            WebClientValueCollection.AddPropertyDescs(lst, this.CustomValues);
            return(new PropertyDescriptorCollection(lst.ToArray()));
        }
Пример #9
0
 private void buttonOK_Click(object sender, EventArgs e)
 {
     if (Return == null)
     {
         Return = new WebClientValueCollection(null);
     }
     for (int i = 0; i < listBox1.Items.Count; i++)
     {
         WebClientValue t = listBox1.Items[i] as WebClientValue;
         if (t != null)
         {
             if (!Return.ContainsKey(t.Name))
             {
                 Return.Add(t.Name, t.Value);
             }
         }
     }
     this.DialogResult = DialogResult.OK;
 }
Пример #10
0
        public PropertyDescriptorCollection GetProperties(Attribute[] attributes)
        {
            PropertyDescriptorCollection ps  = TypeDescriptor.GetProperties(this, attributes, true);
            List <PropertyDescriptor>    lst = new List <PropertyDescriptor>();

            foreach (PropertyDescriptor p in ps)
            {
                if (_propertyNames.Contains(p.Name))
                {
                    lst.Add(p);
                }
            }
            HtmlTreeView htv = this.TreeView as HtmlTreeView;

            if (htv != null)
            {
                lst.Add(new PropertyDescriptorHtmlTreeNodeCollection(this, htv));
            }
            WebClientValueCollection.AddPropertyDescs(lst, this.CustomValues);
            return(new PropertyDescriptorCollection(lst.ToArray()));
        }
        public PropertyDescriptorCollection GetProperties(Attribute[] attributes)
        {
            PropertyDescriptorCollection pl  = WebClientValueCollection.GetWebClientProperties(this, _propertyNames, attributes);
            PropertyDescriptorCollection lst = TypeDescriptor.GetProperties(_listBox, true);

            foreach (PropertyDescriptor p in lst)
            {
                if (_listpropertyNames.Contains(p.Name))
                {
                    Attribute[] attrs;
                    if (p.Attributes != null)
                    {
                        attrs = new Attribute[p.Attributes.Count];
                        p.Attributes.CopyTo(attrs, 0);
                    }
                    else
                    {
                        attrs = new Attribute[] { };
                    }
                    pl.Add(new PropertyDescriptorListBox(this, p, attrs));
                }
            }
            return(pl);
        }
Пример #12
0
 public PropertyDescriptorCollection GetProperties(Attribute[] attributes)
 {
     return(WebClientValueCollection.GetWebClientProperties(this, _propertyNames, attributes));
 }
 public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
 {
     if (context != null && context.Instance != null && provider != null)
     {
         IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
         if (edSvc != null)
         {
             string name = context.Instance.GetType().Name;
             WebClientValueCollection svc = context.Instance as WebClientValueCollection;
             if (svc == null)
             {
                 IWebClientComponent wa = context.Instance as IWebClientComponent;
                 if (wa != null)
                 {
                     svc  = wa.CustomValues;
                     name = wa.GetType().Name;
                 }
                 else
                 {
                     IVplObjectPointer vop = context.Instance as IVplObjectPointer;
                     if (vop != null)
                     {
                         wa = vop.ObjectInstance as IWebClientComponent;
                         if (wa != null)
                         {
                             svc  = wa.CustomValues;
                             name = wa.GetType().Name;
                         }
                     }
                     if (svc == null)
                     {
                         WebClientValueCollection.PropertyDescriptorNewClientVariable psdv = context.PropertyDescriptor as WebClientValueCollection.PropertyDescriptorNewClientVariable;
                         if (psdv != null)
                         {
                             svc = psdv.Owner;
                         }
                         else
                         {
                             WebClientValueCollection.PropertyDescriptorClientVariable psdv0 = context.PropertyDescriptor as WebClientValueCollection.PropertyDescriptorClientVariable;
                             if (psdv0 != null)
                             {
                                 svc = psdv0.Owner;
                             }
                         }
                     }
                 }
             }
             if (svc != null)
             {
                 DialogWebClientValues dlg = new DialogWebClientValues();
                 dlg.LoadData(svc, name);
                 if (edSvc.ShowDialog(dlg) == System.Windows.Forms.DialogResult.OK)
                 {
                     IHtmlElement ihe = svc.Owner as IHtmlElement;
                     if (ihe != null)
                     {
                         ihe.OnSetProperty(context.PropertyDescriptor.Name);
                     }
                     IDevClassReferencer dcr = svc.Owner as IDevClassReferencer;
                     if (dcr != null)
                     {
                         IDevClass dc = dcr.GetDevClass();
                         if (dc != null)
                         {
                             dc.NotifyChange(dcr, context.PropertyDescriptor.Name);
                         }
                     }
                 }
             }
         }
     }
     return(value);
 }