// Fetching shipping rates requires communicating with 3rd party shipping servers, so we need to poll until all the rates have been fetched. private async Task FetchShippingRatesAsync() { try { IEnumerable <ShippingRate> shippingRates; while ((shippingRates = await SampleApplication.GetShippingRatesAsync()) == null) { await Task.Delay(PollDelay); } OnFetchedShippingRates(shippingRates.ToList()); } catch (ShopifyException ex) { OnError(ex.Error); } isFetching = false; }