コード例 #1
0
        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);



            GooglePlacesApi.PlaceInfoController placeInfoController = new GooglePlacesApi.PlaceInfoController(App.GoogleApiKeyTable.GetKey(), App.SelectPlace.Reference, GooglePlacesApi.Sensor.TRUE, "", App.LanguageController.GetGooglePlacesLanguage());
            var info = await placeInfoController.GetPlaceInfo();

            MessageBox.Show(info.Formatted_address);
        }
コード例 #2
0
        public override async Task GetData(Action compliteAction, Action zeroResulAction, Action apiErrorAction, Action queryLimitErrorAction, Action placeNotFoundError)
        {
            IconStatus = "/Assets/SearchPlaces.png";

            try
            {
                PlaceInfoController = new GooglePlacesApi.PlaceInfoController(App.GoogleApiKeyTable.GetKey(), references, GooglePlacesApi.Sensor.TRUE, "", App.LanguageController.GetGooglePlacesLanguage());

                PlaceInfo = await PlaceInfoController.GetPlaceInfo();

                compliteAction();
            }
            catch (GooglePlacesApi.SearchPlacesException ex)
            {
                if (ex.Name == GooglePlacesApi.Status.ZERO_RESULTS)
                {
                    zeroResulAction();
                }
                if (ex.Name == GooglePlacesApi.Status.INVALID_REQUEST)
                {
                    apiErrorAction();
                }
                if (ex.Name == GooglePlacesApi.Status.OVER_QUERY_LIMIT)
                {
                    App.GoogleApiKeyTable.RemoveKey();
                    queryLimitErrorAction();
                }
                if (ex.Name == GooglePlacesApi.Status.NOT_FOUND)
                {
                    placeNotFoundError();
                }
                if (ex.Name == GooglePlacesApi.Status.UNKNOWN_ERROR)
                {
                    apiErrorAction();
                }
                if (ex.Name == GooglePlacesApi.Status.REQUEST_DENIED)
                {
                    apiErrorAction();
                }
            }
        }