Ejemplo n.º 1
0
            public void OnSearchResult(Java.Lang.Object resultObject)
            {
                DetailSearchResponse detailSearchResponse = (DetailSearchResponse)resultObject;
                StringBuilder        resultText           = new StringBuilder();
                Site site = detailSearchResponse.Site;

                if (site == null)
                {
                    ResultTextView.Text = "Result is Empty!";
                    return;
                }

                System.Text.StringBuilder ResultText = new System.Text.StringBuilder();
                ResultText.AppendLine("Success");
                AddressDetail    addressDetail = site.Address;
                Coordinate       location      = site.Location;
                Poi              poi           = site.Poi;
                CoordinateBounds viewport      = site.Viewport;

                string item = "siteId: '{0}', name: {1}, formatAddress: {2}, country: {3}, countryCode: {4}, location: {5}, poiTypes: {6}, viewport: {7} ";

                ResultText.Append(string.Format(item,
                                                site.SiteId, site.Name, site.FormatAddress,
                                                (addressDetail == null ? "" : addressDetail.Country),
                                                (addressDetail == null ? "" : addressDetail.CountryCode),
                                                (location == null ? "" : (location.Lat + "," + location.Lng)),
                                                (poi == null ? "" : string.Join(",", poi.PoiTypes.ToArray())),
                                                (viewport == null ? "" : "northeast{lat=" + viewport.Northeast.Lat + ", lng=" + viewport.Northeast.Lng + "},"
                                                 + "southwest{lat=" + viewport.Southwest.Lat + ", lng=" + viewport.Southwest.Lng + "}")));
                if ((poi != null))
                {
                    Gson   gson       = new Gson();
                    string jsonString = gson.ToJson(poi.GetChildrenNodes());
                    ResultText.Append(string.Format("childrenNode: {0} \n\n", jsonString));
                }

                ResultTextView.Text = ResultText.ToString();
                Log.Debug(KeywordSearchActivity.TAG, "OnDetailSearchResult: " + ResultText.ToString());
            }