public MainWindowViewModel(IRegionManager regionManager, IEventAggregator eventAggregator, IRssStore sourceStore) { _logger.Log("Initialize the viewmodel for the main window", Category.Info, Priority.Medium); _regionManager = regionManager; _eventAggregator = eventAggregator; _sourceStore = sourceStore; LoadSources(); GetSourceDelegateCommand = new DelegateCommand <Source>(SetCurrentSource); GetAllSourcesDelegateCommand = new DelegateCommand(GetAllSources); UpdateFeedsDelegateCommand = new DelegateCommand(UpdateFeeds); OpenAddSourceWindowDelegateCommand = new DelegateCommand(OpenAddSourceWindow); OpenEditSourceWindowDelegateCommand = new DelegateCommand(OpenEditSourceWindow); ShowArchiveFeedsDelegateCommand = new DelegateCommand(ShowArchiveFeeds); ShowFeedsDelegateCommand = new DelegateCommand(ShowFeeds); eventAggregator.GetEvent <WantUriEvent>().Subscribe(OpenBrowser); eventAggregator.GetEvent <WantCloseUriEvent>().Subscribe(CloseBrowser); eventAggregator.GetEvent <EditSourceEvent>().Subscribe(EditSource); eventAggregator.GetEvent <NewSourceEvent>().Subscribe(AddSource); eventAggregator.GetEvent <RemoveSourceEvent>().Subscribe(RemoveSource); eventAggregator.GetEvent <FeedsLoadedEvent>().Subscribe(FeedsLoaded); }
public ArchiveFeedBoxUserControlViewModel(IEventAggregator eventAggregator, IRssStore rssStore) { _logger.Log("Initialize the viewmodel for the archive", Category.Info, Priority.Medium); AllArchivedFeeds = rssStore.LoadAllArchiveFeeds(); _eventAggregator = eventAggregator; _rssStore = rssStore; ChangeFeedCommand = new DelegateCommand <FeedViewModel>(ClickedArchiveFeed); RemoveFromArchiveCommand = new DelegateCommand <FeedViewModel>(RemoveFromArchiveFeed); SearchCommand = new DelegateCommand(SearchWithTerm); CleanFilterCommand = new DelegateCommand(Reset); eventAggregator.GetEvent <NewArchiveFeedEvent>().Subscribe(AddNewArchiveFeed); eventAggregator.GetEvent <RemoveArchiveFeedEvent>().Subscribe(RemoveFromArchiveFeed); }
public EditSourceFormWindowViewModel(IEventAggregator eventAggregator, IRssStore rssStore) { _logger.Log("Initialize the viewmodel for edit the sources", Category.Info, Priority.Medium); _eventAggregator = eventAggregator; AllSources = rssStore.GetAllSources(); PreviewEditSourceCommand = new DelegateCommand <Source>(PreviewOneSource); RemoveSourceCommand = new DelegateCommand(RemoveOneSource); EditSourceCommand = new DelegateCommand(EditOneSource, CanExecute). ObservesProperty(() => NameOfSource). ObservesProperty(() => CategoryOfSource). ObservesProperty(() => UriOfSource); if (AllSources.Count >= 1) { SourceToEdit = AllSources.ElementAt(0); } }