Esempio n. 1
0
        void BuildSource(string strSource)
        {
            if (this.dataChangedEventHandled)
            {
                return;
            }

            PropertyGridParameterCollection result = new PropertyGridParameterCollection();
            JObject jo = JObject.Parse(strSource);

            foreach (JProperty property in jo.Properties())
            {
                string value = property.Value.Type == JTokenType.String ? (string)property.Value : this.ChopQuotes(property.Value.ToString());
                PropertyGridParameter newP = new PropertyGridParameter(this.ChopQuotes(property.Name), value);
                PropertyGridParameter oldP = this.FindParam(property.Name);
                newP.Mode = oldP.Mode;

                if (oldP.Editor.Count > 0)
                {
                    newP.Editor.Add(oldP.Editor.Editor);
                }

                newP.IsChanged = newP.Name.IsEmpty() || oldP.Value != newP.Value;

                if (newP.IsChanged)
                {
                    raiseChanged = true;
                }
                result.Add(newP);
            }

            this.Source.Clear();

            foreach (PropertyGridParameter parameter in result)
            {
                this.Source.Add(parameter);
            }

            this.dataChangedEventHandled = true;
        }
Esempio n. 2
0
        void BuildSource(string strSource)
        {
            if (this.dataChangedEventHandled)
            {
                return;
            }

            PropertyGridParameterCollection result = new PropertyGridParameterCollection();
            JObject jo = JObject.Parse(strSource);

            foreach (JProperty property in jo.Properties())
            {
                string value = property.Value.Type == JTokenType.String ? (string)property.Value : this.ChopQuotes(property.Value.ToString());
                PropertyGridParameter newP  = new PropertyGridParameter(this.ChopQuotes(property.Name), value);
                PropertyGridParameter param = this.FindParam(property.Name);

                if (param == null)
                {
                    param           = new PropertyGridParameter(this.ChopQuotes(property.Name), value);
                    param.IsChanged = true;
                }
                else
                {
                    param.IsChanged = param.Value != value;
                    param.Value     = value;
                }

                if (param.IsChanged)
                {
                    raiseChanged = true;
                }
                result.Add(param);
            }

            this.Source.Clear();
            this.Source.AddRange(result);

            this.dataChangedEventHandled = true;
        }
Esempio n. 3
0
 public void SetSource(PropertyGridParameterCollection source)
 {
     this.Call("setSource", new JRawValue(source.ToJsonObject()));
 }
Esempio n. 4
0
 /// <summary>
 /// Sets the source data object containing the property data. The data object can contain one or more name/value pairs representing all of the properties of an object to display in the grid, and this data will automatically be loaded into the grid's store. The values should be supplied in the proper data type if needed, otherwise string type will be assumed. If the grid already contains data, this method will replace any existing data. See also the source config value.
 /// </summary>
 /// <param name="source">The data object</param>
 public void SetSource(PropertyGridParameterCollection sourceConfig)
 {
     this.Call("setSource", JRawValue.From(sourceConfig.Source()), JRawValue.From(sourceConfig.Config()));
 }