public SearchResultsViewModelFactory(IEventAggregator eventAggregator, ISearchResultItemViewModelFactory searchResultItemViewModelFactory) { if (eventAggregator == null) { throw new ArgumentNullException("eventAggregator"); } _eventAggregator = eventAggregator; _searchResultItemViewModelFactory = searchResultItemViewModelFactory; _lastSearchResults = new List<SynoItem>(); _eventAggregator.GetEvent<CompositePresentationEvent<SearchResultsRetrievedAggregatedEvent>>().Subscribe(SearchResultsUpdated, true); }
public SearchResultsViewModelFactory(IEventAggregator eventAggregator, ISearchResultItemViewModelFactory searchResultItemViewModelFactory) { if (eventAggregator == null) { throw new ArgumentNullException("eventAggregator"); } _eventAggregator = eventAggregator; _searchResultItemViewModelFactory = searchResultItemViewModelFactory; _lastSearchResults = new List <SynoItem>(); _eventAggregator.GetEvent <CompositePresentationEvent <SearchResultsRetrievedAggregatedEvent> >().Subscribe(SearchResultsUpdated, true); }
/// <summary> /// Initializes a new instance of the <see cref="SearchResultsViewModel"/> class. /// </summary> /// <param name="pageSwitchingService">The page switching service.</param> public SearchResultsViewModel(IPageSwitchingService pageSwitchingService, ISearchResultItemViewModelFactory searchResultItemViewModelFactory) { if (pageSwitchingService == null) { throw new ArgumentNullException("pageSwitchingService"); } // register for search results updates _eventAggregator = IoC.Container.Get <IEventAggregator>(); _pageSwitchingService = pageSwitchingService; _searchResultItemViewModelFactory = searchResultItemViewModelFactory; FilterResultsCommand = new DelegateCommand <string>(OnFilterResults); // everytime the searchResults changes, we'll react to that change. _eventAggregator.GetEvent <CompositePresentationEvent <SearchResultsRetrievedAggregatedEvent> >().Subscribe(SearchResultsUpdated, true); }