diff options
| author | Roy <roy.mail.net@gmail.com> | 2018-02-04 09:04:55 +0200 |
|---|---|---|
| committer | Roy <roy.mail.net@gmail.com> | 2018-02-04 09:04:55 +0200 |
| commit | ffba68ef988743f3b70f3cd85fa16eab2abc7030 (patch) | |
| tree | a60800adb4ac35bcda26461b92018790c613068b /Software/Visual_Studio | |
| parent | 9fa032b7aea6f2fbfdae05d21c3c10db174e1662 (diff) | |
| download | Tango-ffba68ef988743f3b70f3cd85fa16eab2abc7030.tar.gz Tango-ffba68ef988743f3b70f3cd85fa16eab2abc7030.zip | |
Modified video frame.
Modified developer module configuration design.
Implemented graph full-screen.
Diffstat (limited to 'Software/Visual_Studio')
7 files changed, 279 insertions, 83 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/video-frame.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/video-frame.png Binary files differindex a052b62cf..9c29dc438 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/video-frame.png +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/video-frame.png diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs index 08b8897d2..1d0a52baf 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs @@ -23,6 +23,8 @@ using Tango.Integration.Operators; using Tango.PMR.Diagnostics; using System.Reflection; using Tango.PMR.Common; +using Tango.SharedUI.Helpers; +using Tango.Transport; namespace Tango.MachineStudio.Developer.ViewModels { @@ -35,6 +37,7 @@ namespace Tango.MachineStudio.Developer.ViewModels private INotificationProvider _notification; private TimeSpan _runningJobEstimatedDuration; private Dictionary<String, GraphControllerBase> _controllers; + private int _fullScreenGraphIndex; #region Properties @@ -307,6 +310,16 @@ namespace Tango.MachineStudio.Developer.ViewModels set { _machineOperator = value; RaisePropertyChangedAuto(); } } + private IRealTimeGraph _fullScreenGraph; + /// <summary> + /// Gets or sets the full screen graph. + /// </summary> + public IRealTimeGraph FullScreenGraph + { + get { return _fullScreenGraph; } + set { _fullScreenGraph = value; RaisePropertyChangedAuto(); } + } + #endregion #region Commands @@ -391,6 +404,11 @@ namespace Tango.MachineStudio.Developer.ViewModels /// </summary> public RelayCommand<CaptureDevice> ToggleCameraCommand { get; set; } + /// <summary> + /// Gets or sets the exit full screen command. + /// </summary> + public RelayCommand ExitFullScreenCommand { get; set; } + #endregion #region Constructors @@ -439,6 +457,7 @@ namespace Tango.MachineStudio.Developer.ViewModels StartJobCommand = new RelayCommand(StartJob, () => SelectedJob != null && !IsJobRunning); StopJobCommand = new RelayCommand(StopJob, () => IsJobRunning); CloseJobCompletionStatusCommand = new RelayCommand(CloseJobCompletionStatusBar); + ExitFullScreenCommand = new RelayCommand(ExitFullScreen); CaptureDevices = new ObservableCollection<CaptureDevice>(); var availableDevices = CaptureDevice.GetAvailableCaptureDevices(); @@ -605,6 +624,24 @@ namespace Tango.MachineStudio.Developer.ViewModels #region Private Methods + private void ExitFullScreen() + { + if (FullScreenGraph != null) + { + FullScreenGraph.EnableToolBar = true; + Graphs.Insert(_fullScreenGraphIndex, FullScreenGraph); + FullScreenGraph = null; + } + } + + private void StartFullScreenGraph(IRealTimeGraph graph) + { + graph.EnableToolBar = false; + _fullScreenGraphIndex = Graphs.IndexOf(graph); + Graphs.Remove(graph); + FullScreenGraph = graph; + } + private void ToggleCamera(CaptureDevice captureDevice) { if (captureDevice.Device != null) @@ -636,6 +673,12 @@ namespace Tango.MachineStudio.Developer.ViewModels private void StartJob() { + if (MachineOperator == null || MachineOperator.State != TransportComponentState.Connected) + { + _notification.ShowError("No machine connected. Could not execute the specified job."); + return; + } + RunningJobRemainingTime = TimeSpan.Zero; RunningJobProgress = 0; IsJobFailed = false; @@ -887,7 +930,7 @@ namespace Tango.MachineStudio.Developer.ViewModels #endregion - #region Public Events + #region Public Methods /// <summary> /// Add sensor graph from available sensors to displayed graphs. @@ -932,10 +975,14 @@ namespace Tango.MachineStudio.Developer.ViewModels graphControl.InnerGraph.Minimum = sensor.Min; graphControl.InnerGraph.Maximum = sensor.Max; graphControl.InnerGraph.MaxPoints = Common.Helpers.GraphsHelper.GetMaxPoints(sensor.PointsPerFrame); - graphControl.GraphRemoveButtonPressed += (sender, __) => + graphControl.GraphRemoveButtonPressed += (sender, _) => { RemoveGraph(sender as IRealTimeGraph); }; + graphControl.GraphFullScreenButtonPressed += (sender, _) => + { + StartFullScreenGraph(sender as IRealTimeGraph); + }; Graphs.Add(graphControl); AvailableSensors.Remove(sensor); diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml index 65837bcf1..196b20157 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml @@ -8,6 +8,7 @@ xmlns:dragAndDrop="clr-namespace:Tango.DragAndDrop;assembly=Tango.DragAndDrop" xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls" xmlns:colorPicker="clr-namespace:Tango;assembly=Tango.ColorPicker" + xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" xmlns:db="clr-namespace:Tango.MachineStudio.DB.Views.DBViews;assembly=Tango.MachineStudio.DB" xmlns:commonControls="clr-namespace:Tango.MachineStudio.Common.Controls;assembly=Tango.MachineStudio.Common" xmlns:designer="clr-namespace:Tango.MachineStudio.MachineDesigner.Views;assembly=Tango.MachineStudio.MachineDesigner" @@ -22,6 +23,10 @@ mc:Ignorable="d" d:DesignHeight="1080" d:DesignWidth="1920" Background="White" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}"> + <UserControl.InputBindings> + <KeyBinding Key="Esc" Command="{Binding ExitFullScreenCommand}"></KeyBinding> + </UserControl.InputBindings> + <UserControl.Resources> <Style TargetType="{x:Type TabItem}" BasedOn="{StaticResource {x:Type TabItem}}"> <Setter Property="mahapps:ControlsHelper.HeaderFontSize" Value="14" /> @@ -29,7 +34,9 @@ </Style> <converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" /> + <converters:BooleanToVisibilityInverseConverter x:Key="BooleanToVisibilityInverseConverter" /> <converters:ColorToIntegerConverter x:Key="ColorToIntegerConverter"></converters:ColorToIntegerConverter> + <converters:BooleanInverseConverter x:Key="BooleanInverseConverter" /> <localConverters:DbRmlViewToEntityConverter x:Key="DbRmlViewToEntityConverter"></localConverters:DbRmlViewToEntityConverter> <converters:NullObjectToBooleanConverter x:Key="NullObjectToBooleanConverter"></converters:NullObjectToBooleanConverter> <converters:GreaterThanToBooleanConverter x:Key="GreaterThanToBooleanConverter"></converters:GreaterThanToBooleanConverter> @@ -488,7 +495,7 @@ <RowDefinition Height="1*"/> </Grid.RowDefinitions> - <Grid Background="{StaticResource SideBarBackground}"> + <Grid Background="{StaticResource SideBarBackground}" Visibility="{Binding IsJobRunning,Converter={StaticResource BooleanToVisibilityInverseConverter}}"> <Grid.Style> <Style TargetType="Grid"> <Setter Property="Height" Value="350"></Setter> @@ -683,7 +690,18 @@ </ListBox> <StackPanel Margin="5 0 0 10" VerticalAlignment="Bottom"> - <Button Command="{Binding SaveProcessParametersCommand}">SAVE GROUP</Button> + <Button Command="{Binding PushProcessParametersCommand}" HorizontalAlignment="Left" Style="{StaticResource MaterialDesignFlatButton}"> + <StackPanel Orientation="Horizontal"> + <materialDesign:PackIcon VerticalAlignment="Center" Kind="ArrowRightBold"></materialDesign:PackIcon> + <TextBlock Margin="10 0 0 0">PUSH PARAMETERS</TextBlock> + </StackPanel> + </Button> + <Button Margin="0 5 0 0" Command="{Binding SaveProcessParametersCommand}" HorizontalAlignment="Left" Style="{StaticResource MaterialDesignFlatButton}"> + <StackPanel Orientation="Horizontal"> + <materialDesign:PackIcon VerticalAlignment="Center" Kind="ContentSave"></materialDesign:PackIcon> + <TextBlock Margin="10 0 0 0">SAVE PARAMETERS</TextBlock> + </StackPanel> + </Button> </StackPanel> </StackPanel> </Grid> @@ -716,6 +734,8 @@ <Rectangle VerticalAlignment="Bottom" Stroke="#CECECE" StrokeThickness="1"></Rectangle> </Grid> + + <!--Main Grid--> <Grid Grid.Row="1"> <Grid> <Grid.RowDefinitions> @@ -869,10 +889,10 @@ </StackPanel> <Grid HorizontalAlignment="Right"> - <Button Height="40" Width="170" Margin="0 40 40 5" VerticalAlignment="Bottom" Foreground="DimGray" Background="#EEEEEE" BorderBrush="Transparent" Command="{Binding SaveJobsCommand}"> + <Button Height="40" Width="170" Margin="0 40 40 5" Style="{StaticResource MaterialDesignFlatButton}" VerticalAlignment="Bottom" BorderBrush="Transparent" Command="{Binding SaveJobsCommand}"> <StackPanel Orientation="Horizontal"> <materialDesign:PackIcon VerticalAlignment="Center" Width="24" Height="24" Kind="ContentSave" /> - <TextBlock VerticalAlignment="Center" Margin="10 0 0 0">SAVE</TextBlock> + <TextBlock VerticalAlignment="Center" Margin="10 0 0 0">SAVE JOB</TextBlock> </StackPanel> </Button> </Grid> @@ -1449,64 +1469,6 @@ </DockPanel> </Grid> </Grid> - - <Grid Grid.RowSpan="2"> - <Grid.Background> - <ImageBrush ImageSource="../Images/White-Background.jpg" Stretch="None" /> - </Grid.Background> - <Grid.Style> - <Style TargetType="Grid"> - <Setter Property="RenderTransform"> - <Setter.Value> - <ScaleTransform ScaleY="0" ScaleX="1"></ScaleTransform> - </Setter.Value> - </Setter> - <Style.Triggers> - <DataTrigger Binding="{Binding ShowJobStatus}" Value="True"> - <DataTrigger.EnterActions> - <BeginStoryboard> - <Storyboard> - <DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleY" To="1" Duration="00:00:0.5"></DoubleAnimation> - </Storyboard> - </BeginStoryboard> - </DataTrigger.EnterActions> - <DataTrigger.ExitActions> - <BeginStoryboard> - <Storyboard> - <DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleY" To="0" Duration="00:00:0.5"></DoubleAnimation> - </Storyboard> - </BeginStoryboard> - </DataTrigger.ExitActions> - </DataTrigger> - </Style.Triggers> - </Style> - </Grid.Style> - - <DockPanel Margin="13"> - <StackPanel Margin="80 20 0 0" Orientation="Horizontal" DockPanel.Dock="Top"> - <materialDesign:PackIcon Kind="Settings" Width="60" Height="60" /> - <TextBlock FontSize="30" FontWeight="SemiBold" VerticalAlignment="Center" Margin="10 0 0 0">Job Status</TextBlock> - </StackPanel> - - <Grid DockPanel.Dock="Bottom" Height="40"> - - </Grid> - - <Grid> - <DataGrid Background="Transparent" HorizontalAlignment="Center" Width="1000" Margin="0 10 0 10" BorderThickness="1" BorderBrush="Gainsboro"> - <DataGrid.Columns> - <DataGridTextColumn Width="Auto" Header="ICON"/> - <DataGridTextColumn Width="1*" Header="ITEM 1"/> - <DataGridTextColumn Width="1*" Header="ITEM 2"/> - <DataGridTextColumn Width="1*" Header="ITEM 3"/> - <DataGridTextColumn Width="1*" Header="ITEM 4"/> - <DataGridTextColumn Width="1*" Header="ITEM 5"/> - <DataGridTextColumn Width="1*" Header="ITEM 6"/> - </DataGrid.Columns> - </DataGrid> - </Grid> - </DockPanel> - </Grid> </Grid> <Grid Grid.Column="1" Margin="10 0 0 0" Width="340"> @@ -1562,7 +1524,7 @@ <Grid> <Border Margin="22 24 23 42"> <Grid> - <Image Source="{Binding VideoSource,Mode=OneWay,IsAsync=True}" Stretch="Fill"></Image> + <Image Source="{Binding VideoSource,Mode=OneWay,IsAsync=True}" Stretch="Fill" Visibility="{Binding IsStarted,Converter={StaticResource BooleanToVisibilityConverter}}"></Image> <Grid Background="#83000000" Cursor="Hand"> <Grid.Style> @@ -1741,11 +1703,76 @@ <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="0 0 120 0"> <ToggleButton x:Name="chkGraphs" IsChecked="False"></ToggleButton> - <TextBlock VerticalAlignment="Center" Margin="5 -1 0 0" Foreground="Gray">Show Graphs</TextBlock> + <TextBlock VerticalAlignment="Center" Margin="5 -1 0 0" Foreground="Gray">Display Graphs</TextBlock> </StackPanel> </Border> </Grid> + <!--JOB STATUS--> + <Grid Grid.RowSpan="1" Grid.ColumnSpan="2" Width="1570" HorizontalAlignment="Left"> + <Grid.Background> + <ImageBrush ImageSource="../Images/White-Background.jpg" Stretch="None" /> + </Grid.Background> + <Grid.Style> + <Style TargetType="Grid"> + <Setter Property="RenderTransform"> + <Setter.Value> + <ScaleTransform ScaleY="0" ScaleX="1"></ScaleTransform> + </Setter.Value> + </Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding ShowJobStatus}" Value="True"> + <DataTrigger.EnterActions> + <BeginStoryboard> + <Storyboard> + <DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleY" To="1" Duration="00:00:0.5"></DoubleAnimation> + </Storyboard> + </BeginStoryboard> + </DataTrigger.EnterActions> + <DataTrigger.ExitActions> + <BeginStoryboard> + <Storyboard> + <DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleY" To="0" Duration="00:00:0.5"></DoubleAnimation> + </Storyboard> + </BeginStoryboard> + </DataTrigger.ExitActions> + </DataTrigger> + </Style.Triggers> + </Style> + </Grid.Style> + + <DockPanel Margin="60 20 13 13"> + <StackPanel Margin="0 20 0 0" Orientation="Horizontal" DockPanel.Dock="Top"> + <materialDesign:PackIcon Kind="Settings" Width="60" Height="60" /> + <TextBlock FontSize="30" FontWeight="SemiBold" VerticalAlignment="Center" Margin="10 0 0 0">Job Status</TextBlock> + </StackPanel> + + <Grid DockPanel.Dock="Bottom" Height="40"> + <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="0 0 30 0"> + <Button Command="{Binding ExportToExcelCommand}" Style="{StaticResource MaterialDesignFlatButton}"> + <StackPanel Orientation="Horizontal"> + <materialDesign:PackIcon VerticalAlignment="Center" Kind="FileExcel"></materialDesign:PackIcon> + <TextBlock Margin="10 0 0 0">EXPORT TO EXCEL</TextBlock> + </StackPanel> + </Button> + </StackPanel> + </Grid> + + <Grid> + <DataGrid Background="Transparent" HorizontalAlignment="Left" Width="1450" Margin="0 20 0 10" BorderThickness="1" BorderBrush="Gainsboro"> + <DataGrid.Columns> + <DataGridTextColumn Width="Auto" Header="#"/> + <DataGridTextColumn Width="200" Header="TIME STAMP"/> + <DataGridTextColumn Width="100" Header="CODE"/> + <DataGridTextColumn Width="200" Header="NAME"/> + <DataGridTextColumn Width="1*" Header="DESCRIPTION"/> + </DataGrid.Columns> + </DataGrid> + </Grid> + </DockPanel> + </Grid> + + <!--MONITORING--> <Grid Grid.ColumnSpan="3" Background="White" Visibility="Visible"> <Grid.Style> <Style TargetType="Grid"> @@ -1780,7 +1807,7 @@ </Grid> </Grid> - <Grid Background="{StaticResource SideBarBackground}"> + <Grid Background="{StaticResource SideBarBackground}" IsEnabled="{Binding IsJobRunning,Converter={StaticResource BooleanInverseConverter}}"> <Grid.Style> <Style TargetType="Grid"> <Setter Property="Width" Value="550"></Setter> @@ -1946,6 +1973,61 @@ </Button> </Grid> </Grid> + + <Grid x:Name="gridFullScreen"> + <Grid.Style> + <Style TargetType="Grid"> + <Setter Property="Opacity" Value="0"></Setter> + <Setter Property="Visibility" Value="Hidden"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding FullScreenGraph,Converter={StaticResource NullObjectToBooleanConverter}}" Value="True"> + <Setter Property="Visibility" Value="Visible"></Setter> + <DataTrigger.EnterActions> + <BeginStoryboard> + <Storyboard> + <DoubleAnimation To="1" Duration="00:00:0.2" Storyboard.TargetProperty="Opacity"></DoubleAnimation> + </Storyboard> + </BeginStoryboard> + </DataTrigger.EnterActions> + <DataTrigger.ExitActions> + <BeginStoryboard> + <Storyboard> + <DoubleAnimation To="0" Duration="00:00:0.2" Storyboard.TargetProperty="Opacity"></DoubleAnimation> + </Storyboard> + </BeginStoryboard> + </DataTrigger.ExitActions> + </DataTrigger> + </Style.Triggers> + </Style> + </Grid.Style> + <Grid.Background> + <SolidColorBrush Color="White" Opacity="0.8"></SolidColorBrush> + </Grid.Background> + <Grid.RowDefinitions> + <RowDefinition Height="218*"/> + <RowDefinition Height="289*"/> + <RowDefinition Height="213*"/> + </Grid.RowDefinitions> + + <Grid> + <TextBlock VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="40" Text="{Binding FullScreenGraph.SensorName}"></TextBlock> + <TextBlock VerticalAlignment="Bottom" HorizontalAlignment="Center" Margin="0 0 0 30" FontSize="16" Foreground="Gray"> + <i:Interaction.Triggers> + <i:EventTrigger EventName="MouseDown"> + <i:InvokeCommandAction Command="{Binding ExitFullScreenCommand}"></i:InvokeCommandAction> + </i:EventTrigger> + </i:Interaction.Triggers> + <Run> Press </Run> + <Run TextDecorations="Underline" Cursor="Hand">'Escape'</Run> + <Run> to exit full screen mode</Run> + </TextBlock> + </Grid> + + <Grid Grid.Row="1" Margin="10 0 10 0"> + <ContentControl Content="{Binding FullScreenGraph}"></ContentControl> + </Grid> + </Grid> + <dragAndDrop:DraggingSurface x:Name="draggingSurface" /> </Grid> </UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/IRealTimeGraph.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/IRealTimeGraph.cs index 5ca930c91..bf40d459e 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/IRealTimeGraph.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/IRealTimeGraph.cs @@ -44,5 +44,10 @@ namespace Tango.MachineStudio.Common.Controls /// Gets or sets the inner graph controller. /// </summary> GraphControllerBase Controller { get; set; } + + /// <summary> + /// Gets or sets a value indicating whether to enable toolbar buttons. + /// </summary> + bool EnableToolBar { get; set; } } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphControl.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphControl.xaml.cs index 359e52823..c1728a975 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphControl.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphControl.xaml.cs @@ -24,6 +24,8 @@ namespace Tango.MachineStudio.Common.Controls /// </summary> public partial class RealTimeGraphControl : UserControl, IRealTimeGraph { + private Grid headerGrid; + #region Properties /// <summary> @@ -58,6 +60,32 @@ namespace Tango.MachineStudio.Common.Controls /// </summary> public GraphControllerBase Controller { get; set; } + + private bool _enableToolbar; + /// <summary> + /// Gets or sets a value indicating whether to enable toolbar buttons. + /// </summary> + public bool EnableToolBar + { + get { return _enableToolbar; } + set + { + _enableToolbar = value; + + if (!value) + { + if (headerGrid != null) + { + ThicknessAnimation ani = new ThicknessAnimation(); + ani.To = new Thickness(0, -35, 0, 0); + ani.Duration = TimeSpan.FromSeconds(0.2); + headerGrid.BeginAnimation(Grid.MarginProperty, ani); + } + } + } + } + + #endregion #region Events @@ -70,6 +98,7 @@ namespace Tango.MachineStudio.Common.Controls public RealTimeGraphControl() { InitializeComponent(); + EnableToolBar = true; InnerGraph = Graph; Controller = new GraphController(); } @@ -81,18 +110,21 @@ namespace Tango.MachineStudio.Common.Controls private void Graph_MouseEnter(object sender, MouseEventArgs e) { - Grid mainGrid = sender as Grid; - var headerGrid = mainGrid.Children.OfType<Grid>().ToList().First(); - ThicknessAnimation ani = new ThicknessAnimation(); - ani.To = new Thickness(0, 0, 0, 0); - ani.Duration = TimeSpan.FromSeconds(0.2); - headerGrid.BeginAnimation(Grid.MarginProperty, ani); + if (EnableToolBar) + { + Grid mainGrid = sender as Grid; + headerGrid = mainGrid.Children.OfType<Grid>().ToList().First(); + ThicknessAnimation ani = new ThicknessAnimation(); + ani.To = new Thickness(0, 0, 0, 0); + ani.Duration = TimeSpan.FromSeconds(0.2); + headerGrid.BeginAnimation(Grid.MarginProperty, ani); + } } private void Graph_MouseLeave(object sender, MouseEventArgs e) { Grid mainGrid = sender as Grid; - var headerGrid = mainGrid.Children.OfType<Grid>().ToList().First(); + headerGrid = mainGrid.Children.OfType<Grid>().ToList().First(); ThicknessAnimation ani = new ThicknessAnimation(); ani.To = new Thickness(0, -35, 0, 0); ani.Duration = TimeSpan.FromSeconds(0.2); @@ -103,5 +135,6 @@ namespace Tango.MachineStudio.Common.Controls { GraphRemoveButtonPressed?.Invoke(this, new EventArgs()); } + } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphMultiControl.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphMultiControl.xaml.cs index 5cb69b786..a18021ff5 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphMultiControl.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphMultiControl.xaml.cs @@ -24,6 +24,8 @@ namespace Tango.MachineStudio.Common.Controls /// </summary> public partial class RealTimeGraphMultiControl : UserControl , IRealTimeGraph { + private Grid headerGrid; + #region Properties /// <summary> @@ -58,6 +60,30 @@ namespace Tango.MachineStudio.Common.Controls /// </summary> public GraphControllerBase Controller { get; set; } + private bool _enableToolbar; + /// <summary> + /// Gets or sets a value indicating whether to enable toolbar buttons. + /// </summary> + public bool EnableToolBar + { + get { return _enableToolbar; } + set + { + _enableToolbar = value; + + if (!value) + { + if (headerGrid != null) + { + ThicknessAnimation ani = new ThicknessAnimation(); + ani.To = new Thickness(0, -35, 0, 0); + ani.Duration = TimeSpan.FromSeconds(0.2); + headerGrid.BeginAnimation(Grid.MarginProperty, ani); + } + } + } + } + #endregion #region Events @@ -70,6 +96,7 @@ namespace Tango.MachineStudio.Common.Controls public RealTimeGraphMultiControl() { InitializeComponent(); + EnableToolBar = true; InnerGraph = Graph; Controller = new GraphMultiController(); } @@ -81,18 +108,21 @@ namespace Tango.MachineStudio.Common.Controls private void Graph_MouseEnter(object sender, MouseEventArgs e) { - Grid mainGrid = sender as Grid; - var headerGrid = mainGrid.Children.OfType<Grid>().ToList().First(); - ThicknessAnimation ani = new ThicknessAnimation(); - ani.To = new Thickness(0, 0, 0, 0); - ani.Duration = TimeSpan.FromSeconds(0.2); - headerGrid.BeginAnimation(Grid.MarginProperty, ani); + if (EnableToolBar) + { + Grid mainGrid = sender as Grid; + headerGrid = mainGrid.Children.OfType<Grid>().ToList().First(); + ThicknessAnimation ani = new ThicknessAnimation(); + ani.To = new Thickness(0, 0, 0, 0); + ani.Duration = TimeSpan.FromSeconds(0.2); + headerGrid.BeginAnimation(Grid.MarginProperty, ani); + } } private void Graph_MouseLeave(object sender, MouseEventArgs e) { Grid mainGrid = sender as Grid; - var headerGrid = mainGrid.Children.OfType<Grid>().ToList().First(); + headerGrid = mainGrid.Children.OfType<Grid>().ToList().First(); ThicknessAnimation ani = new ThicknessAnimation(); ani.To = new Thickness(0, -35, 0, 0); ani.Duration = TimeSpan.FromSeconds(0.2); diff --git a/Software/Visual_Studio/Tango.SharedUI/Converters/NullObjectToBooleanConverter.cs b/Software/Visual_Studio/Tango.SharedUI/Converters/NullObjectToBooleanConverter.cs index 5046ee127..1f65bc87a 100644 --- a/Software/Visual_Studio/Tango.SharedUI/Converters/NullObjectToBooleanConverter.cs +++ b/Software/Visual_Studio/Tango.SharedUI/Converters/NullObjectToBooleanConverter.cs @@ -24,8 +24,7 @@ namespace Tango.SharedUI.Converters /// </returns> public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { - if (value != null) return true; - return false; + return (value != null); } /// <summary> |
