Does ACR UserDialog run on main thread?

RayGoudieRayGoudie CAMember ✭✭

This is a question for @AllanRitchie.

I was reviewing the following code:

Xamarin.Forms.Device.BeginInvokeOnMainThread(() =>
            {
                Current.MainPage.DisplayActionSheet("Crash detected. Send anonymous crash report?", null, null, "Send", "Always Send", "Don't Send")
                .ContinueWith((arg) =>
                {
                    var answer = arg.Result;
                    UserConfirmation userConfirmationSelection;
                    if (answer == "Send")
                    {
                        userConfirmationSelection = UserConfirmation.Send;
                    }
                    else if (answer == "Always Send")
                    {
                        userConfirmationSelection = UserConfirmation.AlwaysSend;
                    }
                    else
                    {
                        userConfirmationSelection = UserConfirmation.DontSend;
                    }
                    AppCenterLog.Debug(LogTag, "User selected confirmation option: \"" + answer + "\"");
                    Crashes.NotifyUserConfirmation(userConfirmationSelection);
                });
            });

I am using ACR UserDialogs, so I was planning on replacing the call to Current.MainPage.DisplayActionSheet with a call to Acr.UserDialogs.ActionSheet.

I was then wondering whether I would need to keep the BeginInvokeOnMainThread block, or whether ACR UserDialog does this internally.

My question: Do we need to place calls to ACR UserDialog within a BeginInvokeOnMainThread block???

Thanks!

Best Answer

Answers

Sign In or Register to comment.