Ejemplo n.º 1
0
        /// <summary>
        /// Called when a new instance of the RTD function is created.
        /// </summary>
        /// <param name="topicId"></param>
        /// <param name="Strings"></param>
        /// <param name="GetNewValues"></param>
        /// <returns></returns>-
        public object ConnectData(int topicId, ref Array Strings, ref bool GetNewValues)
        {
            try {
                var rtdString = (string)Strings.GetValue(0);
                if (rtdString == "" || rtdString.Trim().Length == 0)
                {
                    return("#Topic error - " + rtdString);
                }

                var details = new TopicDetails {
                    key        = client.BuildPositionLookupKey(rtdString, (string)Strings.GetValue(1)),
                    valueField = ((string)Strings.GetValue(1)),
                    topicID    = topicId
                };

                var jmsTopic = NmsClient.ExtractJmsTopic((string)Strings.GetValue(0));
                client.StartListeningTo(jmsTopic, details.key, details.valueField, details.topicID);

                // ensure we replace the value in the spreadsheet
                GetNewValues = true;

                return(client.LookupValue(details.key, details.valueField));
            } catch (Exception e) {
                log.Error("Unable to ConnectData", e);
                return("#ConnectData");
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Called when a new instance of the RTD function is created.
        /// </summary>
        /// <param name="TopicID"></param>
        /// <param name="Strings"></param>
        /// <param name="GetNewValues"></param>
        /// <returns></returns>-
        public object ConnectData(int TopicID, ref Array Strings, ref bool GetNewValues)
        {
            TopicDetails details = new TopicDetails();

            details.key        = client.BuildPositionLookupKey((string)Strings.GetValue(0), (string)Strings.GetValue(1));
            details.valueField = (string)Strings.GetValue(1);
            details.topicID    = TopicID;

            string jmsTopic = client.extractJmsTopic((string)Strings.GetValue(0));

            client.StartListeningTo(jmsTopic, details.key, details.valueField, details.topicID);

            // ensure we replace the value in the spreadsheet
            GetNewValues = true;

            return(client.lookupValue(details.key, details.valueField));
        }