private void HandleResponse(string jsonResponse, Action<PropertyDataSourceResult> callback)
        {
            JObject json = JObject.Parse(jsonResponse);

              string responseCode = (string)json["response"]["application_response_code"];

              if (responseCode == "100" || /* one unambiguous location */
              responseCode == "101" || /* best guess location */
              responseCode == "110"  /* large location, 1000 matches max */)
              {
            var result = new PropertyListingsResult(json);
            _marshalInvokeService.Invoke(() => callback(result));

              }
              else if (responseCode == "200" || /* ambiguous location */
               responseCode == "202" /* mis-spelled location */)
              {
            var result = new PropertyLocationsResult(json);
            _marshalInvokeService.Invoke(() => callback(result));

              }
              else
              {
            /*
            201 - unkown location
            210 - coordinate error
            */
              _marshalInvokeService.Invoke(() => callback(new PropertyUnknownLocationResult()));
              };
        }
Пример #2
0
        private void HandleResponse(string jsonResponse, Action <PropertyDataSourceResult> callback)
        {
            JObject json = JObject.Parse(jsonResponse);

            string responseCode = (string)json["response"]["application_response_code"];

            if (responseCode == "100" || /* one unambiguous location */
                responseCode == "101" || /* best guess location */
                responseCode == "110" /* large location, 1000 matches max */)
            {
                var result = new PropertyListingsResult(json);
                _marshalInvokeService.Invoke(() => callback(result));
            }
            else if (responseCode == "200" || /* ambiguous location */
                     responseCode == "202" /* mis-spelled location */)
            {
                var result = new PropertyLocationsResult(json);
                _marshalInvokeService.Invoke(() => callback(result));
            }
            else
            {
                /*
                 * 201 - unkown location
                 * 210 - coordinate error
                 */
                _marshalInvokeService.Invoke(() => callback(new PropertyUnknownLocationResult()));
            };
        }