예제 #1
0
        private void Model_NoteAdded(NoteModel note)
        {
            var viewModel = new NoteViewModel(this, note);

            _notes.Add(viewModel);
        }
예제 #2
0
 void Notes_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
 {
     switch (e.Action)
     {
         case NotifyCollectionChangedAction.Add:
             foreach (var item in e.NewItems)
             {
                 //add a corresponding note
                 var viewModel = new NoteViewModel(this, item as NoteModel);
                 _notes.Add(viewModel);
             }
             break;
         case NotifyCollectionChangedAction.Reset:
             _notes.Clear();
             break;
         case NotifyCollectionChangedAction.Remove:
             foreach (var item in e.OldItems)
             {
                 _notes.Remove(_notes.First(x => x.Model == item));
             }
             break;
     }
 }
예제 #3
0
 private void Model_NoteAdded(NoteModel note)
 {
     var viewModel = new NoteViewModel(this, note);
     _notes.Add(viewModel);
 }