public void RefreshContacts() { Contacts = new ObservableCollection <Contact> { }; client = new ServicePersonalAssistantClient(new System.ServiceModel.InstanceContext(this)); Contact[] contacts_from_db = client.RefreshContacts(CurrentUser.Id); for (int i = 0; i < contacts_from_db.Length; i++) { Contacts.Add(contacts_from_db[i]); } OnPropertyChanged("Contacts"); }
public ContactsVM(IMainWindow mainWindow, User currentUser) { _MainWindow = mainWindow; CurrentUser = currentUser; client = new ServicePersonalAssistantClient(new System.ServiceModel.InstanceContext(this)); Contacts = new ObservableCollection <Contact> { }; Contact[] contacts_from_db = client.RefreshContacts(CurrentUser.Id); for (int i = 0; i < contacts_from_db.Length; i++) { Contacts.Add(contacts_from_db[i]); } }