Inheritance: Caliburn.Micro.PropertyChangedBase
        private void OnDataContextChanged(FrameworkElement s, DataContextChangedEventArgs e) {
            ViewModel = DataContext as VideoPlayerViewModel;

            if (ViewModel == null)
                return;

            ViewModel.PropertyChanged += ViewModelOnPropertyChanged;
            if (ViewModel.Uri != null) {
                this.MediaElement.Source = ViewModel.Uri;
            } else if (ViewModel.Source != null) {
                this.MediaElement.SetMediaStreamSource(ViewModel.Source);
            }

            this.DisabledPanel.Visibility = !ViewModel.CanPlay && !ViewModel.IsInProgress
                ? Visibility.Visible
                : Visibility.Collapsed;
        }
Beispiel #2
0
 private void OpenVideo() {
     var player = new VideoPlayerViewModel(CurrentAttachment, SettingsService.WebmPlaybackMode);
     Shell.ShowPopup(player);
 }
 public VideoPlayerView() {
     InitializeComponent();
     DataContextChanged += OnDataContextChanged;
     Unloaded += (s, e) => ViewModel = null;
 }