Exemplo n.º 1
0
        public PlaybackManager(
            MediaPlayer player,
            SettingsService settingsService,
            IPlayerPlaylistService playerPlaylistService,
            ILogService logService,
            IMusicCacheService musicCacheService)
        {
            _settingsService       = settingsService;
            _player                = player;
            _playerPlaylistService = playerPlaylistService;
            _logService            = logService;
            _musicCasheService     = musicCacheService;

            _database = new LibraryDatabase();

            _player.AutoPlay     = false;
            _player.MediaOpened += Player_MediaOpened;
            _player.MediaEnded  += Player_MediaEnded;
            _player.MediaFailed += Player_MediaFailed;

            _currentTrackID = settingsService.GetNoCache(PLAYER_TRACK_ID, -1);
            _isShuffleMode  = settingsService.GetNoCache(PLAYER_SHUFFLE_MODE, false);
            UpdateRepeatMode();
            UpdateScrobbleMode();
        }
Exemplo n.º 2
0
        public DownloadsService2(IMusicCacheService musicCacheService)
        {
            _musicCacheService = musicCacheService;

            _transferGroup = BackgroundTransferGroup.CreateGroup(DOWNLOAD_TRASNFER_GROUP_NAME);
            _transferGroup.TransferBehavior = BackgroundTransferBehavior.Serialized;
            _downloader = new BackgroundDownloader();
            _downloader.TransferGroup = _transferGroup;

            _downloads = new List <DownloadOperation>(INIT_DOWNLOADS_LIST_CAPACITY);
            _cts       = new Dictionary <Guid, CancellationTokenSource>(INIT_DOWNLOADS_LIST_CAPACITY);
        }
Exemplo n.º 3
0
        public CachedViewModel(
            IPlayerService playerService,
            ILocService locService,
            INavigationService navigationService,
            IAppLoaderService appLoaderService,
            IMusicCacheService musicCacheService,
            IDialogsService dialogsService)
            : base(playerService, locService, navigationService, appLoaderService)
        {
            _musicCacheService = musicCacheService;
            _dialogsService    = dialogsService;

            DeleteTrackCommand    = new DelegateCommand <CachedTrack>(OnDeleteTrackCommand);
            DeleteAllCommand      = new DelegateCommand(OnDeleteAllCommand);
            DeleteSelectedCommand = new DelegateCommand(OnDeleteSelectedCommand, HasSelectedItems);
        }
Exemplo n.º 4
0
        public DownloadsService(
            IMusicCacheService musicCacheService,
            ISettingsService settingsService,
            ILogService logService,
            ILocService locService)
        {
            _musicCacheService = musicCacheService;
            _settingsService   = settingsService;
            _logService        = logService;
            _locService        = locService;

            _transferGroup = BackgroundTransferGroup.CreateGroup(DOWNLOADS_TRANSFER_GROUP_NAME);
            _transferGroup.TransferBehavior = BackgroundTransferBehavior.Serialized;
            _musicDownloads = new Dictionary <string, VKSaverAudio>();

#if WINDOWS_UWP
            _downloads = new List <DownloadOperation>();
            _cts       = new Dictionary <Guid, CancellationTokenSource>();
#else
            _downloads = new List <DownloadOperation>(MAX_DOWNLOADS_LIST_CAPACITY);
            _cts       = new Dictionary <Guid, CancellationTokenSource>(MAX_DOWNLOADS_LIST_CAPACITY);
#endif
        }
Exemplo n.º 5
0
        public UwpPlayerService(
            ILogService logService,
            IPlayerPlaylistService playerPlaylistService,
            ITracksShuffleService tracksShuffleService,
            ISettingsService settingsService,
            IEventAggregator eventAggregator,
            IMusicCacheService musicCacheService,
            IImagesCacheService imagesCacheService)
        {
            _logService            = logService;
            _playerPlaylistService = playerPlaylistService;
            _tracksShuffleService  = tracksShuffleService;
            _settingsService       = settingsService;
            _eventAggregator       = eventAggregator;
            _imagesCacheService    = imagesCacheService;

            CurrentPlayer = new MediaPlayer();
            CurrentPlayer.CommandManager.IsEnabled = false;
            _manager = new PlaybackManager(CurrentPlayer, _settingsService, _playerPlaylistService, _logService, musicCacheService);

            _controls = CurrentPlayer.SystemMediaTransportControls;
            _controls.ButtonPressed += Controls_ButtonPressed;
        }
Exemplo n.º 6
0
 public MediaStreamSourceWorker(IPlayerTrack track, IMusicCacheService musicCacheService, StorageFile file)
     : this(track, musicCacheService)
 {
     _file = file;
 }
Exemplo n.º 7
0
 /// <summary>
 /// Инициализирует новый экземпляр класса <see cref="MediaStreamSourceWorker"/>
 /// для указанного аудио трека.
 /// </summary>
 /// <param name="track">Аудио трек.</param>
 public MediaStreamSourceWorker(IPlayerTrack track, IMusicCacheService musicCacheService)
 {
     Track = track;
     _musicCacheService = musicCacheService;
 }