private void butLeer_Click(object sender, EventArgs e) { Cursor = Cursors.WaitCursor; try { if (ENSession.SharedSession.IsAuthenticated == false) { ENSession.SharedSession.AuthenticateToEvernote(); } if (!ENSession.SharedSession.IsAuthenticated) { throw new Exception("No autenticado"); } string textToFind = ""; List <ENNotebook> myNotebookList = ENSession.SharedSession.ListNotebooks(); cbMostrar.Enabled = false; textBox1.Text = ""; textBox2.Text = ""; _plain = ""; _cifrado = ""; string texto_nota = ""; foreach (ENNotebook en in myNotebookList) { List <ENSessionFindNotesResult> myResultsList = ENSession.SharedSession.FindNotes(ENNoteSearch.NoteSearch(textToFind), en, ENSession.SearchScope.All, ENSession.SortOrder.RecentlyUpdated, 500); foreach (ENSessionFindNotesResult note in myResultsList) { if (note.Title.Equals(tbNota.Text)) { _noteBook = en; _noteRef = note.NoteRef; _note = ENSession.SharedSession.DownloadNote(note.NoteRef); texto_nota += _note.TextContent; } } Application.DoEvents(); } if (texto_nota.Length > 0) { _plain = StringCipher.Decrypt(texto_nota, tbContrasenia.Text); _cifrado = texto_nota; textBox1.Text = _cifrado; textBox2.Text = _plain; cbMostrar.Enabled = true; cbMostrar.Checked = true; textBox2.Focus(); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Leer Nota", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } Cursor = Cursors.Default; }
public void SaveNote(Note note) { // Build the list of tags var tags = note.Tags?.ToList() ?? new List <string>(); tags.Add(_settings.Tag); var externalNote = new ENNote { Title = note.Title.Trim(), Content = ENNoteContent.NoteContentWithString(note.Body), TagNames = new List <string>(tags), }; // Find the target notebook ENNotebook notebook = null; if (!string.IsNullOrWhiteSpace(note.Folder)) { notebook = _session.ListNotebooks().FirstOrDefault(n => n.Name == note.Folder); } // Find the note to update ENSessionFindNotesResult findNoteResult; if (TryFindNote(note.Id, out findNoteResult)) { // Update the existing note var existingNoteRef = findNoteResult.NoteRef; if (notebook != null && findNoteResult.Notebook.Name != notebook.Name) { _logger.Warn($"Note has changed notebook to '{notebook.Name}' however it has been stored in Evernote as '{findNoteResult.Notebook.Name }'. The note cannot be moved."); } findNoteResult.Notebook = notebook ?? findNoteResult.Notebook; _session.UploadNote(externalNote, ENSession.UploadPolicy.Replace, findNoteResult.Notebook, existingNoteRef); } else { // Upload to the default notebook var noteRef = _session.UploadNote(externalNote, notebook); // Set the note identifier in the application meta data _session.PrimaryNoteStore.SetNoteApplicationDataEntry(noteRef.Guid, "NoteSync", note.Id); } }
///** // * Retrieves a note store client appropriate for accessing a given notebook. // * Useful for "bridging" between the high-level and EDAM APIs. // * // * @param notebook A valid notebook. // * // * @return A client for the note store that contains the notebook. // */ public object NoteStoreforNotebook(ENNotebook notebook) { return(base.NoteStoreForNotebook(notebook)); }
///** // * Retrieves a note store client appropriate for accessing a given notebook. // * Useful for "bridging" between the high-level and EDAM APIs. // * // * @param notebook A valid notebook. // * // * @return A client for the note store that contains the notebook. // */ public object NoteStoreforNotebook(ENNotebook notebook) { return base.NoteStoreForNotebook(notebook); }