コード例 #1
0
        public ControlsViewModel(
            IRadio radio,
            [Import("CorePlayer")] ITrackPlayer player,
            Dispatcher dispatcher,
            IToastService toastService,
            ILoggerFacade logger)
        {
            _radio = radio;
            _radio.CurrentTrackChanged       += RadioOnCurrentTrackChanged;
            _radio.UpcomingTrackChanged      += RadioOnUpcomingTrackChanged;
            _radio.CurrentTrackStreamChanged += RadioOnCurrentTrackStreamChanged;
            _radio.TrackStreamQueued         += RadioOnTrackStreamQueued;
            _player                   = player;
            _dispatcher               = dispatcher;
            _toastService             = toastService;
            _logger                   = logger;
            _player.IsPlayingChanged += (sender, args) =>
            {
                RaisePropertyChanged("IsPlaying");
                RefreshCommands();
            };

            NextTrackCommand       = new ManualCommand(ExecuteNextTrack, CanExecuteNextTrack);
            TogglePlayPauseCommand = new ManualCommand(ExecuteTogglePlayPause, CanExecuteTogglePlayPause);
            ShareTrackCommand      = new ManualCommand <Track>(ExecuteShareTrack, CanExecuteShareTrack);
        }
コード例 #2
0
        public NowPlayingViewModel(IRadio radio, [Import("CorePlayer")] ITrackPlayer player, Dispatcher dispatcher)
        {
            _radio         = radio;
            _player        = player;
            _dispatcher    = dispatcher;
            _random        = new Random();
            _taskScheduler = TaskScheduler.FromCurrentSynchronizationContext();

            NavigateBackCommand    = new AutomaticCommand(ExecuteNavigateBack, CanExecuteNavigateBack);
            NextTrackCommand       = new ManualCommand(ExecuteNextTrack, CanExecuteNextTrack);
            TogglePlayPauseCommand = new ManualCommand(ExecuteTogglePlayPause, CanExecuteTogglePlayPause);
            ShareTrackCommand      = new ManualCommand <Track>(ExecuteShareTrack, CanExecuteShareTrack);
        }
コード例 #3
0
        public NowPlayingViewModel(IRadio radio, [Import("CorePlayer")] ITrackPlayer player, Dispatcher dispatcher)
        {
            _radio = radio;
            _player = player;
            _dispatcher = dispatcher;
            _random = new Random();
            _taskScheduler = TaskScheduler.FromCurrentSynchronizationContext();

            NavigateBackCommand = new AutomaticCommand(ExecuteNavigateBack, CanExecuteNavigateBack);
            NextTrackCommand = new ManualCommand(ExecuteNextTrack, CanExecuteNextTrack);
            TogglePlayPauseCommand = new ManualCommand(ExecuteTogglePlayPause, CanExecuteTogglePlayPause);
            ShareTrackCommand = new ManualCommand<Track>(ExecuteShareTrack, CanExecuteShareTrack);
        }
コード例 #4
0
 public CoreRadio(
     [Import("CorePlayer")]ITrackPlayer corePlayer,
     IDocumentStore documentStore,
     ILoadingIndicatorService loadingIndicatorService,
     IToastService toastService,
     ILoggerFacade logger,
     Dispatcher dispatcher)
 {
     _trackQueuePublic = new ObservableCollection<Track>();
     _trackStreamQueuePublic = new ObservableCollection<ITrackStream>();
     _trackStreamQueue = new ConcurrentQueue<ITrackStream>();
     _trackQueue = new ConcurrentQueue<Track>();
     _corePlayer = corePlayer;
     _documentStore = documentStore;
     _loadingIndicatorService = loadingIndicatorService;
     _toastService = toastService;
     _logger = logger;
     _dispatcher = dispatcher;
     _corePlayer.Volume = 0.2;
     _corePlayer.TrackComplete += OnTrackComplete;
     _corePlayer.Initialize();
 }
コード例 #5
0
 public CoreRadio(
     [Import("CorePlayer")] ITrackPlayer corePlayer,
     IDocumentStore documentStore,
     ILoadingIndicatorService loadingIndicatorService,
     IToastService toastService,
     ILoggerFacade logger,
     Dispatcher dispatcher)
 {
     _trackQueuePublic        = new ObservableCollection <Track>();
     _trackStreamQueuePublic  = new ObservableCollection <ITrackStream>();
     _trackStreamQueue        = new ConcurrentQueue <ITrackStream>();
     _trackQueue              = new ConcurrentQueue <Track>();
     _corePlayer              = corePlayer;
     _documentStore           = documentStore;
     _loadingIndicatorService = loadingIndicatorService;
     _toastService            = toastService;
     _logger                    = logger;
     _dispatcher                = dispatcher;
     _corePlayer.Volume         = 0.2;
     _corePlayer.TrackComplete += OnTrackComplete;
     _corePlayer.Initialize();
 }