예제 #1
0
        /// <summary>
        /// Build the array of topics that have been updated.
        /// </summary>
        /// <remarks>
        /// To save time when transmitting and not to overwhelming Excel we can batch the cell
        /// updates here.  Each cell has a unique TopicID
        /// </remarks>
        /// <param name="TopicCount"></param>
        /// <returns></returns>
        public Array RefreshData(ref int topicCount)
        {
            IDictionary changedTopics = client.ConsumeChangedTopics();

            Object[,] updatedTopics = new Object[2, changedTopics.Count];

            int i = 0;

            foreach (int topicID in changedTopics.Keys)
            {
                updatedTopics[0, i] = topicID;
                updatedTopics[1, i] = changedTopics[topicID];
                i++;
            }
            topicCount = i;

            return(updatedTopics);
        }
예제 #2
0
        /// <summary>
        /// Build the array of topics that have been updated.
        /// </summary>
        /// <remarks>
        /// To save time when transmitting and not to overwhelming Excel we can batch the cell
        /// updates here.  Each cell has a unique TopicID
        /// </remarks>
        /// <returns></returns>
        public Array RefreshData(ref int topicCount)
        {
            try {
                var changedTopics = client.ConsumeChangedTopics();
                var updatedTopics = new Object[2, changedTopics.Count];
                var i             = 0;

                foreach (int topicId in changedTopics.Keys)
                {
                    updatedTopics[0, i] = topicId;
                    updatedTopics[1, i] = changedTopics[topicId];
                    i++;
                }
                topicCount = i;

                return(updatedTopics);
            } catch (Exception e) {
                log.Error("RefreshData:", e);
                topicCount = 0;
                return(new Object[2, 0]);
            }
        }