diff options
| author | Roy <roy.mail.net@gmail.com> | 2018-02-25 00:57:29 +0200 |
|---|---|---|
| committer | Roy <roy.mail.net@gmail.com> | 2018-02-25 00:57:29 +0200 |
| commit | 5d883d4f6bd18ca80fe26b25ed04dc01d7544371 (patch) | |
| tree | 21bfee38c9126f385e704bc1b09d6e8dcc8a54f4 /Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/ViewModels | |
| parent | 4eb317b46d31050a7a3e8e3d5436f2c77edc50dc (diff) | |
| download | Tango-5d883d4f6bd18ca80fe26b25ed04dc01d7544371.tar.gz Tango-5d883d4f6bd18ca80fe26b25ed04dc01d7544371.zip | |
Improved data capturing seeking.
Fixed possible issue in diagnostics file recorder.
Some design improvement.
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/ViewModels')
| -rw-r--r-- | Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/ViewModels/MainViewVM.cs | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/ViewModels/MainViewVM.cs index 269007dac..840863752 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/ViewModels/MainViewVM.cs @@ -122,6 +122,26 @@ namespace Tango.MachineStudio.DataCapture.ViewModels /// </summary> public RelayCommand MediaPlayPauseCommand { get; set; } + /// <summary> + /// Gets or sets the media seek forward command. + /// </summary> + public RelayCommand MediaSeekForwardCommand { get; set; } + + /// <summary> + /// Gets or sets the media seek backward command. + /// </summary> + public RelayCommand MediaSeekBackwardCommand { get; set; } + + /// <summary> + /// Gets or sets the media seek command. + /// </summary> + public RelayCommand<double> MediaSeekCommand { get; set; } + + /// <summary> + /// Gets or sets the media seek hold command. + /// </summary> + public RelayCommand MediaSeekHoldCommand { get; set; } + #endregion #region Constructors @@ -148,6 +168,10 @@ namespace Tango.MachineStudio.DataCapture.ViewModels MediaRecordingCommand = new RelayCommand(StartDiagnosticsRecording, () => !Recorder.IsRecording && MachineOperator != null && !Player.IsPlaying); MediaStopCommand = new RelayCommand(StopRecorderOrPlayer, () => Recorder.IsRecording || Player.IsPlaying); MediaPlayPauseCommand = new RelayCommand(DiagnosticsTogglePlayPause, () => !Recorder.IsRecording && SelectedRecording != null); + MediaSeekForwardCommand = new RelayCommand(MediaSeekForward, () => !Recorder.IsRecording && Player.IsPlaying); + MediaSeekBackwardCommand = new RelayCommand(MediaSeekBackward, () => !Recorder.IsRecording && Player.IsPlaying); + MediaSeekCommand = new RelayCommand<double>(MediaSeek, (x) => Player.IsPlaying); + MediaSeekHoldCommand = new RelayCommand(MediaSeekHold,() => Player.IsPlaying); _recordingsFolder = Path.Combine(SettingsManager.DefaultFolder, "Recordings"); Directory.CreateDirectory(_recordingsFolder); @@ -321,6 +345,39 @@ namespace Tango.MachineStudio.DataCapture.ViewModels InvalidateRelayCommands(); } + private void MediaSeekBackward() + { + if (Player.IsPlaying) + { + Player.Seek(Player.CurrentFrame - 200); + } + } + + private void MediaSeekForward() + { + if (Player.IsPlaying) + { + Player.Seek(Player.CurrentFrame + 200); + } + } + + private void MediaSeek(double frame) + { + if (Player != null) + { + Player.Seek((int)frame); + Player.Play(); + } + } + + private void MediaSeekHold() + { + if (Player != null) + { + Player.Pause(); + } + } + #endregion } } |
