void BuildSource(string strSource) { if (this.dataChangedEventHandled) { return; } PropertyGridParameterCollection result = new PropertyGridParameterCollection(); JObject jo = JObject.Parse(strSource); foreach (JProperty property in jo.Properties()) { PropertyGridParameter newP = new PropertyGridParameter(this.ChopQuotes(property.Name), this.ChopQuotes(property.Value.ToString())); PropertyGridParameter oldP = this.FindParam(property.Name); newP.Mode = oldP.Mode; if (oldP.Editor.Count > 0) { newP.Editor.Add(oldP.Editor.Editor); } newP.IsChanged = string.IsNullOrEmpty(newP.Name) || 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; }
public void SetSource(PropertyGridParameterCollection source) { this.AddScript(string.Concat(this.ClientID, ".setSource(", source.ToJsonObject(), ");")); }