/// <summary>
        /// Processes the response to the InstrumentInfo command.
        /// </summary>
        /// <param name="instrumentInfoResponse">Command response data.</param>
        private void ProcessInstrumentInfoResponse(XElement instrumentInfoResponse)
        {
            //Expected response
            //<InstrumentInfo>
            //  <field Label="...">...</field>
            //  ...
            //</InstrumentInfo>

            using (InstrumentInfo.AcquireLock())
            {
                InstrumentInfo.Clear();

                foreach (var fieldElement in instrumentInfoResponse.Elements("field", StringComparison.InvariantCultureIgnoreCase))
                {
                    var label = FindAttribute(fieldElement, "Label").Value;
                    InstrumentInfo.Add(new InstrumentInfoElement(label, fieldElement.Value));

                    if (string.Compare(label, "Options", true) == 0)
                    {
                        Options = fieldElement.Value;
                    }
                    else if (string.Compare(label, "Family", true) == 0)
                    {
                        Family = fieldElement.Value;
                    }
                }
            }
        }
示例#2
0
        /// <summary>
        /// Processes the response to the InstrumentInfo command.
        /// </summary>
        /// <param name="instrumentInfoResponse">Command response data.</param>
        private void ProcessInstrumentInfoResponse(XElement instrumentInfoResponse)
        {
            //Expected response
            //<InstrumentInfo>
            //  <field Label="...">...</field>
            //  ...
            //</InstrumentInfo>

            using (InstrumentInfo.AcquireLock())
            {
                InstrumentInfo.Clear();

                foreach (var fieldElement in instrumentInfoResponse.Elements("field"))
                {
                    InstrumentInfo.Add(new InstrumentInfoElement(fieldElement.Attribute("label").Value, fieldElement.Value));

                    if (fieldElement.Attribute("label").Value == "Options")
                    {
                        Options = fieldElement.Value;
                    }
                }
            }
        }