aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture
diff options
context:
space:
mode:
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture')
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/DataCaptureModule.cs2
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/ViewModels/MainViewVM.cs57
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Views/MainView.xaml47
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Views/PlayingBarView.xaml12
4 files changed, 104 insertions, 14 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/DataCaptureModule.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/DataCaptureModule.cs
index ee650dc13..b138af4f3 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/DataCaptureModule.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/DataCaptureModule.cs
@@ -69,7 +69,7 @@ namespace Tango.MachineStudio.DataCapture
{
get
{
- return Permissions.RunTechnicianModule;
+ return Permissions.RunDataCaptureModule;
}
}
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
}
}
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 @@
<Grid Grid.Row="1">
- <DockPanel HorizontalAlignment="Center" VerticalAlignment="Top" Margin="60" Visibility="{Binding Recorder.IsRecording,Converter={StaticResource BooleanToVisibilityConverter}}" TextElement.FontSize="40">
+ <DockPanel HorizontalAlignment="Center" VerticalAlignment="Top" Margin="60" Visibility="{Binding Recorder.IsRecording,Converter={StaticResource BooleanToVisibilityConverter}}" TextElement.FontSize="20">
<TextBlock DockPanel.Dock="Left">
<Run FontWeight="SemiBold" FontStyle="Italic">Total Frames:</Run>
<Run FontStyle="Italic" Foreground="#545454" Text="{Binding Recorder.TotalFramesRecorded,StringFormat={}{0:N0},Mode=OneWay,TargetNullValue=0,FallbackValue=0}"></Run>
@@ -175,7 +176,7 @@
<StackPanel VerticalAlignment="Bottom" Margin="0 0 0 50">
<Grid Margin="50 0 0 0">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Center">
- <Button Command="{Binding MediaStopCommand}" Margin="0 0 0 0" Style="{StaticResource MaterialDesignFloatingActionButton}" Padding="0" Width="150" Height="150" Background="Transparent">
+ <Button Command="{Binding MediaSeekBackwardCommand}" Margin="0 0 0 0" Style="{StaticResource MaterialDesignFloatingActionButton}" Padding="0" Width="150" Height="150" Background="Transparent">
<materialDesign:PackIcon Width="100" Height="100" Kind="Rewind" Foreground="{StaticResource AccentColorBrush}" />
</Button>
<Button Command="{Binding MediaPlayPauseCommand}" Margin="20 0 0 0" Style="{StaticResource MaterialDesignFloatingActionButton}" Padding="0" Width="200" Height="200" Background="Transparent">
@@ -199,7 +200,7 @@
<Button Command="{Binding MediaStopCommand}" Margin="20 0 0 0" Style="{StaticResource MaterialDesignFloatingActionButton}" Padding="0" Width="150" Height="150" Background="Transparent">
<materialDesign:PackIcon Width="100" Height="100" Kind="Stop" Foreground="{StaticResource AccentColorBrush}" />
</Button>
- <Button Command="{Binding MediaStopCommand}" Margin="20 0 0 0" Style="{StaticResource MaterialDesignFloatingActionButton}" Padding="0" Width="150" Height="150" Background="Transparent">
+ <Button Command="{Binding MediaSeekForwardCommand}" Margin="20 0 0 0" Style="{StaticResource MaterialDesignFloatingActionButton}" Padding="0" Width="150" Height="150" Background="Transparent">
<materialDesign:PackIcon Width="100" Height="100" Kind="FastForward" Foreground="{StaticResource AccentColorBrush}" />
</Button>
<Button Command="{Binding MediaRecordingCommand}" Margin="20 0 0 0" Style="{StaticResource MaterialDesignFloatingActionButton}" Foreground="#FF7A7A" BorderBrush="#FF8585" Padding="0" Width="100" Height="100" Background="Transparent" ToolTip="Start Recording">
@@ -207,12 +208,28 @@
</Button>
</StackPanel>
<Grid>
- <TextBlock Margin="0 0 50 0" VerticalAlignment="Center" HorizontalAlignment="Right" Foreground="#FF8585" FontSize="60" FontFamily="{StaticResource digital-7}">
- <TextBlock.Style>
- <Style TargetType="TextBlock">
+ <Label Margin="0 0 50 0" VerticalAlignment="Center" HorizontalAlignment="Right" Foreground="#FF8585" FontSize="60" FontFamily="{StaticResource digital-7}">
+ <Label.Style>
+ <Style TargetType="Label">
<Setter Property="Opacity" Value="1"></Setter>
+ <Setter Property="Content">
+ <Setter.Value>
+ <TextBlock>
+ <Run Text="{Binding Player.CurrentTime,Mode=OneWay,StringFormat=hh\\:mm\\:ss,FallbackValue='00:00:00'}"/>
+ <Run>/</Run>
+ <Run Text="{Binding Player.TotalTime,Mode=OneWay,StringFormat=hh\\:mm\\:ss,FallbackValue='00:00:00'}"/>
+ </TextBlock>
+ </Setter.Value>
+ </Setter>
<Style.Triggers>
<DataTrigger Binding="{Binding Recorder.IsRecording}" Value="True">
+ <Setter Property="Content">
+ <Setter.Value>
+ <TextBlock>
+ <Run Text="{Binding Recorder.RecordingTime,Mode=OneWay,StringFormat=hh\\:mm\\:ss,FallbackValue='00:00:00'}"/>
+ </TextBlock>
+ </Setter.Value>
+ </Setter>
<DataTrigger.EnterActions>
<BeginStoryboard>
<Storyboard>
@@ -235,14 +252,20 @@
</DataTrigger>
</Style.Triggers>
</Style>
- </TextBlock.Style>
- <Run Text="{Binding Player.CurrentTime,Mode=OneWay,StringFormat=hh\\:mm\\:ss,FallbackValue='00:00:00'}"/>
- <Run>/</Run>
- <Run Text="{Binding Player.TotalTime,Mode=OneWay,StringFormat=hh\\:mm\\:ss,FallbackValue='00:00:00'}"/>
- </TextBlock>
+ </Label.Style>
+ </Label>
</Grid>
</Grid>
- <Slider Margin="10 40 50 0" Visibility="{Binding Recorder.IsRecording,Converter={StaticResource BooleanToVisibilityInverseConverter}}" Maximum="{Binding Player.TotalFrames}" Value="{Binding Player.CurrentFrame}"></Slider>
+ <Slider x:Name="slider" Margin="10 40 50 0" Visibility="{Binding Recorder.IsRecording,Converter={StaticResource BooleanToVisibilityInverseConverter}}" Maximum="{Binding Player.TotalFrames}" Value="{Binding Player.CurrentFrame,Mode=OneWay}">
+ <i:Interaction.Triggers>
+ <i:EventTrigger EventName="PreviewMouseDown">
+ <i:InvokeCommandAction Command="{Binding MediaSeekHoldCommand}"></i:InvokeCommandAction>
+ </i:EventTrigger>
+ <i:EventTrigger EventName="PreviewMouseUp">
+ <i:InvokeCommandAction Command="{Binding MediaSeekCommand}" CommandParameter="{Binding ElementName=slider,Path=Value}"></i:InvokeCommandAction>
+ </i:EventTrigger>
+ </i:Interaction.Triggers>
+ </Slider>
</StackPanel>
</Grid>
</Grid>
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 @@
</Button>
</StackPanel>
- <Slider VerticalAlignment="Center" Margin="10 0 10 0" Foreground="White" Maximum="{Binding Player.TotalFrames}" Value="{Binding Player.CurrentFrame}"></Slider>
+ <Slider x:Name="slider" VerticalAlignment="Center" Margin="10 0 10 0" Foreground="White" Maximum="{Binding Player.TotalFrames}" Value="{Binding Player.CurrentFrame,Mode=OneWay}">
+ <i:Interaction.Triggers>
+ <i:EventTrigger EventName="PreviewMouseDown">
+ <i:InvokeCommandAction Command="{Binding MediaSeekHoldCommand}"></i:InvokeCommandAction>
+ </i:EventTrigger>
+ <i:EventTrigger EventName="PreviewMouseUp">
+ <i:InvokeCommandAction Command="{Binding MediaSeekCommand}" CommandParameter="{Binding ElementName=slider,Path=Value}"></i:InvokeCommandAction>
+ </i:EventTrigger>
+ </i:Interaction.Triggers>
+ </Slider>
</DockPanel>
</Grid>
</UserControl>