Beispiel #1
0
 public ErosPodService(
     IRadioAdapter radioAdapter,
     IPodRepository podRepository,
     IUnityContainer container,
     [Dependency(RegistrationConstants.RileyLink)] IRadioService radioServiceRileyLink)
 {
     RadioProviders = new[] { radioServiceRileyLink };
     RadioAdapter   = radioAdapter;
     Container      = container;
     PodRepository  = podRepository;
     PodDictionary  = new Dictionary <long, IPod>();
     PodLock        = new AsyncLock();
 }
Beispiel #2
0
        public RadioViewModel(IRadioService radioService)
        {
            _SyncContext = SynchronizationContext.Current;

            Radios = new ObservableCollection <RadioChannel>();

            foreach (var radio in radioService.RadioChannels)
            {
                Radios.Add(radio);
            }

            ActiveRadio = radioService.SelectedRadioChannel;
            IsPlaying   = radioService.IsPlaying;
            Volume      = radioService.Volume;

            radioService.SelectedRadioChannelChanged += RadioService_RadioSelectionChanged;
            radioService.RadioPlaybackStatusChanged  += RadioService_RadioPlaybackStatusChanged;
            radioService.RadioPlaybackVolumeChanged  += RadioService_VolumeChanged;
        }
 public RadioVoiceCommandProcessor(IRegionManager regionManager, IRadioService radioService)
 {
     _RegionManager = regionManager;
     _RadioService  = radioService;
 }
Beispiel #4
0
        public RadioViewModel(IRadioService radio, IAudioPlayer player)
        {
            Guard.AgainstNull(radio);
            Guard.AgainstNull(player);

            _radio  = radio;
            _player = player;

            // ===================== setting up all commands ============================

            PlaybackCommand  = new RelayCommand(SongPlaybackAction);
            ShowAlbumCommand = new RelayCommand(ViewAlbumContainingCurrentSong);

            PreviousSongCommand = new RelayCommand(async() =>
            {
                await _radio.MoveToPrevSongAsync();
                PlayCurrentSong();
                UpdateSongPanels();
            });

            NextSongCommand = new RelayCommand(async() =>
            {
                await _radio.MoveToNextSongAsync();
                PlayCurrentSong();
                UpdateSongPanels();
            });

            ChangeSongCommand = new RelayCommand(async() =>
            {
                await _radio.ChangeSongAsync(SelectedUpcomingSong.Id);
                UpdateSongPanels();
            });

            RemoveSongCommand = new RelayCommand(async() =>
            {
                await _radio.RemoveSongAsync(SelectedUpcomingSong.Id);
                UpdateSongPanels();
            });

            StopCommand = new RelayCommand(() =>
            {
                _player.Stop();
                PlaybackSymbol = SymbolPlay;
            });

            WindowClosingCommand = new RelayCommand(() =>
            {
                _isStopped = true;  // Stop radio when the window is closing
                _player.Close();    // to avoid a memory leak
            });

            // ===========================================================================

            if (_radio.UpcomingSongs.Any())
            {
                StartRadio();
            }
            else
            {
                _radio.MakeSonglistAsync().ContinueWith(task =>
                {
                    UpdateSongPanels();
                    StartRadio();
                });
            }
        }
Beispiel #5
0
        public RadioWindowViewModel(IRadioService radio, IAudioPlayer player, IDialogService dialogService)
        {
            Guard.AgainstNull(radio);
            Guard.AgainstNull(player);
            Guard.AgainstNull(dialogService);

            _radio         = radio;
            _player        = player;
            _dialogService = dialogService;

            // ===================== setting up all commands ============================

            PlaybackCommand  = new DelegateCommand(SongPlaybackAction);
            ShowAlbumCommand = new DelegateCommand(ViewAlbum);

            PreviousSongCommand = new DelegateCommand(async() =>
            {
                await _radio.MoveToPrevSongAsync();
                UpdateSongPanels();
                await PlayCurrentSong();
            });

            NextSongCommand = new DelegateCommand(async() =>
            {
                await _radio.MoveToNextSongAsync();
                UpdateSongPanels();
                await PlayCurrentSong();
            });

            ChangeSongCommand = new DelegateCommand(async() =>
            {
                await _radio.ChangeSongAsync(SelectedUpcomingSong.Id);
                UpdateSongPanels();
            });

            RemoveSongCommand = new DelegateCommand(async() =>
            {
                await _radio.RemoveSongAsync(SelectedUpcomingSong.Id);
                UpdateSongPanels();
            });

            StopCommand = new DelegateCommand(() =>
            {
                _player.Stop();
                PlaybackSymbol = MdlConstants.SymbolPlay;
            });

            // ===========================================================================

            if (_radio.UpcomingSongs.Any())
            {
                StartRadio();
            }
            else
            {
                _radio.MakeSonglistAsync().ContinueWith(task =>
                {
                    UpdateSongPanels();
                    StartRadio();
                });
            }
        }
Beispiel #6
0
 public Module()
 {
     Service = Container.Get <IRadioService>();
 }
Beispiel #7
0
 public MusicController(IRadioService radioService)
 {
     _radioService = radioService;
 }