/// ------------------------------------------------------------------------------------ public void SetPlayerViewModel(MediaPlayerViewModel viewModel) { if (_viewModel != null) { _viewModel.MediaQueued -= HandleMediaQueued; _viewModel.PlaybackStarted -= HandleMediaPlayStarted; _viewModel.PlaybackEnded -= HandleMediaPlaybackEnded; } _viewModel = viewModel; _viewModel.VideoWindowHandle = VideoWindowHandle; _viewModel.MediaQueued += HandleMediaQueued; _viewModel.PlaybackStarted += HandleMediaPlayStarted; _viewModel.PlaybackEnded += HandleMediaPlaybackEnded; AdjustVideoSurfaceSize(); }
/// ------------------------------------------------------------------------------------ public void SetViewModel(MediaPlayerViewModel viewModel) { if (_viewModel != null) { _viewModel.MediaQueued -= HandleMediaQueued; _viewModel.PlaybackStarted -= HandleMediaPlayStarted; } _viewModel = viewModel; _viewModel.MediaQueued += HandleMediaQueued; _viewModel.PlaybackStarted += HandleMediaPlayStarted; _viewModel.PlaybackPaused = delegate { Invoke((Action)HandlePlaybackPausedResumed); }; _viewModel.PlaybackResumed = delegate { Invoke((Action)HandlePlaybackPausedResumed); }; _viewModel.PlaybackPositionChanged = delegate(float pos) { Invoke((Action <float>)(HandlePlaybackPositionChanged), pos); }; UpdateButtons(); _volumePopup.VolumeLevel = _viewModel.Volume; _videoPanel.SetPlayerViewModel(_viewModel); }
/// ------------------------------------------------------------------------------------ public MediaPlayer(MediaPlayerViewModel viewModel) : this() { SetViewModel(viewModel); }