/// <summary> /// Update the BrowserResponse object using Async /// </summary> /// <param name="url">The URL to get the HTTP response from</param> private async Task <BrowserResponse> GetPage() { try { _response = await HttpRequests.Get(Url); } catch (ArgumentException e) { if (LocalHistory.CanStepBack) { Back(); } else { NavigateNoHistory(SingletonFavourites.HomeUrl); } } return(_response); }
/// <summary> /// Send a HTTP GET request to the URI /// </summary> /// <param name="uri">The URI for the request</param> /// <returns>Returns a task wrapping a BrowserResponse</returns> public static async Task <BrowserResponse> Get(string uri) { // perform some validation on url here if (!uri.StartsWith("http://www.") | !uri.StartsWith("https://www.")) { // fix uri string } //try //{ HttpResponseMessage httpres = await client.GetAsync(uri); return(await BrowserResponse.CreateAsync(httpres)); //} catch (InvalidOperationException e) //{ // MessageBox.Show("Invalid URI provided"); //} throw new ArgumentException("Attempted to navigate using improper URI Argument"); }