Exemplo n.º 1
0
        //this method is called by Excel for every =RTD(...) execution
        //the topicID is a unique identifier for every cell in the excel, we use it to map where to notify back to
        public object ConnectData(int topicID, ref Array RTDparms, ref bool getNewValues)
        {
            string symbol = (string)RTDparms.GetValue(0);
            // Reading from the Space
            string tickInfo = ReadTick(symbol);

            // Registering for notifications using the space proxy
            TickInfo.TickInfo notifyTemplate = new TickInfo.TickInfo();
            notifyTemplate.Symbol = symbol;
            IEventRegistration eventReg = _proxy.DefaultDataEventSession.AddListener <TickInfo.TickInfo>(notifyTemplate, Space_TickChanged);

            //creating a new topic (which has a referance to the listner) and store it locally
            TopicTick tp = new TopicTick(topicID, symbol, eventReg);

            if (!_tickTable.ContainsKey(symbol))
            {
                _tickTable.Add(symbol, tp);
            }
            if (!_topicIDTable.ContainsKey(topicID))
            {
                _topicIDTable.Add(topicID, tp);
            }

            return((object)tickInfo);
        }
Exemplo n.º 2
0
 //this method is called by the Excel when a user erase and RTD method from a given cell.
 public void DisconnectData(int topicID)
 {
     try
     {
         TopicTick tp = _topicIDTable[topicID];
         _topicIDTable.Remove(tp.TopicID);
         _tickTable.Remove(tp.symbol);
         _proxy.DefaultDataEventSession.RemoveListener(tp.EventReg);
     }
     catch (Exception ex)
     {
         ex.ToString();
     }
 }
Exemplo n.º 3
0
        //this method is called by Excel for every =RTD(...) execution
		//the topicID is a unique identifier for every cell in the excel, we use it to map where to notify back to
		public object ConnectData(int topicID, ref Array RTDparms, ref bool getNewValues)
        {
            string symbol = (string)RTDparms.GetValue(0);
            // Reading from the Space
            string tickInfo = ReadTick(symbol);
            
            // Registering for notifications using the space proxy
            TickInfo.TickInfo notifyTemplate = new TickInfo.TickInfo();
            notifyTemplate.Symbol = symbol;
            IEventRegistration eventReg = _proxy.DefaultDataEventSession.AddListener<TickInfo.TickInfo>(notifyTemplate, Space_TickChanged);
            
            //creating a new topic (which has a referance to the listner) and store it locally
            TopicTick tp = new TopicTick(topicID, symbol, eventReg);

            if (!_tickTable.ContainsKey(symbol))
                _tickTable.Add(symbol, tp);
            if (!_topicIDTable.ContainsKey(topicID))
                _topicIDTable.Add(topicID, tp);

            return (object)tickInfo;
        }