Exemple #1
0
        private void GetNodeByIdAsyncCompleted(object sender, GetNodesCompletedEventArgs e)
        {
            List <INodeProxy> nodes = new List <INodeProxy>();

            foreach (SoapNode soapNode in e.Result.Values)
            {
                NodeProxy node = new NodeProxy(soapNode);

                nodes.Add(node);
                _cachedNodes.Add(node.Id, node);
            }

            ReturnedNodesEventArgs eventArgs = new ReturnedNodesEventArgs(null, nodes.ToArray());

            if (GetNodeByIdCompleted != null)
            {
                GetNodeByIdCompleted.Invoke(this, eventArgs);
            }
        }
        public void GetNodeByIdAsync(Guid nodeId, Guid mapId)
        {
            if (_cachedNodes.ContainsKey(nodeId))
            {
                ReturnedNodesEventArgs returnedNodesEventArgs = new ReturnedNodesEventArgs();
                List <INodeProxy>      returnedNodes          = new List <INodeProxy>();
                returnedNodes.Add(_cachedNodes[nodeId]);
                returnedNodesEventArgs.Nodes = returnedNodes.ToArray();

                if (GetNodeByIdCompleted != null)
                {
                    GetNodeByIdCompleted.Invoke(this, returnedNodesEventArgs);
                }
            }
            else
            {
                Dictionary <Guid, Guid> nodes = new Dictionary <Guid, Guid>();
                nodes.Add(nodeId, mapId);

                Client.GetNodesAsync(nodes);
            }
        }