private void InitUmlClassViewModels() { foreach (var umlClassController in controller.UmlClassControllers) { var viewModel = new UmlClassViewModel(umlClassController); umlClassViewModels.Add(viewModel); } }
private void OnUmlClassesChanged(object sender, NotifyCollectionChangedEventArgs e) { foreach (var removedItem in e.OldItems) { var viewModel = umlClassViewModels.FirstOrDefault(v => v.Controller == removedItem); umlClassViewModels.Remove(viewModel); } foreach (var addedItem in e.NewItems) { var viewModel = new UmlClassViewModel((UmlClassController)addedItem); umlClassViewModels.Add(viewModel); } }