From ffba68ef988743f3b70f3cd85fa16eab2abc7030 Mon Sep 17 00:00:00 2001 From: Roy Date: Sun, 4 Feb 2018 09:04:55 +0200 Subject: Modified video frame. Modified developer module configuration design. Implemented graph full-screen. --- .../Images/video-frame.png | Bin 107600 -> 97254 bytes .../ViewModels/MainViewVM.cs | 51 ++++- .../Views/MainView.xaml | 212 ++++++++++++++------- .../Controls/IRealTimeGraph.cs | 5 + .../Controls/RealTimeGraphControl.xaml.cs | 47 ++++- .../Controls/RealTimeGraphMultiControl.xaml.cs | 44 ++++- .../Converters/NullObjectToBooleanConverter.cs | 3 +- 7 files changed, 279 insertions(+), 83 deletions(-) (limited to 'Software/Visual_Studio') 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 index a052b62cf..9c29dc438 100644 Binary files a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/video-frame.png and b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/video-frame.png differ 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 _controllers; + private int _fullScreenGraphIndex; #region Properties @@ -307,6 +310,16 @@ namespace Tango.MachineStudio.Developer.ViewModels set { _machineOperator = value; RaisePropertyChangedAuto(); } } + private IRealTimeGraph _fullScreenGraph; + /// + /// Gets or sets the full screen graph. + /// + public IRealTimeGraph FullScreenGraph + { + get { return _fullScreenGraph; } + set { _fullScreenGraph = value; RaisePropertyChangedAuto(); } + } + #endregion #region Commands @@ -391,6 +404,11 @@ namespace Tango.MachineStudio.Developer.ViewModels /// public RelayCommand ToggleCameraCommand { get; set; } + /// + /// Gets or sets the exit full screen command. + /// + 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(); 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 /// /// 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}"> + + + + + + @@ -488,7 +495,7 @@ - + - - - - - - Job Status - - - - - - - - - - - - - - - - - - - - - @@ -1562,7 +1524,7 @@ - + @@ -1741,11 +1703,76 @@ - Show Graphs + Display Graphs + + + + + + + + + + + + + Job Status + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Press + 'Escape' + to exit full screen mode + + + + + + + + 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. /// GraphControllerBase Controller { get; set; } + + /// + /// Gets or sets a value indicating whether to enable toolbar buttons. + /// + 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 /// public partial class RealTimeGraphControl : UserControl, IRealTimeGraph { + private Grid headerGrid; + #region Properties /// @@ -58,6 +60,32 @@ namespace Tango.MachineStudio.Common.Controls /// public GraphControllerBase Controller { get; set; } + + private bool _enableToolbar; + /// + /// Gets or sets a value indicating whether to enable toolbar buttons. + /// + 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().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().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().ToList().First(); + headerGrid = mainGrid.Children.OfType().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 /// public partial class RealTimeGraphMultiControl : UserControl , IRealTimeGraph { + private Grid headerGrid; + #region Properties /// @@ -58,6 +60,30 @@ namespace Tango.MachineStudio.Common.Controls /// public GraphControllerBase Controller { get; set; } + private bool _enableToolbar; + /// + /// Gets or sets a value indicating whether to enable toolbar buttons. + /// + 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().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().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().ToList().First(); + headerGrid = mainGrid.Children.OfType().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 /// public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { - if (value != null) return true; - return false; + return (value != null); } /// -- cgit v1.3.1