示例#1
0
 private static async Task <T> PullDataWithRetriesAsync <T>(string url)
 {
     return(await Policy
            .Handle <Exception>(x => x.IsInternetConnectionException())
            .WaitAndRetryAsync
            (
                3,
                retryAttempt => TimeSpan.FromSeconds(Math.Pow(3, retryAttempt)),
                (ex, time) => { Toasts.DisplayError("An error occurred while retrieving data. Retrying..."); }
            )
            .ExecuteAsync(async() => await PullDataAsync <T>(url)));
 }