public void TestNote() { Note note = new Note(); note.Title = "here"; note.Content = "we"; //note.Tags = "go"; INote iNote = note; Note copyNote = new Note(iNote); Assert.AreNotSame(note, copyNote); Assert.AreEqual(note.Title, copyNote.Title); Assert.AreEqual(note.Content, copyNote.Content); Assert.AreEqual(note.Tags, copyNote.Tags); }
public static void Test() { NotesModel notes = new NotesModel(); Note n = new Note { Title = "Testing", Content = "Works" }; //notes.Add(n); //notes.SaveToFile(); notes.LoadFromFile(); //Note loaded = notes.[0]; //Console.WriteLine (loaded.Title); }
public void TestNote2() { Note note = new Note(); note.Title = "here"; note.Content = "we"; //note.Tags = "go"; INote iNote = note; Note copyNote = new Note(iNote); Type noteType = typeof(INote); foreach(PropertyInfo pInfo in noteType.GetProperties(System.Reflection.BindingFlags.GetProperty)) { object o = pInfo.GetValue (copyNote); Assert.AreNotEqual(o, null); if (o is string) { Assert.AreEqual(note.Title, (string) o); } } }
public Tag(string name, Note note) { Name = name; Notes = new HashSet<Note> (); Notes.Add(note); }
private void RemoveTagsFrom(Note note, IEnumerable<string> tags) { foreach (String tagStr in tags) { Tag tag = tagDict[tagStr]; if(tag.Count == 1) { DeleteTag(tag); } else { tag.Notes.Remove (note); TagStore.SetValue(tag.TreeIter, (int)TagCols.Count, tag.Count); } } }
private void RemoveTagsFrom(Note note) { RemoveTagsFrom(note, note.Tags); }
private void AddTagsFrom(Note note, IEnumerable<string> tags, IDictionary<String,Tag> tagDict, Gtk.ListStore tagStore) { foreach(String tag in tags) { if(!tagDict.ContainsKey(tag)) { tagDict[tag] = new Tag(tag, note); } else { //implies that tag has already been created tagDict[tag].Notes.Add(note); } AddTagToStore(tagDict[tag], tagStore); } }
private void AddTagsFrom(Note note, IEnumerable<string> tags, IDictionary<String,Tag> tagDict) { AddTagsFrom(note, tags, tagDict, TagStore); }
private void AddTagsFrom(Note note, IEnumerable<string> tags) { AddTagsFrom(note, tags, tagDict); }
private void AddTagsFrom(Note note) { AddTagsFrom(note, note.Tags); }
private void AddNoteToStore(Note note, Gtk.ListStore notesStore) { if (note.TreeIter.Equals (Gtk.TreeIter.Zero)) { note.TreeIter = notesStore.AppendValues (note.Title, note); Debug.Assert(!note.TreeIter.Equals(Gtk.TreeIter.Zero)); } else { notesStore.SetValue(note.TreeIter, (int)NoteCols.Title, note.Title); } }
private void AddNoteToStore(Note note) { AddNoteToStore(note,NotesStore); }
public void Update(Note note, INote newNote) { note.Title = newNote.Title; NotesStore.SetValue(note.TreeIter, (int)NoteCols.Title, note.Title); note.Content = newNote.Content; //TODO: optimize this later. HashSet<string> intersectTags = new HashSet<string> ( note.Tags.Intersect(newNote.Tags) ); IEnumerable<string> obsoleteTags = note.Tags.Except(intersectTags); IEnumerable<string> newTags = newNote.Tags.Except(intersectTags); RemoveTagsFrom(note, obsoleteTags); AddTagsFrom(note, newTags); note.Tags = newNote.Tags; SaveToFile(); }
public void Remove(Note note) { notes.Remove(note); Gtk.TreeIter treeIter = note.TreeIter; NotesStore.Remove(ref treeIter); RemoveTagsFrom(note); //TODO buffering or something? SaveToFile(); }
public void Add(Note note) { notes.Add(note); AddNoteToStore(note); AddTagsFrom(note); //TODO buffering or something? SaveToFile(); }
public void Add(INote note) { Note n = new Note(note); Add(n); }