Skip to content

Instantly share code, notes, and snippets.

@aritchie
Created October 13, 2021 13:47
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aritchie/58dc3b021756ab7de3e49ead21fa451f to your computer and use it in GitHub Desktop.
Save aritchie/58dc3b021756ab7de3e49ead21fa451f to your computer and use it in GitHub Desktop.
async void Button_Clicked_3(System.Object sender, EventArgs args) {
var cts = new CancellationTokenSource();
try
{
// if any exception is thrown, the progress will be cleaned up automagically
using (var disp = UserDialogs.Instance.Loading(
"Long Load...",
// this will cancel the actual http call
() => cts.Cancel(),
"Cancel"))
{
var data = await httpLong.GetData(cts.Cancel);
}
}
catch (Exception ex) {
UserDialogs.Instance.Alert(ex.ToString());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment