Esempio n. 1
0
        /// ------------------------------------------------------------------------------------
        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();
        }
Esempio n. 2
0
        /// ------------------------------------------------------------------------------------
        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);
        }
Esempio n. 3
0
 /// ------------------------------------------------------------------------------------
 public MediaPlayer(MediaPlayerViewModel viewModel) : this()
 {
     SetViewModel(viewModel);
 }