Exemplo n.º 1
0
 public async void Delete(Markdown.Item item)
 {
     if (item.Parent == null)
     {
         if (!await DisplayAlert(Strings.Loc.ViewerPage_ClearTitle, Strings.Loc.ViewerPage_ClearConfirm, Strings.Loc.ViewerPage_Yes, Strings.Loc.ViewerPage_No))
         {
             return;
         }
         NoteNavigator.Document.Root.Childs.Clear();
         await DeviceServices.SaveDocumentAsync();
     }
     else
     {
         if (!await DisplayAlert(Strings.Loc.ViewerPage_DeleteTitle, String.Format(Strings.Loc.ViewerPage_DeleteConfirm, item.Title), Strings.Loc.ViewerPage_Yes, Strings.Loc.ViewerPage_No))
         {
             return;
         }
         Markdown.Item newCurrent = NoteNavigator.CurrentNote;
         if (NoteNavigator.CurrentNote == item)
         {
             newCurrent = item.Parent;
         }
         NoteNavigator.Document.RemoveContent(item);
         NoteNavigator.BuildPathToNote(newCurrent);
         await DeviceServices.SaveDocumentAsync();
     }
     RefreshWebView();
 }
Exemplo n.º 2
0
        public async void SaveNote()
        {
            //TODO Validation
            if ((editingNote.Parent != null) || (editingNote != NoteNavigator.Document.Root))
            {
                if (editingNote.Parent != noteCategory.SelectedItem)
                {
                    NoteNavigator.Document.ChangeParent(editingNote, (Markdown.Item)noteCategory.SelectedItem);
                }
                editingNote.Title = noteTitle.Text;
            }
            NoteNavigator.Document.UpdateContent(editingNote, noteContent.Text);
            NoteNavigator.BuildPathToNote(editingNote);

            await DeviceServices.SaveDocumentAsync();

            await Navigation.PopAsync(true);

            onClose();
        }