Пример #1
0
    /*
     *  Updates our list of nodes. Note that this is asynchronous - use OnNodeListUpdate to check new lists.
     */
    void UpdateNodes()
    {
        if (geoService.IsTracking())
        {
            // Firstly get current location
            float[] currentLocation = geoService.CurrentLocation();
            if (currentLocation != null)
            {
                // Then send this location to our node service to get a list of nearby nodes
                nodeService.GetNearbyNodes(currentLocation[0], currentLocation[1], (bool success, List <Node> nodes) =>
                {
                    if (!success)
                    {
                        return;
                    }

                    this.nodes = nodes;

                    if (OnNodeListUpdate != null)
                    {
                        OnNodeListUpdate();
                    }
                });
            }
        }
    }