public SearchedSongsViewModel(ISongDataProvider songDataProvider,
                                      IQueuedSongDataProvider queuedSongDataProvider, ISearchHistoryProvider searchHistory, IVoiceControl voiceControl,
                                      IEventAggregator eventAggregator, IRegionManager regionManager, IDjHorsifyService djHorsifyService, ILoggerFacade loggerFacade) : base(queuedSongDataProvider, eventAggregator, loggerFacade)
        {
            _eventAggregator = eventAggregator;
            _regionManager   = regionManager;

            _djHorsifyService = djHorsifyService;
            _voiceControl     = voiceControl;
            _voiceControl.VoiceCommandSent += _voiceControl_VoiceCommandSent;

            _songDataProvider = songDataProvider;
            _searchHistory    = searchHistory;
            RecentSearch      = new RecentSearch();

            SearchedSongs = _songDataProvider.SearchedSongs;
            SongsListView = new ListCollectionView(_songDataProvider.SearchedSongs);

            SongsListView.CurrentChanged += SongsListView_CurrentChanged;

            //Dialog requests
            RequestRandomViewRequest = new InteractionRequest <INotification>();
            RequestSortDialogRequest = new InteractionRequest <INotification>();
            RequestViewCommand       = new DelegateCommand <string>((viewName) => OnRequestView(viewName));
        }
        public InstantSearchViewModel(ISongDataProvider songDataProvider, IHorsifySongApi horsifySongApi, IRegionManager regionManager,
                                      IEventAggregator eventAggregator, IQueuedSongDataProvider queuedSongDataProvider, ILoggerFacade loggerFacade)
            : base(queuedSongDataProvider, eventAggregator, loggerFacade)
        {
            _songDataProvider = songDataProvider;
            _horsifySongApi   = horsifySongApi;
            _eventAggregator  = eventAggregator;
            _regionManager    = regionManager;

            _dispatcherTimer.Interval = TimeSpan.FromMilliseconds(1000);
            _dispatcherTimer.Tick    += _dispatcherTimer_Tick;

            SearchModel.PropertyChanged += SearchModel_PropertyChanged;

            ShowSearchKeyboardViewCommand = new DelegateCommand <object>(OnShowSearchKeyboard);

            SearchResults = new ListCollectionView(SearchModel.AllJoinedTables);
            SearchResults.CurrentChanged += SearchResults_CurrentChanged;
        }
Beispiel #3
0
        public MediaControlViewModel(IEventAggregator eventAggregator, ILoggerFacade loggerFacade,
                                     IHorsifyMediaController horsifyMediaController, ISongDataProvider songDataProvider, MediaControl mediaControl, IDiscordRpcService discordRpcService)
            : base(loggerFacade, horsifyMediaController, eventAggregator, mediaControl)
        {
            _songDataProvider  = songDataProvider;
            _discordRpcService = discordRpcService;

            #region Events
            //Update SelectedSong
            _eventAggregator.GetEvent <OnMediaPlay <AllJoinedTable> >()
            .Subscribe(song => { OnSongChangedLoaded(song); }, ThreadOption.UIThread);

            //Queue completed
            _eventAggregator.GetEvent <QueuedJobsCompletedEvent>().Subscribe(() => { OnQueueCompletedMessage(); }, ThreadOption.UIThread);

            _horsifyMediaController.OnTimeChanged   += (currentTime) => { OnTimeChanged(MediaControlModel, currentTime); };
            _horsifyMediaController.OnMediaFinished += OnMediaFinsished;
            _horsifyMediaController.OnMediaLoaded   += (duration) => { MediaControlModel.CurrentSongTime = duration; };

            #endregion

            //Enable discord. TODO: Make optional
            _discordRpcService.Enable(true);
        }