Exemplo n.º 1
0
        /// <summary>
        /// The save async method
        /// Saves/updates the note and closes the edit note page
        /// </summary>
        /// <returns>A task to save/update the note and close the edit note page</returns>
        private async Task SaveAsync()
        {
            if (Title.Contains(":"))
            {
                await DisplayPopupHelpers
                .ShowOKDialogAsync("Invalid Title",
                                   "Title cannot include special character ':'");

                return;
            }

            string noteData = Title + ':' + Text;
            string color    = Color.ToHex();

            IOHelpers.SaveNoteData(CurrentNote.Filename, noteData, color);

            await NavigationHelpers.PopCurrentPageAsync();
        }
Exemplo n.º 2
0
        /// <summary>
        /// The delete async method
        /// Deletes the current note following validation and closes the note page
        /// </summary>
        /// <returns>A task to delete the current note following validation and close the note page</returns>
        private async Task DeleteAsync()
        {
            //Bypass the validation check if set by the AppSettings
            if (AppSettings.RequireDeleteCheck)
            {
                string promptResult = await DisplayPopupHelpers
                                      .ShowPromptAsync("Validation",
                                                       "To delete this note, enter it's title");

                if (promptResult == null)
                {
                    return;
                }

                if (promptResult != Title)
                {
                    await DisplayPopupHelpers
                    .ShowOKDialogAsync("Incorrect",
                                       "Your note has not been deleted");

                    return;
                }
            }

            if (IOHelpers.NoteExists(CurrentNote.Filename))
            {
                IOHelpers.DeleteNote(CurrentNote.Filename);
                await DisplayPopupHelpers
                .ShowOKDialogAsync("Deleted",
                                   "Your note has been deleted");
            }
            else
            {
                await DisplayPopupHelpers
                .ShowOKDialogAsync("Error",
                                   "The file could not be found; your note has not been deleted");
            }

            await NavigationHelpers.PopCurrentPageAsync();
        }
Exemplo n.º 3
0
 /// <summary>
 /// The cancel async method
 ///
 /// Closes the new note page
 /// </summary>
 /// <returns>A task to close the new note page</returns>
 private async Task CancelAsync()
 {
     await NavigationHelpers.PopCurrentPageAsync();
 }