예제 #1
0
        public SpotifyLocalPlayerViewModel(IQueueController queueController, IRegionManager regionManager,
                                           ILoggerFacade logger, ISpotifySongSearch songService, IThreadHelper helper)
        {
            _treadHelper   = helper;
            _songService   = songService;
            _logger        = logger;
            _api           = new SpotifyLocalAPI();
            _regionManager = regionManager;
            if (!SpotifyLocalAPI.IsSpotifyWebHelperRunning())
            {
                SpotifyLocalAPI.RunSpotifyWebHelper();
            }
            if (!SpotifyLocalAPI.IsSpotifyRunning())
            {
                SpotifyLocalAPI.RunSpotify();
            }
            _api.OnTrackChange     += _api_OnTrackChange;
            _api.OnTrackTimeChange += TrackTimeChanged;
            _api.OnPlayStateChange += PlayStateChanged;
            bool retryConnect;

            _api.ListenForEvents = true;
            do
            {
                //TODO: urgent need dialog!
                var connected = _api.Connect();
                retryConnect = !connected;
            } while (retryConnect);
            _queueController = queueController;
            _queueController.CurrentSongChangedEvent += QueueControllerOnCurrentSongChangedEvent;
            _queueController.IsPlayingChangedEvent   += QueueControllerOnIsPlayingChangedEvent;
            //Task.Run(async () => await FetchStartUpSong());
        }
예제 #2
0
 public StatusViewModel(IQueueController queueController)
 {
     QueueController = queueController;
     QueueController.IsPlayingChangedEvent   += _queueController_IsPlayingChangedEvent;
     QueueController.CurrentSongChangedEvent += QueueControllerOnCurrentSongChangedEvent;
     PlayPauseCommand = new DelegateCommand(PlayPauseAction);
     NextCommand      = new DelegateCommand(NextAction);
     PreviousCommand  = new DelegateCommand(PreviousAction);
 }
예제 #3
0
 public VideoInfoViewModel(IQueueController queueController, IRegionManager manager, IThreadHelper threadHelper
                           , ILoggerFacade logger)
 {
     _logger          = logger;
     _queueController = queueController;
     _regionManager   = manager;
     _threadHelper    = threadHelper;
     _queueController.CurrentSongChangedEvent += QueueControllerOnCurrentSongChangedEvent;
     _queueController.IsPlayingChangedEvent   += QueueControllerOnIsPlayingChangedEvent;
     NextCommand = new DelegateCommand(ExecuteNext);
 }
예제 #4
0
 public SpotifyAcountViewModel(IRegionManager rm, ILoggerFacade logger,
                               ISpotifyUserService userService, IDialogService dialog, IThreadHelper threadHelper, IQueueController queueController)
 {
     _queueController     = queueController;
     _regionManager       = rm;
     _logger              = logger;
     _userService         = userService;
     _dialog              = dialog;
     _threadHelper        = threadHelper;
     ShowSearchCommand    = new DelegateCommand(ExecuteSearch);
     TryConnectApiCommand = new DelegateCommand(ExecuteConnectApi);
     AddSongCommand       = new DelegateCommand(ExecuteAddSong);
 }
예제 #5
0
        public QueueViewModel(IQueueController queueController,
                              IPlaylistService playlistService, IUnityContainer container)
        {
            _queueController           = queueController;
            _playlistService           = playlistService;
            _container                 = container;
            SaveQueueCommand           = new DelegateCommand(SaveAction);
            LoadQueueCommand           = new DelegateCommand(LoadAction);
            DeleteSongFromQueueCommand = new DelegateCommand <BaseSong>(DeleteQueueSong);
            PlaySongCommand            = new DelegateCommand(PlaySong);

            _queueController.PlaylistChangedEvent += QueueControllerOnPlaylistChangedEvent;
            SetQueue();
            Queue.CollectionChanged += new NotifyCollectionChangedEventHandler(QueueOnCollectionChanged);
        }
