public MainWindowViewModel(VideoPlayer videoPlayerIn)
        {
            this.exportQueueViewModel = new ExportQueueViewModel();

            OpenFileCommand               = new OpenFileCommand(this, videoPlayerIn);
            OpenExportQueueCommand        = new OpenExportQueueCommand(this, this.exportQueueViewModel);
            OpenSettingsCommand           = new OpenSettingsCommand(this);
            OpenAboutCommand              = new OpenAboutCommand(this);
            PlayOrPauseCommand            = new PlayOrPauseCommand(this, videoPlayerIn);
            SetSectionStartCommand        = new SetSectionStartCommand(this, videoPlayerIn);
            SetSectionEndCommand          = new SetSectionEndCommand(this, videoPlayerIn);
            BackwardCommand               = new BackwardCommand(this, videoPlayerIn);
            ForwardCommand                = new ForwardCommand(this, videoPlayerIn);
            StepBackwardCommand           = new SeekCommand(this, videoPlayerIn, () => - videoPlayerIn.FrameTime);
            StepForwardCommand            = new SeekCommand(this, videoPlayerIn, () => videoPlayerIn.FrameTime);
            Step1sBackwardCommand         = new SeekCommand(this, videoPlayerIn, () => - TimeSpan.FromSeconds(1));
            Step1sForwardCommand          = new SeekCommand(this, videoPlayerIn, () => TimeSpan.FromSeconds(1));
            PlayFromSelectionStartCommand = new PlayFromSelectionStartCommand(this, videoPlayerIn);
            PlaySelectionCommand          = new PlaySelectionCommand(this, videoPlayerIn);
            PlayUntilSelectionEndCommand  = new PlayUntilSelectionEndCommand(this, videoPlayerIn);
            ExportSelectionCommand        = new ExportSelectionCommand(this);
            NextVideoCommand              = new NextVideoCommand(this, videoPlayerIn);
            AddToQueueCommand             = new AddToQueueCommand(this, this.exportQueueViewModel);

            AudioVolume = ApplicationSettings.AudioVolume;
        }
Beispiel #2
0
        /// <summary>
        /// Seeks the specified time span.
        /// </summary>
        /// <param name="timeSpan">The time span.</param>
        public void Seek(TimeSpan timeSpan)
        {
            if (SeekCommand?.CanExecute(timeSpan) == true)
            {
                SeekCommand?.Execute(timeSpan);

                MediaState = MediaState.Seeking;
                OnMediaStateChanged();
            }
        }
        async Task openAndPlay(VideoAudioPair item, int?offsetSeconds = null)
        {
            try
            {
                String name = item.Video != null ? item.Video.Name : item.Audio.Name;

                EventAggregator.GetEvent <TitleChangedEvent>().Publish(name);

                await OpenAndPlayCommand.ExecuteAsync(item);

                if (offsetSeconds != null)
                {
                    SeekCommand.Execute((double)offsetSeconds.Value);
                }
            }
            catch (Exception)
            {
            }
        }
Beispiel #4
0
 private void OnSeek(SeekCommand message)
 {
     Seek(message.Offset);
 }