From 5d883d4f6bd18ca80fe26b25ed04dc01d7544371 Mon Sep 17 00:00:00 2001 From: Roy Date: Sun, 25 Feb 2018 00:57:29 +0200 Subject: Improved data capturing seeking. Fixed possible issue in diagnostics file recorder. Some design improvement. --- .../ViewModels/MainViewVM.cs | 57 ++++++++++++++++++++++ .../Views/MainView.xaml | 47 +++++++++++++----- .../Views/PlayingBarView.xaml | 12 ++++- 3 files changed, 103 insertions(+), 13 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Modules') 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 /// public RelayCommand MediaPlayPauseCommand { get; set; } + /// + /// Gets or sets the media seek forward command. + /// + public RelayCommand MediaSeekForwardCommand { get; set; } + + /// + /// Gets or sets the media seek backward command. + /// + public RelayCommand MediaSeekBackwardCommand { get; set; } + + /// + /// Gets or sets the media seek command. + /// + public RelayCommand MediaSeekCommand { get; set; } + + /// + /// Gets or sets the media seek hold command. + /// + 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(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 } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Views/MainView.xaml index 72f7da03d..e3f9d380a 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Views/MainView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Views/MainView.xaml @@ -3,6 +3,7 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls" xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" @@ -161,7 +162,7 @@ - + Total Frames: @@ -175,7 +176,7 @@ - - - - - - - - / - - + + - + + + + + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Views/PlayingBarView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Views/PlayingBarView.xaml index 3e76ce6ef..ee423e676 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Views/PlayingBarView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Views/PlayingBarView.xaml @@ -3,6 +3,7 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls" xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" @@ -47,7 +48,16 @@ - + + + + + + + + + + -- cgit v1.3.1