public PlayerController(IShellService shellService, IEnvironmentService environmentService, ISelectionService selectionService, PlayerService playerService, 
     Lazy<PlayerViewModel> playerViewModel, ExportFactory<InfoViewModel> infoViewModelFactory)
 {
     this.shellService = shellService;
     this.environmentService = environmentService;
     this.selectionService = selectionService;
     this.playerService = playerService;
     this.playerViewModel = playerViewModel;
     this.infoViewModelFactory = infoViewModelFactory;
     this.playAllCommand = new DelegateCommand(PlayAll, CanPlayAll);
     this.playSelectedCommand = new DelegateCommand(PlaySelected, CanPlaySelected);
     this.enqueueAllCommand = new DelegateCommand(EnqueueAll, CanEnqueueAll);
     this.enqueueSelectedCommand = new DelegateCommand(EnqueueSelected, CanEnqueueSelected);
     this.previousTrackCommand = new DelegateCommand(PreviousTrack, CanPreviousTrack);
     this.nextTrackCommand = new DelegateCommand(NextTrack, CanNextTrack);
     this.infoCommand = new DelegateCommand(ShowInfo);
 }
Exemplo n.º 2
0
        public PlayerView(PlayerService playerService)
        {
            this.InitializeComponent();
            this.viewModel = new Lazy<PlayerViewModel>(() => ViewHelper.GetViewModel<PlayerViewModel>(this));
            this.playerService = playerService;
            this.mediaPlayer = new MediaPlayer();
            this.duratonConverter = new Converters.DurationConverter();

            updateTimer = new DispatcherTimer();
            updateTimer.Interval = TimeSpan.FromMilliseconds(100);
            updateTimer.Tick += UpdateTimerTick;

            throttledSliderValueChangedAction = new ThrottledAction(ThrottledSliderValueChanged, ThrottledActionMode.InvokeMaxEveryDelayTime, TimeSpan.FromMilliseconds(100));

            previousCommand = new DelegateCommand(Previous, CanPrevious);
            playPauseCommand = new DelegateCommand(PlayPause, CanPlayPause);
            nextCommand = new DelegateCommand(Next, CanNext);
            playerService.PreviousCommand = previousCommand;
            playerService.PlayPauseCommand = playPauseCommand;
            playerService.NextCommand = nextCommand;
            playerService.IsPlayCommand = true;
            
            Loaded += FirstTimeLoadedHandler;
        }