コード例 #1
0
        public static async Task <bool> TryAgain(string dialogMessage, string dialogTitle, Func <Task <bool> > func,
                                                 BackgroundOperations operations, string operationText)
        {
            while (true)
            {
                Task <bool> task = func();
                operations?.Add(task, operationText);

                if (await task)
                {
                    return(true);
                }
                if (!await DialogUtils.ShowTwoOptionsAsync(dialogMessage, dialogTitle, "Yes", "No"))
                {
                    return(false);
                }
            }
        }
コード例 #2
0
        public static async Task <bool> TryAgain(string dialogTitle, Func <Task <string> > func,
                                                 BackgroundOperations operations, string operationText)
        {
            while (true)
            {
                Task <string> task = func();
                operations?.Add(task, operationText);

                string errorMessage = await task;
                if (string.IsNullOrWhiteSpace(errorMessage))
                {
                    return(true);
                }
                if (!await DialogUtils.ShowTwoOptionsAsync(errorMessage, dialogTitle, "Yes", "No"))
                {
                    return(false);
                }
            }
        }