public void Trim() { if (!string.IsNullOrEmpty(Title)) { Title = title.Trim(); } if (!string.IsNullOrEmpty(Text)) { Text = text.Trim(); } if (IsChecklist && Checklist != null) { for (int i = Checklist.Count - 1; i >= 0; i--) { if (!string.IsNullOrEmpty(Checklist[i].Text)) { Checklist[i].text = Checklist[i].text.Trim(); } if (string.IsNullOrEmpty(Checklist[i].Text)) { Checklist.RemoveAt(i); } } } }
private void DisableChecklist() { this.isChecklist = false; Text = GetTextFromChecklist(); Checklist.Clear(); }
public Note(string title, Checklist checklist, NoteColor color = null) : this() { this.title = title; this.text = ""; this.color = color is NoteColor ? color : NoteColor.DEFAULT; this.isChecklist = true; this.checklist = checklist; }
internal Note(string id, string title, string text, Checklist checklist, NoteImages images, NoteColor color, DateTime?createdAt, DateTime?updatedAt, DateTime?archivedAt) : this() { this.isChecklist = checklist != null && checklist.Count > 0; this.id = id; this.title = title; this.text = this.isChecklist ? "" : text; this.checklist = checklist; this.images = images; this.color = color is NoteColor ? color : NoteColor.DEFAULT; this.createdAt = createdAt; this.updatedAt = updatedAt; this.archivedAt = archivedAt; }
private void EnableChecklist() { this.isChecklist = true; if (!(string.IsNullOrEmpty(Text))) { string[] lines = Text.Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries); Checklist.Clear(); foreach (string line in lines) { Checklist.Add(ChecklistItem.FromText(line)); } } Text = ""; }
private void replaceChecklist(Checklist list) { if (Checklist.Count <= 0 && (list == null || list.Count <= 0)) { return; } Checklist.Clear(); if (list == null || list.Count <= 0) { return; } foreach (var item in list) { Checklist.Add(item); } return; }