private void InitXeroWebView() { xeroWebView.Source = AuthorizeLink(); activityIndicator.IsVisible = false; xeroWebView.Navigated += async(object sender, WebNavigatedEventArgs e) => { if (e.Url.Contains(@"https://www.xero.com/nz/")) { activityIndicator.IsVisible = true; int indexStart = e.Url.IndexOf("code=") + 5; int length = e.Url.IndexOf("&scope=") - indexStart; Preferences.Set("Code", e.Url.Substring(indexStart, length)); try { await XeroAPI.GetToken(); await XeroAPI.GetTenantID(); await XeroAPI.GetInvoices(); await XeroAPI.FillData(); } catch { await DisplayAlert("XERO API", "Failure in retrieving data from XERO", "OK"); } await Navigation.PopModalAsync(); } }; }
private void InitXeroWebView() { xeroWebView.Source = AuthorizeLink(); activityIndicator.IsVisible = false; xeroWebView.Navigated += async(object sender, WebNavigatedEventArgs e) => { if (e.Url.Contains(@"https://www.xero.com/nz/")) { activityIndicator.IsVisible = true; int indexStart = e.Url.IndexOf("code=") + 5; int length = e.Url.IndexOf("&scope=") - indexStart; Preferences.Set("Code", e.Url.Substring(indexStart, length)); var isSuccess = await XeroAPI.GetToken(); await XeroAPI.GetTenantID(); await XeroAPI.GetInvoices(); //await DisplayAlert("OK", $"{XeroAPI._InvoiceResponse.Invoices[0].InvoiceID}", "OK"); await XeroAPI.FillData(); await Navigation.PopModalAsync(); } }; }