public void Initialize()
 {
     _model = new ContactList();
     _model.AddContact(new Contact() { FirstName = "Charles", LastName = "Babbage" });
     _model.AddContact(new Contact() { FirstName = "Alan", LastName = "Turing" });
     _contactViewModels = new ComputedList<ContactViewModel>(() =>
         from c in _model.Contacts
         select new ContactViewModel(c)
     );
 }
        public void Initialize()
        {
            _contactList = new ContactList();
            _viewModel = new ContactListViewModel(_contactList);
            _contactList.AddContact(new Contact() { FirstName = "Michael", LastName = "Perry" });
            _contactList.AddContact(new Contact() { FirstName = "Ada", LastName = "Lovelace" });
            _contactList.AddContact(new Contact() { FirstName = "Charles", LastName = "Babbage" });

            _collectionChangedCount = 0;
            _viewModel.ContactsCollectionChanged +=
                delegate
                {
                    _collectionChangedCount++;
                };
        }
Exemple #3
0
 public ContactListViewModel(ContactList contactList)
 {
     _contactList                       = contactList;
     _depContactViewModels              = new Computed(UpdateContactViewModels);
     _depContactViewModels.Invalidated += new Action(_depContactViewModels_Invalidated);
 }