示例#1
0
        void Annotations_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
        {
            switch (e.Action)
            {
            case NotifyCollectionChangedAction.Add:
                foreach (var item in e.NewItems)
                {
                    var viewModel = new AnnotationViewModel(this, item as AnnotationModel);
                    _annotations.Add(viewModel);
                }
                break;

            case NotifyCollectionChangedAction.Reset:
                _annotations.Clear();
                break;

            case NotifyCollectionChangedAction.Remove:
                foreach (var item in e.OldItems)
                {
                    _annotations.Remove(_annotations.First(x => x.AnnotationModel == item));
                }
                break;
            }
        }
示例#2
0
 void Annotations_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
 {
     switch (e.Action)
     {
         case NotifyCollectionChangedAction.Add:
             foreach (var item in e.NewItems)
             {                     
                 var viewModel = new AnnotationViewModel(this, item as AnnotationModel);
                 _annotations.Add(viewModel);
             }
             break;
         case NotifyCollectionChangedAction.Reset:
             _annotations.Clear();
             break;
         case NotifyCollectionChangedAction.Remove:
             foreach (var item in e.OldItems)
             {
                 _annotations.Remove(_annotations.First(x => x.AnnotationModel == item));
             }
             break;
     }
 }
示例#3
0
        private void Model_AnnotationAdded(AnnotationModel annotation)
        {
            var viewModel = new AnnotationViewModel(this, annotation);

            _annotations.Add(viewModel);
        }
示例#4
0
 private void Model_AnnotationAdded(AnnotationModel annotation)
 {
     var viewModel = new AnnotationViewModel(this, annotation);
     _annotations.Add(viewModel);
 }