private Task LoadData() { return(Loader.ExecuteAsync(async(token) => { _counter = (_counter + 1) % 4; await Task.Delay(2000); if (_counter == 3) { return LoaderResult.Success(); } var countdown = 3 - _counter; return LoaderResult.Error($"Oops, there was an error! Try it {countdown} more time!"); })); }
private Task LoadData() { return(Loader.ExecuteAsync(async(token) => { _counter = (_counter + 1) % 3; await Task.Delay(2000); switch (_counter) { case 0: return LoaderResult.Error("Oops, there was an error!"); case 1: return LoaderResult.Empty(); default: return LoaderResult.Success(); } })); }