public static Task SetDefinitionAsync(this Element element, string xmlDefinition) { CIMUtilities.ValidateXML(xmlDefinition);//This can throw! return(QueuedTask.Run(() => { var cimElement = CIMUtilities.DeserializeXmlDefinition <CIMElement>(xmlDefinition); element.SetDefinition(cimElement); })); }
/// <summary> /// Set the definition of the layout to the new "xmlDefinition" /// </summary> /// <remarks>Will throw if the xmlDefinition is invalid</remarks> /// <param name="layout"></param> /// <param name="xmlDefinition"></param> /// <returns></returns> public static Task SetDefinitionInternalAsync(this Layout layout, string xmlDefinition) { CIMUtilities.ValidateXML(xmlDefinition); return(QueuedTask.Run(() => { var cimLayout = CIMUtilities.DeserializeXmlDefinition <CIMLayout>(xmlDefinition); layout.SetDefinition(cimLayout); })); }
/// <summary> /// Set the definition of the map to the new "xmlDefinition" /// </summary> /// <remarks>Will throw if the xmlDefinition is invalid</remarks> /// <param name="map"></param> /// <param name="xmlDefinition"></param> /// <returns></returns> public static Task SetDefinitionInternalAsync(this Map map, string xmlDefinition) { CIMUtilities.ValidateXML(xmlDefinition); return(QueuedTask.Run(() => { var cimMap = CIMUtilities.DeserializeXmlDefinition <CIMMap>(xmlDefinition); map.SetDefinition(cimMap); })); }
public static Task SetDefinitionAsync(this MapMember mm, string xmlDefinition) { CIMUtilities.ValidateXML(xmlDefinition);//This can throw! return(QueuedTask.Run(() => { if (mm is Layer) { var baseLayer = CIMUtilities.DeserializeXmlDefinition <CIMBaseLayer>(xmlDefinition); ((Layer)mm).SetDefinition(baseLayer); } else { var table = CIMUtilities.DeserializeXmlDefinition <CIMStandaloneTable>(xmlDefinition); ((StandaloneTable)mm).SetDefinition(table); } })); }