diff --git a/RaceControl/RaceControl/ViewModels/VideoDialogViewModel.cs b/RaceControl/RaceControl/ViewModels/VideoDialogViewModel.cs index a563b581..63a7e0cd 100644 --- a/RaceControl/RaceControl/ViewModels/VideoDialogViewModel.cs +++ b/RaceControl/RaceControl/ViewModels/VideoDialogViewModel.cs @@ -95,8 +95,8 @@ public VideoDialogViewModel( public ICommand TogglePauseCommand => _togglePauseCommand ??= new DelegateCommand(TogglePauseExecute).ObservesCanExecute(() => MediaPlayer.IsStarted); public ICommand TogglePauseAllCommand => _togglePauseAllCommand ??= new DelegateCommand(TogglePauseAllExecute); public ICommand ToggleMuteCommand => _toggleMuteCommand ??= new DelegateCommand(ToggleMuteExecute).ObservesCanExecute(() => MediaPlayer.IsStarted); - public ICommand FastForwardCommand => _fastForwardCommand ??= new DelegateCommand(FastForwardExecute).ObservesCanExecute(() => MediaPlayer.IsStarted); - public ICommand SyncSessionCommand => _syncSessionCommand ??= new DelegateCommand(SyncSessionExecute).ObservesCanExecute(() => MediaPlayer.IsStarted); + public ICommand FastForwardCommand => _fastForwardCommand ??= new DelegateCommand(FastForwardExecute, CanFastForwardExecute).ObservesProperty(() => MediaPlayer.IsStarted).ObservesProperty(() => PlayableContent); + public ICommand SyncSessionCommand => _syncSessionCommand ??= new DelegateCommand(SyncSessionExecute, CanSyncSessionExecute).ObservesProperty(() => MediaPlayer.IsStarted).ObservesProperty(() => PlayableContent); public ICommand ShowMainWindowCommand => _showMainWindowCommand ??= new DelegateCommand(ShowMainWindowExecute); public ICommand ToggleRecordingCommand => _toggleRecordingCommand ??= new DelegateCommand(ToggleRecordingExecute).ObservesCanExecute(() => MediaPlayer.IsStarted); public ICommand ToggleFullScreenCommand => _toggleFullScreenCommand ??= new DelegateCommand(ToggleFullScreenExecute); @@ -293,6 +293,11 @@ private void ToggleMuteExecute(bool? mute) MediaPlayer.ToggleMute(mute); } + private bool CanFastForwardExecute(int? seconds) + { + return MediaPlayer.IsStarted && !PlayableContent.IsLive; + } + private void FastForwardExecute(int? seconds) { if (seconds.HasValue) @@ -301,6 +306,11 @@ private void FastForwardExecute(int? seconds) } } + private bool CanSyncSessionExecute() + { + return MediaPlayer.IsStarted && !PlayableContent.IsLive; + } + private void SyncSessionExecute() { var payload = new SyncStreamsEventPayload(PlayableContent.SyncUID, MediaPlayer.GetCurrentTime());