Parameterizing a stream
EnvDTE.Solution solution = dte.Solution;
EnvDTE.Project xaeProject = null;
// Get xaeProject
…
ITcSysManager sysManager = (ITcSysManager)xaeProject.Object;
// Navigate to the Analytics DataLogger Node
ITcSmTreeItem stream = sysManager.LookupTreeItem("TIAN^MyDataLoggerName^PlcStream1");
string sXmlDoc = stream.ProduceXml();
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.LoadXml(sXmlDoc);
XmlElement elemSetParam = xmlDoc.CreateElement("SetParameter");
XmlAttribute attrParamName = xmlDoc.CreateAttribute("name");
attrParamName.Value = "Max ADS Buffer";
XmlAttribute attrParamValue = xmlDoc.CreateAttribute("value");
attrParamValue.Value = "23";
elemSetParam.Attributes.Append(attrParamName);
elemSetParam.Attributes.Append(attrParamValue);
xmlDoc.DocumentElement.AppendChild(elemSetParam);
string sConsumeXml = xmlDoc.OuterXml;
dataLogger.ConsumeXml(sConsumeXml);
The code snippet shows the use of the Produce-Consume-XML mechanism, where the XML text describing the project node can be read, modified and written again, which can be followed by actions on the part of the System Manager. The imported XML text contains, among other things, a listing of the parameters with name and current value. The name corresponds exactly to the name of the parameter under the Data Handling tab of the stream project node. This also applies to the respective values.