Untitled

mail@pastecode.io avatar
unknown
plain_text
2 months ago
1.2 kB
8
Indexable
Never
//Invoke button


var item = sender as SwipeItemView;
if (!(item?.BindingContext is Schools getAC)) return;
schid = getAC.SchoolID;
if (!await DisplayAlert("Leave School",
        "You are about to leave the school. All associated data from your account with this school will be removed. You will have to enter the class again when you decide to comeback." +
        "Do you really want to leave?", "Yes", "No")) return;
progressLoading.IsVisible = true;
var a = await mySchools.LeaveSchool(schid);
if (a)
{

    var text =
        "You have successfully left the school!.";
    var duration = TimeSpan.FromSeconds(3);
    var snackbar = Snackbar.Make(text, null, "Got it!",
        duration, SnackBarSuccess);
    await snackbar.Show(cancellationTokenSource.Token);
    progressLoading.IsVisible = false;
}
else
{
    var text =
        "Something went wrong with your request. Please try again later!";
    var duration = TimeSpan.FromSeconds(3);
    var snackbar = Snackbar.Make(text, null, "Got it!",
        duration, SnackBarError);
    await snackbar.Show(cancellationTokenSource.Token);
    progressLoading.IsVisible = false;
}
Leave a Comment