예제 #6
0
 public SpotifyFindViewModel(ISpotifySongSearch songSearchService, IQueueController queueController,
                             IUnityContainer container, IRegionManager regionManager, ILoggerFacade logger, IDialogService dialogService)
 {
     _dialogService          = dialogService;
     _logger                 = logger;
     _regionManager          = regionManager;
     _container              = container;
     _songSearchService      = songSearchService;
     _queueController        = queueController;
     SearchCommand           = new DelegateCommand(SearchAction);
     FetchMoreResultCommand  = new DelegateCommand(MoreAction);
     AddSongCommand          = new DelegateCommand <object>(AddAction);
     FocusSearchFieldCommand = new DelegateCommand(FocusAction);
     GlobalCommands.ShowSearchFieldInActiveCommand.RegisterCommand(FocusSearchFieldCommand);
     SearchSingleCommand = new DelegateCommand(SingleSearchAction);
     ShowAccountCommand  = new DelegateCommand(ExecuteFindAccount);
 }
예제 #7
0
 public YoutubeFindViewModel(IUnityContainer container,
                             IYoutubeSongSearchService songSearchService,
                             IQueueController queueController, ILoggerFacade logger)
 {
     _songSearchService        = songSearchService;
     _queueController          = queueController;
     _container                = container;
     _logger                   = logger;
     SearchCommand             = new DelegateCommand(SearchCommandAction);
     FetchMoreResultCommand    = new DelegateCommand(FetchMoreResultCommandAction);
     AddSongCommand            = new DelegateCommand <object>(AddSongAction);
     PreviewCommand            = new DelegateCommand <object>(PreviewSong);
     RemoveUploadFilterCommand = new DelegateCommand(RemoveUploadFilterAction);
     FocusSearchFieldCommand   = new DelegateCommand(FocusSearchFieldAction);
     SearchSingleCommand       = new DelegateCommand(SingleSearchAction);
     ShowPlaylistSearchCommand = new DelegateCommand(ShowPlaylistSearchAction);
     GlobalCommands.ShowSearchFieldInActiveCommand.RegisterCommand(FocusSearchFieldCommand);
 }
예제 #8
0
        public SelectPlaylistViewModel(IPlaylistService platlistService, IQueueController queueController)
        {
            _queueController = queueController;
            _playlistService = platlistService;
            Playlists        = new ObservableCollection <Playlist>(_playlistService.NameOfAllPlaylists().Select(t => new Playlist()
            {
                Name = t
            }));
            if (_queueController.Queue != null)
            {
                CurrentPLaylist = Playlists.FirstOrDefault(t => t.Name == _queueController.Queue.Name);
            }
            var select = new CompositeCommand();

            select.RegisterCommand(new DelegateCommand(ChangePlaylist, () => CurrentPLaylist != null));
            select.RegisterCommand(DialogHost.CloseDialogCommand);
            ChangePlaylistToSelected = select;
        }
예제 #9
0
        public QueueService()
        {
            StructureMapAspNet.Configure(Assembly.GetExecutingAssembly());
            var config = new CommandProcessorNirvanaConfig();

            NirvanaSetup.Configure()
            .SetAdditionalAssemblyNameReferences(config.AssemblyNameReferences)
            .SetRootTypeAssembly(typeof(Services.Shared.InfrastructureRoot).Assembly)
            .SetAttributeMatchingFunction(config.AttributeMatchingFunction)
            .SetDependencyResolver(config.GetService, config.GetAllServices)
            .ForCommands(MediationStrategy.ForwardToWeb, MediationStrategy.ForwardToQueue, MediationStrategy.ForwardToQueue)
            .ForInternalEvents(MediationStrategy.ForwardToWeb, MediationStrategy.ForwardToQueue, MediationStrategy.ForwardToQueue)
            .ForUiNotifications(MediationStrategy.ForwardToWeb, MediationStrategy.ForwardToQueue, MediationStrategy.ForwardToQueue)
            .BuildConfiguration()
            ;

            _queueController = InternalDependencyResolver.GetInstance <IQueueController>();
        }
예제 #10
0
 public SampleQueueProcessingService()
 {
     this.queueController = new AzureServiceBusQueueController();
     this.handler         = new SampleMessageHandler();
 }