Пример #1
0
        private void loadAPIButton_eventClick(UIComponent component, UIMouseEventParameter eventParam)
        {
            Debug.Log("loadAPIButton_eventClick");
            try
            {
                Debug.Log("GetBounds()");
                ob = GetBounds();

                Debug.Log("new OpenStreeMapFrRequest");
                var streetMapRequest = new OpenStreeMapFrRequest(ob);

                Debug.Log("DebugOutputPanel.AddMessage");
                DebugOutputPanel.AddMessage(PluginManager.MessageType.Message, streetMapRequest.NodeRequestUrl);
                Debug.Log("DebugOutputPanel.AddMessage");
                DebugOutputPanel.AddMessage(PluginManager.MessageType.Message, streetMapRequest.WaysRequestUrl);

                Debug.Log("new WebClient()");
                var nodesWebClient   = new WebClient();
                var nodeResponseData = nodesWebClient.DownloadData(new Uri(streetMapRequest.NodeRequestUrl));
                NodesWebClientCallback(nodeResponseData);

                var waysWebClient    = new WebClient();
                var waysResponseData = waysWebClient.DownloadData(new Uri(streetMapRequest.WaysRequestUrl));
                WaysWebClientCallback(waysResponseData);
            }
            catch (Exception ex)
            {
                Debug.Log(ex.ToString());
                errorLabel.text = ex.ToString();
            }
        }
Пример #2
0
        private void loadAPIButton_eventClick(UIComponent component, UIMouseEventParameter eventParam)
        {
            try
            {
                ob = GetBounds();

                var streetMapRequest = new OpenStreeMapFrRequest(ob);

                DebugOutputPanel.AddMessage(PluginManager.MessageType.Message, streetMapRequest.NodeRequestUrl);
                DebugOutputPanel.AddMessage(PluginManager.MessageType.Message, streetMapRequest.WaysRequestUrl);

                var nodesWebClient = new WebClient();
                nodesWebClient.DownloadDataCompleted += NodesWebClientCallback;
                nodesWebClient.DownloadDataAsync(new Uri(streetMapRequest.NodeRequestUrl));

                var waysWebClient = new WebClient();
                waysWebClient.DownloadDataCompleted += WaysWebClientCallback;
                waysWebClient.DownloadDataAsync(new Uri(streetMapRequest.WaysRequestUrl));
            }
            catch (Exception ex)
            {
                errorLabel.text = ex.ToString();
            }
        }