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; }
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; }