コード例 #1
0
ファイル: RTDSample.cs プロジェクト: yuvaldori/xap-docs
        //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);
        }
コード例 #2
0
        private TickInfo.TickInfo ReadTick(String symbol)
        {
            // reading the TickInfo from the Space

            TickInfo.TickInfo template = new TickInfo.TickInfo();
            template.Symbol = symbol;

            TickInfo.TickInfo tick = _proxy.Read <TickInfo.TickInfo>(template);
            return(tick);
        }
コード例 #3
0
        public String GetTickInfo(string symbol)
        {
            bool isConnected = SpaceInit();

            if (!(isConnected))
            {
                return("connection error");
            }

            TickInfo.TickInfo tick = ReadTick(symbol);
            if (tick == null)
            {
                return("Not Exist");
            }
            return(tick.ToString());
        }
コード例 #4
0
ファイル: RTDSample.cs プロジェクト: yuvaldori/xap-docs
        private string ReadTick(String symbol)
        {
            // reading the Person Data from the Spaces

            TickInfo.TickInfo template = new TickInfo.TickInfo();
            template.Symbol = symbol;

            TickInfo.TickInfo tick = _proxy.Read <TickInfo.TickInfo>(template);

            if (tick == null)
            {
                return("Not Exist");
            }
            else
            {
                return(tick.ToString());
            }
        }
コード例 #5
0
        public String UpdateLastPrice(string symbol, double last)
        {
            bool isConnected = SpaceInit();

            if (!(isConnected))
            {
                return("connection error");
            }

            TickInfo.TickInfo tick = ReadTick(symbol);
            if (tick == null)
            {
                return("Not Exist");
            }

            tick.Last = last;
            _proxy.Update <TickInfo.TickInfo>(tick);
            return("Symbol " + symbol + " has been Updated");
        }
コード例 #6
0
ファイル: RTDSample.cs プロジェクト: rasteroid/xap-docs
        //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;
        }
コード例 #7
0
ファイル: UDFSample.cs プロジェクト: rasteroid/xap-docs
        private TickInfo.TickInfo ReadTick(String symbol)
        {
            // reading the TickInfo from the Space

            TickInfo.TickInfo template = new TickInfo.TickInfo();
            template.Symbol = symbol;

            TickInfo.TickInfo tick = _proxy.Read<TickInfo.TickInfo>(template);
            return tick;
        }
コード例 #8
0
ファイル: RTDSample.cs プロジェクト: rasteroid/xap-docs
        private string ReadTick(String symbol)
        {
            // reading the Person Data from the Spaces

            TickInfo.TickInfo template = new TickInfo.TickInfo();
            template.Symbol = symbol;

            TickInfo.TickInfo tick = _proxy.Read<TickInfo.TickInfo>(template);
            
            if (tick == null)
                return ("Not Exist");
            else
                return tick.ToString();
        }