コード例 #1
0
 private void InitUmlClassViewModels()
 {
     foreach (var umlClassController in controller.UmlClassControllers)
     {
         var viewModel = new UmlClassViewModel(umlClassController);
         umlClassViewModels.Add(viewModel);
     }
 }
コード例 #2
0
        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);
            }
        }