Пример #1
0
        /// <summary>
        /// The async task for deleting all the notes in the application
        /// Also asks for validation from the user before deleting
        /// </summary>
        /// <returns>A task to delete all the notes</returns>
        private async Task DeleteAllNotes()
        {
            await DisplayPopupHelpers
            .ShowOKDialogAsync("Are you sure?",
                               "You are about to delete ALL your notes. This CANNOT be reversed!");

            string promptResult = await DisplayPopupHelpers
                                  .ShowPromptAsync("Are you sure?",
                                                   "Please enter 'DELETE ALL MY NOTES' into the box below to confirm");

            if (promptResult == null)
            {
                return;
            }

            if (promptResult != "DELETE ALL MY NOTES")
            {
                await DisplayPopupHelpers
                .ShowOKDialogAsync("Incorrect",
                                   "Your notes have NOT been deleted");

                return;
            }

            await Task.Run(() => IOHelpers.DeleteAllNotes());

            await DisplayPopupHelpers
            .ShowOKDialogAsync("Deleted",
                               "All your notes have now been deleted");
        }