예제 #1
0
        private void ProcessServiceDetailReturn(GISService svc, string responseString)
        {
            GISResponse response = new GISResponse();
            response.LastResponse = responseString;

            try
            {
                Nii.JSON.JSONObject responseReader = new Nii.JSON.JSONObject(responseString);

                Server._lastUpdated = DateTime.Now;

                EsriService.AddServiceInfo(svc, responseReader);
                Server.RaiseServiceDetailResponse(svc);
            }
            catch (Exception ex)
            {
                response.HasError = true;
                response.ErrorMessage = ex.Message;
                response = GISResponse.ProcessErrorResponse(ex.Message, response.LastRequest, responseString);
                Server.RaiseErrorResponse(response);
            }
        }
예제 #2
0
        private async Task<bool> ProcessServiceReturn(string responseString)
        {
            GISResponse response = new GISResponse();

            Server._lastUpdated = DateTime.Now;
            _Server._services.Clear();
            // sdfds        http://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/6/24/17.jpg

            try
            {
                response.LastResponse = responseString;
                Nii.JSON.JSONObject responseReader = new Nii.JSON.JSONObject(responseString);

                for (int idx = 0; idx < responseReader.Count; idx++)
                {
                    switch (responseReader[idx])
                    {
                        case "error":
                            response = GISResponse.ProcessErrorResponse(responseReader.getString("message"), response.LastRequest, responseString);
                            Server.RaiseErrorResponse(response);
                            break;
                        case "services":
                            List<GISService> nservices = EsriServiceResponse.ProcessServiceReturn(responseReader.getJSONArray("services").List);
                            AddServiceValues(_Server._services, nservices);
                            Server.RaiseServiceResponse();
                            break;
                        case "folders":
                            await AddServiceFolders(responseReader.getJSONArray("folders").List, _Server._services);
                            break;
                    }
                }

                return true;
                //if (UNRESOLVED_SERVICES == 0) Server.RaiseServiceResponse();
            }
            catch (Exception ex)
            {
                response.HasError = true;
                response.ErrorMessage = ex.Message;
                response = GISResponse.ProcessErrorResponse(ex.Message, response.LastRequest, responseString);
                Server.RaiseErrorResponse(response);
                return false;
            }
        }