Exemplo n.º 1
0
        private void Model_NoteAdded(NoteModel note)
        {
            var viewModel = new NoteViewModel(this, note);

            _notes.Add(viewModel);
        }
Exemplo n.º 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;
     }
 }
Exemplo n.º 3
0
 private void Model_NoteAdded(NoteModel note)
 {
     var viewModel = new NoteViewModel(this, note);
     _notes.Add(viewModel);
 }