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 | |
| 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')
4 files changed, 165 insertions, 22 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 } } 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> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml index 19c0c47df..f2c9ddba5 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml @@ -47,7 +47,25 @@ <StackPanel Margin="5 0 0 0" Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Center"> <Image Source="/Images/account.png" RenderOptions.BitmapScalingMode="Fant" VerticalAlignment="Center" Width="50" Height="50"></Image> + <StackPanel Margin="0 5 0 0"> <TextBlock FontSize="16" TextTrimming="CharacterEllipsis" MaxWidth="170" FontStyle="Italic" FontWeight="Bold" Margin="10 0 0 0" VerticalAlignment="Center" Text="{Binding AuthenticationProvider.CurrentUser.Contact.FullName}"></TextBlock> + <TextBlock FontSize="12" TextTrimming="CharacterEllipsis" MaxWidth="170" FontStyle="Italic" Margin="10 5 0 0" VerticalAlignment="Center"> + <Run Text="{Binding AuthenticationProvider.CurrentUser.Organization.Name}"></Run> + , + <Run Text="{Binding AuthenticationProvider.CurrentUser.Roles[0]}"> + <Run.ToolTip> + <ItemsControl ItemsSource="{Binding AuthenticationProvider.CurrentUser.Roles}"> + <ItemsControl.ItemTemplate> + <DataTemplate> + <TextBlock Text="{Binding Name}"></TextBlock> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ItemsControl> + </Run.ToolTip> + </Run> + <Run>...</Run> + </TextBlock> + </StackPanel> </StackPanel> </Grid> <StackPanel Margin="0 16 0 0"> @@ -122,14 +140,39 @@ x:Name="MenuToggleButton"/> <materialDesign:PopupBox DockPanel.Dock="Right" PlacementMode="BottomAndAlignRightEdges" StaysOpen="False"> <StackPanel> - <Button Content="Machine Connection" Command="{Binding ConnectCommand}" /> - <Button Content="Disconnect Machine" Command="{Binding DisconnectCommand}" /> + <Button Command="{Binding ConnectCommand}"> + <StackPanel Orientation="Horizontal"> + <materialDesign:PackIcon Kind="LanConnect" Width="24" Height="24" /> + <TextBlock Margin="5 0 0 0" VerticalAlignment="Center">Machine Connection</TextBlock> + </StackPanel> + </Button> + <Button Command="{Binding DisconnectCommand}"> + <StackPanel Orientation="Horizontal"> + <materialDesign:PackIcon Kind="LanDisconnect" Width="24" Height="24" /> + <TextBlock Margin="5 0 0 0" VerticalAlignment="Center">Disconnect Machine</TextBlock> + </StackPanel> + </Button> <Separator/> - <Button Content="Open Module In New Window" IsEnabled="{Binding IsModuleLoaded}" Command="{Binding OpenModuleInWindowCommand}" CommandParameter="{Binding CurrentModule}" /> + <Button IsEnabled="{Binding IsModuleLoaded}" Command="{Binding OpenModuleInWindowCommand}" CommandParameter="{Binding CurrentModule}"> + <StackPanel Orientation="Horizontal"> + <materialDesign:PackIcon Kind="ArrowTopRight" Width="24" Height="24" /> + <TextBlock Margin="5 0 0 0" VerticalAlignment="Center">Open Module In New Window</TextBlock> + </StackPanel> + </Button> <Separator/> - <Button Content="Update Center" Command="{Binding UpdateCenterCommand}" /> + <Button Command="{Binding UpdateCenterCommand}"> + <StackPanel Orientation="Horizontal"> + <materialDesign:PackIcon Kind="Download" Width="24" Height="24" /> + <TextBlock Margin="5 0 0 0" VerticalAlignment="Center">Update Center</TextBlock> + </StackPanel> + </Button> <Separator/> - <Button Content="Exit" Command="{Binding ExitCommand}" /> + <Button Command="{Binding ExitCommand}"> + <StackPanel Orientation="Horizontal"> + <materialDesign:PackIcon Kind="CloseCircleOutline" Width="24" Height="24" /> + <TextBlock Margin="5 0 0 0" VerticalAlignment="Center">Exit</TextBlock> + </StackPanel> + </Button> </StackPanel> </materialDesign:PopupBox> <Grid> @@ -233,8 +276,8 @@ </Grid.RowDefinitions> <Grid> <StackPanel Margin="30 20" HorizontalAlignment="Left"> - <TextBlock Style="{StaticResource MaterialDesignDisplay1TextBlock}">Welcome to Machine Studio</TextBlock> - <TextBlock HorizontalAlignment="Right" Margin="0 5 -130 0" FontStyle="Italic" Style="{StaticResource MaterialDesignSubheadingTextBlock}" Foreground="{StaticResource AccentColorBrush}">Select Your Studio Module...</TextBlock> + <TextBlock FontSize="35">Welcome to Machine Studio</TextBlock> + <TextBlock HorizontalAlignment="Left" Margin="350 5 0 0" FontStyle="Italic" FontSize="16">The below modules are displayed according to your user roles and permissions.</TextBlock> </StackPanel> </Grid> @@ -267,8 +310,18 @@ <StackPanel Grid.Row="2" Margin="8" HorizontalAlignment="Right" Orientation="Horizontal"> <materialDesign:PopupBox Padding="2,0,2,0" Style="{StaticResource MaterialDesignToolPopupBox}"> <StackPanel> - <Button Content="Open in new window" Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.OpenModuleInWindowCommand}" CommandParameter="{Binding}" /> - <Button Content="Settings" /> + <Button Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.OpenModuleInWindowCommand}" CommandParameter="{Binding}"> + <StackPanel Orientation="Horizontal"> + <materialDesign:PackIcon Kind="ArrowTopRight" Width="24" Height="24" /> + <TextBlock Margin="5 0 0 0" VerticalAlignment="Center">Start in new window</TextBlock> + </StackPanel> + </Button> + <Button> + <StackPanel Orientation="Horizontal"> + <materialDesign:PackIcon Kind="Settings" Width="24" Height="24" /> + <TextBlock Margin="5 0 0 0" VerticalAlignment="Center">Settings</TextBlock> + </StackPanel> + </Button> </StackPanel> </materialDesign:PopupBox> </StackPanel> |
