public async void CanExecuteDelete() { if (SelectedClinic?.ClinicName != null) { var acceptAction = new SnackBarActionOptions() { Action = () => ExecuteDelete(), ForegroundColor = Color.FromHex("#0990bf"), BackgroundColor = Color.FromHex("#e2e2e2"), Text = "OK", Padding = 12 }; var options = new SnackBarOptions() { MessageOptions = new MessageOptions() { Foreground = Color.FromHex("#505050"), Padding = 12, Message = "Do you want to move this to recycle bin?" }, BackgroundColor = Color.FromHex("#e2e2e2"), Duration = TimeSpan.FromSeconds(5), CornerRadius = 12, Actions = new[] { acceptAction } }; await App.Current.MainPage.DisplaySnackBarAsync(options); } else { StandardMessagesDisplay.NoItemSelectedDisplayMessage(); } }
async Task OnActionClick(SnackBarActionOptions action, SnackBarOptions arguments) { try { if (action.Action != null) { await action.Action(); } arguments.SetResult(true); } catch (Exception ex) { arguments.SetException(ex); } }