public SpaceRecordingViewModel(Space space, Project project)
        {
            InitCommands();

            _setDurationBasedOnWpm = false;
            _description = null;
            Space = space;
            Project = project;
            ResetElapsedTime();
            SetTimeLeft();
            RecordDuration = Space.Duration;
            MaxWordsPerMinute = DefaultMaxWordsPerMinute;
            MinWordsPerMinute = DefaultMinWordsPerMinute;

            _recorder = new DescriptionRecorder();
            _recorder.DescriptionRecorded += (sender, args) => Description = args.Value;

            _player = new DescriptionPlayer();
            _player.DescriptionFinishedPlaying += (sender, args) => CommandManager.InvalidateRequerySuggested();

            _recordingTimer = new DispatcherTimer { Interval = TimeSpan.FromMilliseconds(CountdownTimerIntervalMsec) };
            _recordingTimer.Tick += RecordingTimerOnTick;

            _stopwatch = new Stopwatch();

            CountdownViewModel = new CountdownViewModel();
            CountdownViewModel.CountdownFinished += (sender, args) => StartRecording();

            SetWpmValuesBasedOnSpaceText();
        }
        public AudioCanvasViewModel(ILiveDescribePlayer mediaPlayer, ProjectManager projectManager,
            UndoRedoManager undoRedoManager)
        {
            _projectManager = projectManager;
            _undoRedoManager = undoRedoManager;
            _player = mediaPlayer;

            //TODO: Just refer to MediaPlayer?
            mediaPlayer.PropertyChanged += (sender, args) =>
            {
                if (args.PropertyName.Equals("CurrentState"))
                    CurrentVideoState = mediaPlayer.CurrentState;
            };

            _projectManager.ProjectLoaded += (sender, args) => Waveform = args.Value.Waveform;

            GetNewSpaceTime = new RelayCommand(
                canExecute: () => CurrentVideoState != LiveDescribeVideoStates.VideoNotLoaded,
                execute: () =>
                {
                    var s = new Space();
                    OnRequestSpaceTime(s);
                    projectManager.AddSpaceAndTrackForUndo(s);
                });
        }
Exemplo n.º 3
0
        /// <summary>
        /// Creates a SpaceRecordingWindow and attaches an instance of SpaceRecordingViewModel to it.
        /// </summary>
        /// <param name="selectedSpace">Space to record in.</param>
        /// <param name="project">The current LiveDescribe Project.</param>
        /// <returns>The ViewModel of the Window.</returns>
        public static SpaceRecordingViewModel SpawnSpaceRecordingView(Space selectedSpace, Project project)
        {
            var viewModel = new SpaceRecordingViewModel(selectedSpace, project);
            var view = new SpaceRecordingWindow(viewModel);
            viewModel.DialogResult = view.ShowDialog();

            return viewModel;
        }
        public AudioCanvasViewModel(ILiveDescribePlayer mediaPlayer, ProjectManager projectManager)
        {
            _projectManager = projectManager;

            AudioCanvasMouseDownCommand = new RelayCommand<MouseEventArgs>(AudioCanvasMouseDown, param => true);
            AudioCanvasMouseRightButtonDownCommand = new RelayCommand<MouseEventArgs>(AudioCanvasMouseRightButtonDown, param => true);
            mediaPlayer.PropertyChanged += (sender, args) =>
            {
                if (args.PropertyName.Equals("CurrentState"))
                    CurrentVideoState = mediaPlayer.CurrentState;
            };

            GetNewSpaceTime = new RelayCommand(
            canExecute: () => CurrentVideoState != LiveDescribeVideoStates.VideoNotLoaded,
            execute: () =>
            {
                var s = new Space();
                OnRequestSpaceTime(s);
                projectManager.AddSpaceAndTrackForUndo(s);
            });
        }
 private void OnRequestSpaceTime(Space s)
 {
     var handler = RequestSpaceTime;
     if (handler != null) handler(this, s);
 }
Exemplo n.º 6
0
 private void RemoveSpaceEventHandlers(Space space)
 {
     space.DeleteRequested -= SpaceDeleted;
 }
Exemplo n.º 7
0
 private void AddSpaceEventHandlers(Space s)
 {
     s.DeleteRequested += SpaceDeleted;
 }
Exemplo n.º 8
0
 public void AddSpaceAndTrackForUndo(Space space)
 {
     Spaces.Add(space);
     _undoRedoManager.InsertSpaceForInsertUndoRedo(Spaces, space);
 }
 private void Unselect(ref Space space)
 {
     space.IsSelected = false;
     space = null;
 }
 private void Select(ref Space space)
 {
     space.IsSelected = true;
     TabSelectedIndex = SpaceTab;
     _selectedSpace = space;
     SelectedItem = space;
 }
