private void AppendTokenToNoteEnd(string token) { if (this.note.IsEmpty) { if (this.noteContentState == NoteContentState.Paragraph) { this.note.Append(new ParagraphTextNoteContentItem(token)); } else if (this.noteContentState == NoteContentState.List) { ListNoteContentItem listContent = new ListNoteContentItem(); listContent.Append(new PlainTextNoteContentItem(token)); this.note.Append(listContent); } return; } INoteContentItem lastItem = this.note.LastItem; PlainTextNoteContentItem lastPlainTextContent = lastItem as PlainTextNoteContentItem; if (lastPlainTextContent == null) { lastPlainTextContent = (lastItem as ListNoteContentItem).LastItem; } lastPlainTextContent.Append(token); }
private void AppendNewListItemToNoteEnd() { // if note is empty or last item is not list, append a new list ListNoteContentItem list = this.note.IsEmpty ? null : this.note.LastItem as ListNoteContentItem; if (this.note.IsEmpty || list == null) { ListNoteContentItem listContent = new ListNoteContentItem(); listContent.Append(new PlainTextNoteContentItem(string.Empty)); this.note.Append(listContent); } else { // otherwise append a new item to existing list list.Append(new PlainTextNoteContentItem(string.Empty)); } }