Пример #1
0
        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);
                    }
                }
            }
        }
Пример #2
0
        private void DisableChecklist()
        {
            this.isChecklist = false;

            Text = GetTextFromChecklist();

            Checklist.Clear();
        }
Пример #3
0
        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;
        }
Пример #4
0
        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;
        }
Пример #5
0
        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 = "";
        }
Пример #6
0
        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;
        }