/// <summary> /// Highlights the <see cref="Note"/> controls for the specified <see cref="Person"/>. /// </summary> /// <param name="person">The person to highlight notes for.</param> public void FilterNotes(Person person) { // Each child control is a ContentPresenter that's wrapping a Note control. var children = Children; foreach (var noteContentPresenter in children) { Note n = GetVisualChild <Note>(noteContentPresenter); StickyNote sn = n.DataContext as StickyNote; CompositeTransform ct = n.RenderTransform as CompositeTransform; if (sn.NoteIsFor.FriendlyName == person.FriendlyName || person.FriendlyName == App.EVERYONE || sn.NoteIsFor.FriendlyName == App.EVERYONE) { // Make note totally not transparent. BringNoteToFront(n); n.Opacity = _opacityTop; ct.ScaleX = _noteScaleTopX; ct.ScaleY = _noteScaleTopY; } else { // Make note a little transparent, ideally push it back into the z-dimension. n.Opacity = _opacityMid; ct.ScaleX = _noteScaleMidX; ct.ScaleY = _noteScaleMidY; } } }
private static void NoteBusinessObjectPropertyChanged(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs ea) { Note instance = dependencyObject as Note; StickyNote note = ea.NewValue as StickyNote; instance.DisplayName = $"For: {note.NoteIsFor.FriendlyName}"; }
public StickyNote CreateNote(Person person) { // Create the new note StickyNote newNote = new StickyNote(person); FamilyModel.StickyNotes.Add(newNote); return(newNote); }
public StickyNote CreateNote(string nameTag) { // Create the new note StickyNote newNote = new StickyNote(nameTag); newNote.NoteIsFor = FamilyModel.PersonFromName(nameTag); FamilyModel.StickyNotes.Add(newNote); return(newNote); }
public int CountNotes(Person person) { // Each child control is a ContentPresenter that's wrapping a Note control. var children = Children; int count = 0; foreach (var noteContentPresenter in children) { Note n = GetVisualChild <Note>(noteContentPresenter); StickyNote sn = n.DataContext as StickyNote; CompositeTransform ct = n.RenderTransform as CompositeTransform; if (sn.NoteIsFor.FriendlyName == person.FriendlyName) { count++; } } return(count); }
/// <summary> /// Delete a note from the collection of notes /// </summary> /// <param name="noteToDelete"></param> public void DeleteNote(StickyNote noteToDelete) => StickyNotes.Remove(noteToDelete);