public void LoadTypes() { if (null == this._agent) { throw new InvalidOperationException("Agent not set"); } string key = ConfigurationManager.AppSettings["CONTROL_TYPES"]; if (string.IsNullOrEmpty(key)) { throw new ApplicationException("'CONTROL_TYPES' web.config key not set"); } XmlDocument doc = new XmlDocument(); try { doc.Load(this._agent.OpenStream(key)); } finally { this._agent.CloseStream(key); } XmlNode root = doc.SelectSingleNode("types"); if (null == root) { throw new InvalidOperationException("Control types file has no types node"); } foreach (XmlNode node in root.ChildNodes) { ControlFactory.ControlDescriptor descriptor = new ControlFactory.ControlDescriptor(node.Attributes["key"].Value, node.Attributes["name"].Value, (node.Attributes["readOnly"] == null) ? string.Empty : node.Attributes["readOnly"].Value, (node.Attributes["readOnlyValue"] == null) ? string.Empty : node.Attributes["readOnlyValue"].Value, (node.Attributes["watermark"] == null) ? string.Empty : node.Attributes["watermark"].Value); if (node.HasChildNodes) { foreach (XmlNode child in node.ChildNodes) { ControlFactory.PropertyDescriptor propertyDescriptor = new ControlFactory.PropertyDescriptor(child.Attributes["name"].Value, (child.Attributes["value"] == null) ? string.Empty : child.Attributes["value"].Value, (child.Attributes["options"] == null) ? string.Empty : child.Attributes["options"].Value, (child.Attributes["ValueType"] == null) ? string.Empty : child.Attributes["ValueType"].Value, child.Attributes["isList"] != null && bool.Parse(child.Attributes["isList"].Value)); descriptor.EditableProperties.Add(propertyDescriptor.Name, propertyDescriptor); } } this._knownTypes.Add(descriptor.Key, descriptor); } }
public void LoadTypes() { if (null == this._agent) { throw new InvalidOperationException("Agent not set"); } string key = ConfigurationManager.AppSettings["CONTROL_TYPES"]; if (string.IsNullOrEmpty(key)) { throw new ApplicationException("'CONTROL_TYPES' web.config key not set"); } XmlDocument doc = new XmlDocument(); try { doc.Load(this._agent.OpenStream(key)); } finally { this._agent.CloseStream(key); } XmlNode root = doc.SelectSingleNode("types"); if (null == root) { throw new InvalidOperationException("Control types file has no types node"); } foreach (XmlNode node in root.ChildNodes) { ControlFactory.ControlDescriptor descriptor = new ControlFactory.ControlDescriptor(node.Attributes["key"].Value, node.Attributes["name"].Value, (node.Attributes["readOnly"] == null) ? string.Empty : node.Attributes["readOnly"].Value, (node.Attributes["readOnlyValue"] == null) ? string.Empty : node.Attributes["readOnlyValue"].Value, (node.Attributes["watermark"] == null) ? string.Empty : node.Attributes["watermark"].Value); if (node.HasChildNodes) { foreach (XmlNode child in node.ChildNodes) { ControlFactory.PropertyDescriptor propertyDescriptor = new ControlFactory.PropertyDescriptor(child.Attributes["name"].Value, (child.Attributes["value"] == null) ? string.Empty : child.Attributes["value"].Value, (child.Attributes["options"] == null) ? string.Empty : child.Attributes["options"].Value, (child.Attributes["ValueType"] == null) ? string.Empty : child.Attributes["ValueType"].Value, child.Attributes["isList"] != null && bool.Parse(child.Attributes["isList"].Value)); descriptor.EditableProperties.Add(propertyDescriptor.Name, propertyDescriptor); } } this._knownTypes.Add(descriptor.Key, descriptor); } }