Exemplo n.º 11
0
        private void SelectSpace(Space space, Point clickPoint)
        {
            space.IsSelected = true;
            space.MouseDownCommand.Execute();

            if (IsBetweenBounds(space.X - SelectionPixelWidth, clickPoint.X, space.X + SelectionPixelWidth))
            {
                MouseSelection = new CanvasMouseSelection(IntervalMouseAction.ChangeStartTime, space,
                    XPosToMilliseconds(clickPoint.X) - space.StartInVideo);
            }
            else if (IsBetweenBounds(space.X + space.Width - SelectionPixelWidth, clickPoint.X,
                space.X + space.Width + SelectionPixelWidth))
            {
                MouseSelection = new CanvasMouseSelection(IntervalMouseAction.ChangeEndTime, space,
                    XPosToMilliseconds(clickPoint.X) - space.EndInVideo);
            }
            else
            {
                MouseSelection = new CanvasMouseSelection(IntervalMouseAction.Dragging, space,
                    XPosToMilliseconds(clickPoint.X) - space.StartInVideo);
            }

            CaptureMouse();
        }
Exemplo n.º 12
0
        private void AddSpaceEventHandlers(Space space)
        {
            //Adding a space depends on where you right clicked so we create and add it in the view
            //Set space only if the video is loaded/playing/recording/etc
            if (_videoMedia.CurrentState != LiveDescribeVideoStates.VideoNotLoaded)
                DrawDescribableInterval(space);

            space.MouseDown += (sender1, e1) =>
            {
                if (Mouse.LeftButton == MouseButtonState.Pressed)
                {
                    _descriptionInfoTabViewModel.SelectedSpace = space;
                    SpaceAndDescriptionsTabControl.SpacesListView.ScrollToCenterOfView(space);
                }
            };

            space.PropertyChanged += (o, args) =>
            {
                if (args.PropertyName.Equals("StartInVideo") || args.PropertyName.Equals("EndInVideo") || args.PropertyName.Equals("SetStartAndEndInVideo"))
                    DrawDescribableInterval(space);
            };

            space.NavigateToRequested += (o, args) =>
            {
                UpdateMarkerPosition((space.StartInVideo / _videoDuration) * (_audioCanvas.Width) - MarkerOffset);
                UpdateVideoPosition((int)space.StartInVideo);
                //Scroll 1 second before the start in video of the space
                TimeLineScrollViewer.ScrollToHorizontalOffset((_audioCanvas.Width / _videoDuration) *
                                                              (space.StartInVideo - 1000));

                _descriptionInfoTabViewModel.SelectedSpace = space;
                SpaceAndDescriptionsTabControl.SpacesListView.ScrollToCenterOfView(space);
            };
        }
 private void SetSpaceLocation(Space space)
 {
     SetIntervalLocation(space, AudioCanvas);
 }
        public void AddSpaceEventHandlers(Space space)
        {
            //Adding a space depends on where you right clicked so we create and add it in the view
            //Set space only if the video is loaded/playing/recording/etc
            if (_viewmodel.MediaViewModel.MediaVideo.CurrentState != LiveDescribeVideoStates.VideoNotLoaded)
                SetSpaceLocation(space);

            space.NavigateToRequested += (o, args) =>
            {
                UpdateMarkerPosition((space.StartInVideo / _videoDurationMsec) * (AudioCanvas.Width) - MarkerOffset);
                UpdateVideoPosition((int)space.StartInVideo);
                //Scroll 1 second before the start in video of the space
                TimeLineScrollViewer.ScrollToHorizontalOffset(
                    (AudioCanvas.Width / _videoDurationMsec) * (space.StartInVideo - 1000));
            };

            space.PropertyChanged += (sender, args) =>
            {
                if (args.PropertyName == "IsSelected" || args.PropertyName == "IsRecordedOver")
                    Dispatcher.Invoke(() => AudioCanvas.DrawSpaces());
            };

            space.PropertyChanged += (o, e) =>
            {
                if (e.PropertyName == "StartInVideo"
                    || e.PropertyName == "EndInVideo"
                    || e.PropertyName == "SetStartAndEndInVideo")
                    SetSpaceLocation(space);
            };
        }
 public DeleteSpaceHistoryItem(ObservableCollection<Space> collection, Space element)
 {
     _collection = collection;
     _elementRemoved = element;
 }
        private void AddSpaceEventHandlers(Space space)
        {
            space.MouseDown += (sender1, e1) =>
            {
                if (Mouse.LeftButton == MouseButtonState.Pressed)
                {
                    _intervalInfoListViewModel.SelectedSpace = space;
                    SpaceAndDescriptionsTabControl.SpacesListView.ScrollToCenterOfView(space);
                }
            };

            space.NavigateToRequested += (o, args) =>
            {
                _intervalInfoListViewModel.SelectedSpace = space;
                SpaceAndDescriptionsTabControl.SpacesListView.ScrollToCenterOfView(space);
            };

            TimelineControl.AddSpaceEventHandlers(space);
        }
 public void InsertSpaceForInsertUndoRedo(ObservableCollection<Space> collection, Space element)
 {
     var cmd = new InsertSpaceHistoryItem(collection, element);
     Push(_undoStack, cmd); _redoStack.Clear();
 }