public void Execute() { IEnumerable <Contact> contacts; try { contacts = _contactsProvider.GetAll(); } catch (Exception) { throw new Exception("Cannot load contacts sever."); } _eventAggregator.Publish(new ContactsLoaded(contacts)); }
private void UpdateContacts(object sender, ElapsedEventArgs elapsedEventArgs) { IEnumerable <Contact> contacts; try { contacts = _contactsProvider.GetAll();; } catch (Exception) { Thread.CurrentThread.Abort(); return; } _eventAggregator.Publish(new ContactsDataReceived(contacts, false)); }