/// <summary> /// Get a forecast for the given latitude and longitude /// </summary> public void GetForecast() { if (GpsHandler.coordinateWatcher.Permission != GeoPositionPermission.Denied) { if (GpsHandler.coordinateWatcher.Status == GeoPositionStatus.Ready) { string latitude = GpsHandler.latitude.Replace(",", "."); string longitude = GpsHandler.longitude.Replace(",", "."); int days = 1; string uri = String.Format("http://api.worldweatheronline.com/free/v1/weather.ashx?q=" + latitude + "," + longitude + "&format=json&num_of_days=" + days + "&key=" + DeviceTools.worldWeatherOnlineApiKey); HttpRequest request = new HttpRequest(uri, this); } } }
/// <summary> /// Synchronous public method that initiates the Google Search. Creates a Google Custom API search with the textbox contents as the search term /// </summary> /// <param name="query">The search string that is queryed from Google</param> /// <param name="newSearch">New search</param> public void Search(string query) { SystemTray.ProgressIndicator.IsVisible = true; if (StateUtilities.NewSearch) this.searchPageNumber = 1; else this.searchPageNumber = App.ViewModel.Results.Count + 1; this.searchQuery = query; //string that contains required api key and information for google api string uri = String.Format("https://www.googleapis.com/customsearch/v1?key={2}&cx=011471749289680283085:rxjokcqp-ae&q={0}&start={1}", query, this.searchPageNumber, DeviceTools.googleApiKey); //Alternative search engine and an api-key, used for testing purposes. //string uri = String.Format("https://www.googleapis.com/customsearch/v1?key=AIzaSyCurZXbVyfaksuWlOaQVys5YwbewaBrtCs&cx=011471749289680283085:rxjokcqp-ae&q={0}&start={1}", query, this.searchPageNumber); HttpRequest request = new HttpRequest(uri, this); }