public PlayerViewModel(
            AudioPlayerHelper helper,
            ICollectionService service,
            IAppSettingsHelper appSettingsHelper)
        {
            _helper = helper;
            _service = service;
            _appSettingsHelper = appSettingsHelper;

            if (!IsInDesignMode)
            {
                helper.TrackChanged += HelperOnTrackChanged;
                helper.PlaybackStateChanged += HelperOnPlaybackStateChanged;
                helper.Shutdown += HelperOnShutdown;

                _nextRelayCommand = new RelayCommand(NextSong);
                _prevRelayCommand = new RelayCommand(PrevSong);
                _playPauseRelayCommand = new RelayCommand(PlayPauseToggle);

                _timer = new DispatcherTimer {Interval = TimeSpan.FromSeconds(1)};
                _timer.Tick += TimerOnTick;
            }
            else
            {
                CurrentQueue = service.PlaybackQueue.FirstOrDefault();
                PlayPauseIcon = Symbol.Play;
            }
        }
        public PlayerViewModel(
            AudioPlayerHelper helper,
            ICollectionService service,
            IAppSettingsHelper appSettingsHelper)
        {
            _helper            = helper;
            _service           = service;
            _appSettingsHelper = appSettingsHelper;

            if (!IsInDesignMode)
            {
                helper.TrackChanged         += HelperOnTrackChanged;
                helper.PlaybackStateChanged += HelperOnPlaybackStateChanged;
                helper.Shutdown             += HelperOnShutdown;

                _nextRelayCommand      = new RelayCommand(NextSong);
                _prevRelayCommand      = new RelayCommand(PrevSong);
                _playPauseRelayCommand = new RelayCommand(PlayPauseToggle);

                _timer = new DispatcherTimer {
                    Interval = TimeSpan.FromSeconds(1)
                };
                _timer.Tick += TimerOnTick;
            }
            else
            {
                CurrentQueue  = service.PlaybackQueue.FirstOrDefault();
                PlayPauseIcon = Symbol.Play;
            }
        }
Beispiel #3
0
        public PlayerViewModel(AudioPlayerHelper helper, ICollectionService service)
        {
            _helper                      = helper;
            helper.TrackChanged         += HelperOnTrackChanged;
            helper.PlaybackStateChanged += HelperOnPlaybackStateChanged;
            helper.Shutdown             += HelperOnShutdown;
            _service                     = service;

            _nextRelayCommand      = new RelayCommand(NextSong);
            _prevRelayCommand      = new RelayCommand(PrevSong);
            _playPauseRelayCommand = new RelayCommand(PlayPauseToggle);

            if (!IsInDesignMode)
            {
                return;
            }

            CurrentQueue  = service.PlaybackQueue.FirstOrDefault();
            PlayPauseIcon = new SymbolIcon(Symbol.Play);
        }