From a20fd4bd769aeccd1fd1f20273f895c92a5b5bb8 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Sun, 14 Jan 2018 15:24:49 +0200 Subject: Added code comments for: MachineStudio.Common. --- .../StudioApplication/IShutdownRequestBlocker.cs | 8 ++++++++ .../StudioApplication/IStudioApplicationManager.cs | 22 ++++++++++++++++++++++ 2 files changed, 30 insertions(+) (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioApplication') diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioApplication/IShutdownRequestBlocker.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioApplication/IShutdownRequestBlocker.cs index a157bd598..4d5f968a4 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioApplication/IShutdownRequestBlocker.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioApplication/IShutdownRequestBlocker.cs @@ -6,8 +6,16 @@ using System.Threading.Tasks; namespace Tango.MachineStudio.Common.StudioApplication { + /// + /// Represents a component capable of receiving notification for when the Machine Studio shuts down. + /// The component can perform it's own shutdown operations, or cancel the current shutdown operation. + /// public interface IShutdownRequestBlocker { + /// + /// Called when the application is shutting down. + /// + /// Task OnShutdownRequest(); } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioApplication/IStudioApplicationManager.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioApplication/IStudioApplicationManager.cs index 42f4f7b65..dfdac67c7 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioApplication/IStudioApplicationManager.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioApplication/IStudioApplicationManager.cs @@ -7,12 +7,34 @@ using Tango.Integration.Services; namespace Tango.MachineStudio.Common.StudioApplication { + /// + /// Represents the Machine Studio application manager. + /// public interface IStudioApplicationManager { + /// + /// Gets a value indicating whether Machine Studio is shutting down. + /// bool IsShuttingDown { get;} + + /// + /// Shutdown the application. + /// void ShutDown(); + + /// + /// Gets or sets the currently connected machine if any. + /// IExternalBridgeClient ConnectedMachine { get; set; } + + /// + /// Gets a value indicating whether the is valid. + /// bool IsMachineConnected { get; } + + /// + /// Gets a value indicating whether the is valid and connected through TCP/IP. + /// bool IsMachineConnectedViaTCP { get; } } } -- cgit v1.3.1 From 0fda2ba3ff49bdc1ffc6833f658e2164af187008 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Tue, 16 Jan 2018 12:17:10 +0200 Subject: Embedded RealTimeGraphEx library to solution. Added graphs to technician view. Implemented simple sensors data test using Machine Emulator. --- Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 8388608 -> 8388608 bytes Software/PMR/Messages/Common/MessageType.proto | 4 + .../Messages/Diagnostics/PushSensorsRequest.proto | 9 + .../Messages/Diagnostics/PushSensorsResponse.proto | 9 + .../Modules/Tango.MachineStudio.DB/DBModule.cs | 9 +- .../DeveloperModule.cs | 6 + .../MachineDesignerModule.cs | 7 + .../Tango.MachineStudio.Stubs/StubsModule.cs | 7 + .../SynchronizationModule.cs | 9 +- .../ViewModels/MainViewVM.cs | 2 +- .../Converters/SecondsToGraphPointsConverter.cs | 23 + .../Converters/TransitionLinkConverter.cs | 55 + .../Helpers/GraphsMaxPointsHelper.cs | 26 + .../Navigation/TechNavigationManager.cs | 17 + .../Navigation/TechNavigationView.cs | 15 + .../Resources/GraphEx.xaml | 126 + .../Tango.MachineStudio.Technician.csproj | 35 + .../TechnicianModule.cs | 14 + .../ViewModelLocator.cs | 15 + .../ViewModels/MainViewVM.cs | 27 + .../ViewModels/SensorsViewVM.cs | 139 + .../Views/MainView.xaml | 90 +- .../Views/MainView.xaml.cs | 3 + .../Views/MotorsView.xaml | 12 + .../Views/MotorsView.xaml.cs | 28 + .../Views/OverviewView.xaml | 12 + .../Views/OverviewView.xaml.cs | 28 + .../Views/SensorsView.xaml | 141 + .../Views/SensorsView.xaml.cs | 53 + .../Tango.MachineStudio.Common/IStudioModule.cs | 5 + .../StudioApplication/IStudioApplicationManager.cs | 5 + .../MachineStudio/Tango.MachineStudio.UI/App.xaml | 5 +- .../Modules/DefaultStudioModuleLoader.cs | 3 + .../Navigation/DefaultNavigationManager.cs | 1 + .../DefaultStudioApplicationManager.cs | 7 + .../SupervisingController/IMainView.cs | 7 +- .../Tango.MachineStudio.UI.csproj | 4 + .../Tango.MachineStudio.UI/ViewModelLocator.cs | 2 +- .../ViewModels/MainViewVM.cs | 11 +- .../Tango.MachineStudio.UI/Views/MainView.xaml | 145 +- .../Tango.MachineStudio.UI/Views/MainView.xaml.cs | 29 + .../RealTimeGraphEx/Components/ComponentBase.cs | 101 + .../Components/ComponentLocationEnum.cs | 17 + .../RealTimeGraphEx/Components/GridLines.cs | 121 + .../Components/MouseValueToolTip.cs | 73 + .../RealTimeGraphEx/Components/YAxisLegends.cs | 61 + .../RealTimeGraphEx/Components/YAxisScroll.cs | 205 + .../RealTimeGraphEx/Components/YAxisTicks.cs | 192 + .../RealTimeGraphEx/Components/YAxisWave.cs | 107 + .../ComponentsItems/YAxisBigTick.cs | 14 + .../RealTimeGraphEx/ComponentsItems/YAxisLabel.cs | 14 + .../RealTimeGraphEx/ComponentsItems/YAxisLegend.cs | 15 + .../ComponentsItems/YAxisSmallTick.cs | 14 + .../RealTimeGraphEx/Controllers/GraphController.cs | 96 + .../Controllers/GraphControllerBase.cs | 62 + .../Controllers/GraphMultiController.cs | 200 + .../RealTimeGraphEx/DX2D/DX10ImageSource.cs | 147 + .../DX2D/DXGraphSurfaceMultiErase.cs | 100 + .../DX2D/DXGraphSurfaceMultiScroll.cs | 85 + .../DX2D/DXGraphSurfaceSingleErase.cs | 91 + .../DX2D/DXGraphSurfaceSingleScroll.cs | 76 + .../RealTimeGraphEx/DX2D/Direct2DControl.cs | 261 + .../SideChains/RealTimeGraphEx/DX2D/Disposer.cs | 35 + .../RealTimeGraphEx/DX2D/NativeMethods.cs | 18 + .../RealTimeGraphEx/DataSeries/DataYSeries.cs | 176 + .../RealTimeGraphExDirectXLineErase.cs | 186 + .../RealTimeGraphExDirectXLineScroll.cs | 276 + .../RealTimeGraphExDirectXMultiLineErase.cs | 225 + .../RealTimeGraphExDirectXMultiLineScroll.cs | 266 + .../RealTimeGraphEx/Enums/OpacityTypeEnum.cs | 15 + .../RealTimeGraphEx/Enums/ZoomDirectionEnum.cs | 15 + .../RealTimeGraphEx/Enums/ZoomModeEnum.cs | 16 + .../ExtensionMethods/BrushExtensions.cs | 72 + .../ExtensionMethods/ColorExtensions.cs | 18 + .../ExtensionMethods/RenderTargetExtensions.cs | 83 + .../FastGraphs/RealTimeGraphExEllipseScroll.cs | 122 + .../FastGraphs/RealTimeGraphExLineErase.cs | 257 + .../FastGraphs/RealTimeGraphExLineScroll.cs | 251 + .../FastGraphs/RealTimeGraphExMultiLineErase.cs | 233 + .../FastGraphs/RealTimeGraphExMultiLineScroll.cs | 267 + .../FastGraphs/RealTimeGraphExShapeErase.cs | 287 + .../FastGraphs/RealTimeGraphExShapeScroll.cs | 276 + .../FastGraphs/RealTimeGraphExWaveErase.cs | 79 + .../FastGraphs/RealTimeGraphExWaveScroll.cs | 66 + .../RealTimeGraphEx/FastGraphs/ShapeTypeEnum.cs | 15 + .../SideChains/RealTimeGraphEx/FodyWeavers.xml | 4 + .../RealTimeGraphEx/Models/ConcurrentPointsList.cs | 429 + .../SideChains/RealTimeGraphEx/Models/RangeData.cs | 33 + .../Models/RealTimeGraphColumnsCollection.cs | 68 + .../Models/RealTimeGraphExColumn.cs | 24 + .../RealTimeGraphEx/Models/RealTimeGraphExPoint.cs | 15 + .../Models/RealTimeGraphExPolygon.cs | 383 + .../Models/RealTimeGraphExReachPolygon.cs | 244 + .../RealTimeGraphEx/Properties/AssemblyInfo.cs | 55 + .../Properties/Resources.Designer.cs | 62 + .../RealTimeGraphEx/Properties/Resources.resx | 117 + .../Properties/Settings.Designer.cs | 30 + .../RealTimeGraphEx/Properties/Settings.settings | 7 + .../ReachGraphs/RealTimeGraphExReachCircle.cs | 295 + .../ReachGraphs/RealTimeGraphExReachLineErase.cs | 210 + .../ReachGraphs/RealTimeGraphExReachLineScroll.cs | 270 + .../RealTimeGraphExReachMultiLineErase.cs | 196 + .../RealTimeGraphExReachMultiLineScroll.cs | 229 + .../ReachGraphs/RealTimeGraphExReachVUMeter.cs | 289 + .../ReachGraphs/RealTimeGraphExReachWaveScroll.cs | 44 + .../RealTimeGraphEx/RealTimeGraphEx.csproj | 225 + .../RealTimeGraphEx/RealTimeGraphExBase.cs | 1346 + .../RealTimeGraphEx/RealTimeGraphExMultiBase.cs | 74 + .../Referenced Assemblies/SharpDX.DXGI.dll | Bin 0 -> 90624 bytes .../Referenced Assemblies/SharpDX.DXGI.xml | 4365 ++ .../Referenced Assemblies/SharpDX.Direct2D1.dll | Bin 0 -> 230912 bytes .../Referenced Assemblies/SharpDX.Direct2D1.xml | 24418 ++++++++++ .../Referenced Assemblies/SharpDX.Direct3D10.dll | Bin 0 -> 179200 bytes .../Referenced Assemblies/SharpDX.Direct3D10.xml | 23120 +++++++++ .../Referenced Assemblies/SharpDX.Direct3D9.dll | Bin 0 -> 349696 bytes .../Referenced Assemblies/SharpDX.Direct3D9.xml | 36476 ++++++++++++++ .../Referenced Assemblies/SharpDX.dll | Bin 0 -> 558080 bytes .../Referenced Assemblies/SharpDX.xml | 48704 +++++++++++++++++++ .../RealTimeGraphEx/Resources/Resources.xaml | 74 + .../RealTimeGraphEx/Synchronization/SyncManager.cs | 63 + .../WriteableBitmap/BitmapContext.cs | 468 + .../WriteableBitmap/BitmapFactory.cs | 214 + .../WriteableBitmap/NativeMethods.cs | 41 + .../WriteableBitmapAntialiasingExtensions.cs | 444 + .../WriteableBitmapBaseExtensions.cs | 480 + .../WriteableBitmapBlitExtensions.cs | 704 + .../WriteableBitmapContextExtensions.cs | 55 + .../WriteableBitmapConvertExtensions.cs | 344 + .../WriteableBitmapFillExtensions.cs | 1205 + .../WriteableBitmapFilterExtensions.cs | 423 + .../WriteableBitmapLineExtensions.cs | 1316 + .../WriteableBitmapShapeExtensions.cs | 489 + .../WriteableBitmapSplineExtensions.cs | 341 + .../WriteableBitmapTransformationExtensions.cs | 623 + .../SideChains/RealTimeGraphEx/packages.config | 5 + .../Tango.Emulations/Emulators/MachineEmulator.cs | 24 + .../Operators/IMachineOperator.cs | 23 + .../Tango.Integration/Operators/MachineOperator.cs | 85 + .../Tango.Integration/Services/ComPortInfo.cs | 74 + .../Services/ExternalBridgeScanner.cs | 17 +- .../Services/ExternalBridgeTcpClient.cs | 3 +- .../Services/ExternalBridgeUsbClient.cs | 3 +- .../Services/IExternalBridgeClient.cs | 3 +- .../Tango.Integration/Tango.Integration.csproj | 20 + .../Tango.Integration/packages.config | 6 + .../Visual_Studio/Tango.PMR/Common/MessageType.cs | 12 +- .../Tango.PMR/Diagnostics/PushSensorsRequest.cs | 131 + .../Tango.PMR/Diagnostics/PushSensorsResponse.cs | 153 + Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj | 2 + Software/Visual_Studio/Tango.PMR/TangoMessage.cs | 4 +- .../Visual_Studio/Tango.Settings/Integration.cs | 9 +- .../MachineStudioSettings/MachineStudio.cs | 6 + .../MachineStudioSettings/TechnicianModule.cs | 21 + .../Tango.Settings/Tango.Settings.csproj | 1 + .../Controls/MultiTransitionControl.xaml.cs | 31 +- Software/Visual_Studio/Tango.SharedUI/ViewModel.cs | 9 + Software/Visual_Studio/Tango.sln | 23 + .../Tango.MachineEM.UI/ViewModels/MainViewVM.cs | 8 +- 159 files changed, 156002 insertions(+), 138 deletions(-) create mode 100644 Software/PMR/Messages/Diagnostics/PushSensorsRequest.proto create mode 100644 Software/PMR/Messages/Diagnostics/PushSensorsResponse.proto create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Converters/SecondsToGraphPointsConverter.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Converters/TransitionLinkConverter.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Helpers/GraphsMaxPointsHelper.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Navigation/TechNavigationManager.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Navigation/TechNavigationView.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Resources/GraphEx.xaml create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/SensorsViewVM.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MotorsView.xaml create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MotorsView.xaml.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/OverviewView.xaml create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/OverviewView.xaml.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/SensorsView.xaml create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/SensorsView.xaml.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/Components/ComponentBase.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/Components/ComponentLocationEnum.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/Components/GridLines.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/Components/MouseValueToolTip.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/Components/YAxisLegends.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/Components/YAxisScroll.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/Components/YAxisTicks.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/Components/YAxisWave.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/ComponentsItems/YAxisBigTick.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/ComponentsItems/YAxisLabel.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/ComponentsItems/YAxisLegend.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/ComponentsItems/YAxisSmallTick.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/Controllers/GraphController.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/Controllers/GraphControllerBase.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/Controllers/GraphMultiController.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/DX2D/DX10ImageSource.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/DX2D/DXGraphSurfaceMultiErase.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/DX2D/DXGraphSurfaceMultiScroll.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/DX2D/DXGraphSurfaceSingleErase.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/DX2D/DXGraphSurfaceSingleScroll.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/DX2D/Direct2DControl.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/DX2D/Disposer.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/DX2D/NativeMethods.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/DataSeries/DataYSeries.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/DirectXGraphs/RealTimeGraphExDirectXLineErase.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/DirectXGraphs/RealTimeGraphExDirectXLineScroll.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/DirectXGraphs/RealTimeGraphExDirectXMultiLineErase.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/DirectXGraphs/RealTimeGraphExDirectXMultiLineScroll.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/Enums/OpacityTypeEnum.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/Enums/ZoomDirectionEnum.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/Enums/ZoomModeEnum.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/ExtensionMethods/BrushExtensions.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/ExtensionMethods/ColorExtensions.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/ExtensionMethods/RenderTargetExtensions.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/FastGraphs/RealTimeGraphExEllipseScroll.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/FastGraphs/RealTimeGraphExLineErase.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/FastGraphs/RealTimeGraphExLineScroll.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/FastGraphs/RealTimeGraphExMultiLineErase.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/FastGraphs/RealTimeGraphExMultiLineScroll.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/FastGraphs/RealTimeGraphExShapeErase.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/FastGraphs/RealTimeGraphExShapeScroll.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/FastGraphs/RealTimeGraphExWaveErase.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/FastGraphs/RealTimeGraphExWaveScroll.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/FastGraphs/ShapeTypeEnum.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/FodyWeavers.xml create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/Models/ConcurrentPointsList.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/Models/RangeData.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/Models/RealTimeGraphColumnsCollection.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/Models/RealTimeGraphExColumn.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/Models/RealTimeGraphExPoint.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/Models/RealTimeGraphExPolygon.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/Models/RealTimeGraphExReachPolygon.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/Properties/AssemblyInfo.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/Properties/Resources.Designer.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/Properties/Resources.resx create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/Properties/Settings.Designer.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/Properties/Settings.settings create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/ReachGraphs/RealTimeGraphExReachCircle.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/ReachGraphs/RealTimeGraphExReachLineErase.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/ReachGraphs/RealTimeGraphExReachLineScroll.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/ReachGraphs/RealTimeGraphExReachMultiLineErase.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/ReachGraphs/RealTimeGraphExReachMultiLineScroll.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/ReachGraphs/RealTimeGraphExReachVUMeter.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/ReachGraphs/RealTimeGraphExReachWaveScroll.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/RealTimeGraphEx.csproj create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/RealTimeGraphExBase.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/RealTimeGraphExMultiBase.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/Referenced Assemblies/SharpDX.DXGI.dll create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/Referenced Assemblies/SharpDX.DXGI.xml create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/Referenced Assemblies/SharpDX.Direct2D1.dll create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/Referenced Assemblies/SharpDX.Direct2D1.xml create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/Referenced Assemblies/SharpDX.Direct3D10.dll create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/Referenced Assemblies/SharpDX.Direct3D10.xml create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/Referenced Assemblies/SharpDX.Direct3D9.dll create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/Referenced Assemblies/SharpDX.Direct3D9.xml create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/Referenced Assemblies/SharpDX.dll create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/Referenced Assemblies/SharpDX.xml create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/Resources/Resources.xaml create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/Synchronization/SyncManager.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/WriteableBitmap/BitmapContext.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/WriteableBitmap/BitmapFactory.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/WriteableBitmap/NativeMethods.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/WriteableBitmap/WriteableBitmapAntialiasingExtensions.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/WriteableBitmap/WriteableBitmapBaseExtensions.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/WriteableBitmap/WriteableBitmapBlitExtensions.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/WriteableBitmap/WriteableBitmapContextExtensions.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/WriteableBitmap/WriteableBitmapConvertExtensions.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/WriteableBitmap/WriteableBitmapFillExtensions.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/WriteableBitmap/WriteableBitmapFilterExtensions.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/WriteableBitmap/WriteableBitmapLineExtensions.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/WriteableBitmap/WriteableBitmapShapeExtensions.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/WriteableBitmap/WriteableBitmapSplineExtensions.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/WriteableBitmap/WriteableBitmapTransformationExtensions.cs create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphEx/packages.config create mode 100644 Software/Visual_Studio/Tango.Integration/Operators/IMachineOperator.cs create mode 100644 Software/Visual_Studio/Tango.Integration/Operators/MachineOperator.cs create mode 100644 Software/Visual_Studio/Tango.Integration/Services/ComPortInfo.cs create mode 100644 Software/Visual_Studio/Tango.PMR/Diagnostics/PushSensorsRequest.cs create mode 100644 Software/Visual_Studio/Tango.PMR/Diagnostics/PushSensorsResponse.cs create mode 100644 Software/Visual_Studio/Tango.Settings/MachineStudioSettings/TechnicianModule.cs (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioApplication') diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index da5cc939b..6ec476601 100644 Binary files a/Software/DB/Tango.mdf and b/Software/DB/Tango.mdf differ diff --git a/Software/DB/Tango_log.ldf b/Software/DB/Tango_log.ldf index 35f93651b..3d4d754ea 100644 Binary files a/Software/DB/Tango_log.ldf and b/Software/DB/Tango_log.ldf differ diff --git a/Software/PMR/Messages/Common/MessageType.proto b/Software/PMR/Messages/Common/MessageType.proto index d1b34ba77..c34263440 100644 --- a/Software/PMR/Messages/Common/MessageType.proto +++ b/Software/PMR/Messages/Common/MessageType.proto @@ -57,4 +57,8 @@ enum MessageType OverrideDataBaseResponse = 1006; KeepAliveRequest = 1007; KeepAliveResponse = 1008; + + //Diagnostics + PushSensorsRequest = 2000; + PushSensorsResponse = 2001; } diff --git a/Software/PMR/Messages/Diagnostics/PushSensorsRequest.proto b/Software/PMR/Messages/Diagnostics/PushSensorsRequest.proto new file mode 100644 index 000000000..0617a656f --- /dev/null +++ b/Software/PMR/Messages/Diagnostics/PushSensorsRequest.proto @@ -0,0 +1,9 @@ +syntax = "proto3"; + +package Tango.PMR.Diagnostics; +option java_package = "com.twine.tango.pmr.diagnostics"; + +message PushSensorsRequest +{ + +} \ No newline at end of file diff --git a/Software/PMR/Messages/Diagnostics/PushSensorsResponse.proto b/Software/PMR/Messages/Diagnostics/PushSensorsResponse.proto new file mode 100644 index 000000000..710e31bcd --- /dev/null +++ b/Software/PMR/Messages/Diagnostics/PushSensorsResponse.proto @@ -0,0 +1,9 @@ +syntax = "proto3"; + +package Tango.PMR.Diagnostics; +option java_package = "com.twine.tango.pmr.diagnostics"; + +message PushSensorsResponse +{ + repeated int32 Temperature = 1; +} \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/DBModule.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/DBModule.cs index 4f751d9da..c433a4cd4 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/DBModule.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/DBModule.cs @@ -17,10 +17,8 @@ namespace Tango.MachineStudio.DB /// public class DBModule : IStudioModule { - /// - /// The is initialized - /// private bool _isInitialized; + private bool _isLoaded; /// /// Gets the module name. @@ -52,6 +50,11 @@ namespace Tango.MachineStudio.DB /// public Permissions Permission => Permissions.RunDataBaseModule; + /// + /// Sets a value indicating whether this module is loaded. + /// + public bool IsLoaded { get => _isLoaded; set => _isLoaded = value; } + /// /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. /// diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/DeveloperModule.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/DeveloperModule.cs index c3d351468..4401245a9 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/DeveloperModule.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/DeveloperModule.cs @@ -15,6 +15,7 @@ namespace Tango.MachineStudio.Developer public class DeveloperModule : IStudioModule { private bool _isInitialized; + private bool _isLoaded; public string Name => "Developer"; @@ -26,6 +27,11 @@ namespace Tango.MachineStudio.Developer public bool IsInitialized => _isInitialized; + /// + /// Sets a value indicating whether this module is loaded. + /// + public bool IsLoaded { get => _isLoaded; set => _isLoaded = value; } + public Permissions Permission => Permissions.RunDeveloperModule; public void Dispose() diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/MachineDesignerModule.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/MachineDesignerModule.cs index ca13bd350..8fbac790f 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/MachineDesignerModule.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/MachineDesignerModule.cs @@ -18,6 +18,8 @@ namespace Tango.MachineStudio.MachineDesigner /// public class MachineDesignerModule : IStudioModule { + private bool _isLoaded; + /// /// Gets the module name. /// @@ -33,6 +35,11 @@ namespace Tango.MachineStudio.MachineDesigner /// public BitmapSource Image => ResourceHelper.GetImageFromResources("Images/machine-designer-module.jpg"); + /// + /// Sets a value indicating whether this module is loaded. + /// + public bool IsLoaded { get => _isLoaded; set => _isLoaded = value; } + /// /// Gets the module entry point view. /// diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/StubsModule.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/StubsModule.cs index 23214cf55..8b072ea46 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/StubsModule.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/StubsModule.cs @@ -18,6 +18,8 @@ namespace Tango.MachineStudio.Stubs /// public class StubsModule : IStudioModule { + private bool _isLoaded; + /// /// Gets the module name. /// @@ -38,6 +40,11 @@ namespace Tango.MachineStudio.Stubs /// public FrameworkElement MainView => new MainView(); + /// + /// Sets a value indicating whether this module is loaded. + /// + public bool IsLoaded { get => _isLoaded; set => _isLoaded = value; } + /// /// Gets the permission required to see and load this module. /// diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/SynchronizationModule.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/SynchronizationModule.cs index f6381a482..4a753b05e 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/SynchronizationModule.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/SynchronizationModule.cs @@ -18,9 +18,7 @@ namespace Tango.MachineStudio.Synchronization /// public class SynchronizationModule : IStudioModule { - /// - /// The is initialized - /// + private bool _isLoaded; private bool _isInitialized; /// @@ -43,6 +41,11 @@ namespace Tango.MachineStudio.Synchronization /// public FrameworkElement MainView => new MainView(); + /// + /// Sets a value indicating whether this module is loaded. + /// + public bool IsLoaded { get => _isLoaded; set => _isLoaded = value; } + /// /// Gets a value indicating whether this module has been initialized. /// diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/ViewModels/MainViewVM.cs index 48a5c64bd..21d76d7d7 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/ViewModels/MainViewVM.cs @@ -22,7 +22,7 @@ namespace Tango.MachineStudio.Synchronization.ViewModels MainViewLogger logger = new MainViewLogger(); logger.NewLog += (output) => { - Log += output + Environment.NewLine; + //Log += output + Environment.NewLine; }; LogManager.RegisterLogger(logger); diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Converters/SecondsToGraphPointsConverter.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Converters/SecondsToGraphPointsConverter.cs new file mode 100644 index 000000000..3120c44a6 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Converters/SecondsToGraphPointsConverter.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Data; + +namespace Tango.MachineStudio.Technician.Converters +{ + public class SecondsToGraphPointsConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) + { + double arrLength = double.Parse(parameter.ToString()); + return Helpers.GraphsMaxPointsHelper.GetMaxPoints(arrLength); + } + + public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) + { + return value; + } + } +} \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Converters/TransitionLinkConverter.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Converters/TransitionLinkConverter.cs new file mode 100644 index 000000000..d67f3a259 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Converters/TransitionLinkConverter.cs @@ -0,0 +1,55 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; + +namespace Tango.MachineStudio.Technician.Converters +{ + /// + /// Binding converter for converting TransitionControl child Tag to text style. + /// + /// + /// This converter is used by the patient page tabs, changing the selected tab text style to bold/normal. + /// + public class TransitionLinkConverter : IValueConverter + { + /// + /// Converts a ContentControl to font style. + /// + /// Content control. + /// + /// + /// + /// Font style. + public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) + { + ContentControl control = value as ContentControl; + + if (control != null && control.Tag != null && control.Tag.ToString().ToLower() == parameter.ToString().ToLower()) + { + return FontWeights.Bold; + } + else + { + return FontWeights.Normal; + } + } + + /// + /// Not Implemented. + /// + /// + /// + /// + /// + /// + public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) + { + return value; + } + } +} \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Helpers/GraphsMaxPointsHelper.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Helpers/GraphsMaxPointsHelper.cs new file mode 100644 index 000000000..87aab5967 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Helpers/GraphsMaxPointsHelper.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Settings; + +namespace Tango.MachineStudio.Technician.Helpers +{ + public static class GraphsMaxPointsHelper + { + public static int GetMaxPoints(double arrLength) + { + try + { + double seconds = SettingsManager.Default.MachineStudio.TechnicianModule.GraphsDuration; + double pullRate = SettingsManager.Default.MachineStudio.TechnicianModule.GraphsPullingInterval; + return (int)(((pullRate * arrLength * 10 * seconds) * (10 / pullRate)) * 0.65); + } + catch (Exception) + { + return 300; + } + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Navigation/TechNavigationManager.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Navigation/TechNavigationManager.cs new file mode 100644 index 000000000..f473776d1 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Navigation/TechNavigationManager.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.MachineStudio.Technician.Views; + +namespace Tango.MachineStudio.Technician.Navigation +{ + public class TechNavigationManager + { + public void NavigateTo(TechNavigationView view) + { + MainView.Instance.TransitionControl.AutoNavigate(view.ToString()); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Navigation/TechNavigationView.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Navigation/TechNavigationView.cs new file mode 100644 index 000000000..27d9fb09b --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Navigation/TechNavigationView.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.MachineStudio.Technician.Navigation +{ + public enum TechNavigationView + { + Overview, + Motors, + Sensors, + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Resources/GraphEx.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Resources/GraphEx.xaml new file mode 100644 index 000000000..85cccc2dd --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Resources/GraphEx.xaml @@ -0,0 +1,126 @@ + + + Segoe UI + Lucida Console + + 28 + 26 + 20 + 16 + 14 + 12 + 9 + + + Silver + #FFE9E9E9 + Gray + #03A9F4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Tango.MachineStudio.Technician.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Tango.MachineStudio.Technician.csproj index 2c5df42fc..097917fef 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Tango.MachineStudio.Technician.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Tango.MachineStudio.Technician.csproj @@ -77,15 +77,46 @@ + + + + + + + + MotorsView.xaml + + + OverviewView.xaml + + + SensorsView.xaml + MainView.xaml GlobalVersionInfo.cs + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + Designer MSBuild:Compile @@ -117,6 +148,10 @@ + + {b9ae25d6-be35-492f-9079-21a7f3e6f7cc} + RealTimeGraphEx + {a34ee0f0-649d-41c8-8489-b6f1cc6924ee} Tango.Core diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechnicianModule.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechnicianModule.cs index a4eaff71e..b715b6710 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechnicianModule.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechnicianModule.cs @@ -14,6 +14,10 @@ namespace Tango.MachineStudio.Technician { public class TechnicianModule : IStudioModule { + private bool _isLoaded; + + public event EventHandler IsLoadedChanged; + public string Name => "Technician"; public string Description => "Provides access to low level machine components by exposing diagnostics and profiling tools."; @@ -26,6 +30,16 @@ namespace Tango.MachineStudio.Technician public bool IsInitialized => true; + /// + /// Sets a value indicating whether this module is loaded. + /// + public bool IsLoaded + { + get { return _isLoaded; } + set { _isLoaded = value; IsLoadedChanged?.Invoke(this, value); } + } + + public void Dispose() { diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModelLocator.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModelLocator.cs index f922d5ec4..e7fea686d 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModelLocator.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModelLocator.cs @@ -1,6 +1,7 @@ using GalaSoft.MvvmLight; using GalaSoft.MvvmLight.Ioc; using Microsoft.Practices.ServiceLocation; +using Tango.MachineStudio.Technician.Navigation; using Tango.MachineStudio.Technician.ViewModels; namespace Tango.MachineStudio.Technician @@ -17,7 +18,13 @@ namespace Tango.MachineStudio.Technician static ViewModelLocator() { ServiceLocator.SetLocatorProvider(() => SimpleIoc.Default); + SimpleIoc.Default.Register(); + SimpleIoc.Default.Register(); + + SimpleIoc.Default.Unregister(); + + SimpleIoc.Default.Register(); } public static MainViewVM MainViewVM @@ -27,5 +34,13 @@ namespace Tango.MachineStudio.Technician return ServiceLocator.Current.GetInstance(); } } + + public static SensorsViewVM SensorsViewVM + { + get + { + return ServiceLocator.Current.GetInstance(); + } + } } } \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MainViewVM.cs index c715af6cb..68852fe20 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MainViewVM.cs @@ -3,12 +3,39 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using Tango.Core.Commands; +using Tango.MachineStudio.Technician.Navigation; using Tango.SharedUI; namespace Tango.MachineStudio.Technician.ViewModels { public class MainViewVM : ViewModel { + private TechNavigationManager _navigation; + #region Constructors + + public MainViewVM(TechNavigationManager navigationManager) + { + _navigation = navigationManager; + NavigateToViewCommand = new RelayCommand(NavigateToView); + } + + #endregion + + #region Commands + + public RelayCommand NavigateToViewCommand { get; set; } + + #endregion + + #region Private Methods + + private void NavigateToView(string view) + { + _navigation.NavigateTo((TechNavigationView)Enum.Parse(typeof(TechNavigationView), view, true)); + } + + #endregion } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/SensorsViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/SensorsViewVM.cs new file mode 100644 index 000000000..cb3114f4c --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/SensorsViewVM.cs @@ -0,0 +1,139 @@ +using RealTimeGraphEx.Controllers; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Integration.Operators; +using Tango.Logging; +using Tango.MachineStudio.Common.Modules; +using Tango.MachineStudio.Common.StudioApplication; +using Tango.PMR.Diagnostics; +using Tango.Settings; +using Tango.SharedUI; + +namespace Tango.MachineStudio.Technician.ViewModels +{ + public class SensorsViewVM : ViewModel + { + private List _controllers; + + public IStudioApplicationManager ApplicationManager { get; set; } + + private IMachineOperator _machineOperator; + public IMachineOperator MachineOperator + { + get { return _machineOperator; } + set { _machineOperator = value; RaisePropertyChangedAuto(); } + } + + public SensorsViewVM(IStudioApplicationManager applicationManager, IStudioModuleLoader moduleLoader) + { + ApplicationManager = applicationManager; + ApplicationManager.ConnectedMachineChanged += ApplicationManager_ConnectedMachineChanged; + + InitializeConnectedMachine(ApplicationManager.ConnectedMachine); + + if (!DesignMode) + { + //Set graphs FIFO capacity by seconds (this will be converted to MaxPoints by the view). + GraphSeconds = SettingsManager.Default.MachineStudio.TechnicianModule.GraphsDuration; + + _controllers = new List(); + + TemperatureController = new GraphController(); + PressureController = new GraphController(); + + _controllers.Add(TemperatureController); + _controllers.Add(PressureController); + + var module = moduleLoader.UserModules.SingleOrDefault(x => x is TechnicianModule) as TechnicianModule; + + if (module != null) + { + module.IsLoadedChanged += Module_IsLoadedChanged; + } + } + } + + private void Module_IsLoadedChanged(object sender, bool loaded) + { + //_controllers.ForEach(x => x.ChangeRenderMode(loaded)); + } + + private void ApplicationManager_ConnectedMachineChanged(object sender, Integration.Services.IExternalBridgeClient machineOperator) + { + InitializeConnectedMachine(machineOperator); + } + + private void MachineOperator_SensorsDataAvailable(object sender, PushSensorsResponse data) + { + TemperatureController.PushData(data.Temperature.ToArray().Select(Convert.ToDouble).ToArray()); + PressureController.PushData(data.Temperature.ToArray().Select(Convert.ToDouble).ToArray()); + } + + private void InitializeConnectedMachine(IMachineOperator machineOperator) + { + MachineOperator = machineOperator; + + if (MachineOperator != null) + { + MachineOperator.EnableSensorsUpdate = true; + MachineOperator.SensorsDataAvailable -= MachineOperator_SensorsDataAvailable; + MachineOperator.SensorsDataAvailable += MachineOperator_SensorsDataAvailable; + } + } + + #region Graphs Controllers + + private GraphController _temperatureController; + /// + /// Gets or sets the temperature sensor graph controller . + /// + public GraphController TemperatureController + { + get { return _temperatureController; } + set { _temperatureController = value; RaisePropertyChanged(nameof(TemperatureController)); } + } + + private GraphController _pressureController; + /// + /// Gets or sets the pressure sensor graph controller . + /// + public GraphController PressureController + { + get { return _pressureController; } + set { _pressureController = value; RaisePropertyChanged(nameof(PressureController)); } + } + + #endregion + + private int _graphSeconds; + /// + /// Gets or sets the graphs number of seconds to complete FIFO capacity. + /// + public int GraphSeconds + { + get { return _graphSeconds; } + set { _graphSeconds = value; RaisePropertyChanged(nameof(GraphSeconds)); } + } + + /// + /// Clears the graphs. + /// + public void ClearGraphs() + { + _controllers.ForEach(x => x.Clear()); + } + + /// + /// Creates a dummy list with default value of -1000 (used to fill graphs buffer). + /// + /// List length. + /// + private List CreateDummyList(int count) + { + return Enumerable.Repeat(-1000, count + 1).ToList(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MainView.xaml index 1337358e1..6b84881fd 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MainView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MainView.xaml @@ -5,10 +5,98 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:global="clr-namespace:Tango.MachineStudio.Technician" xmlns:vm="clr-namespace:Tango.MachineStudio.Technician.ViewModels" + xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" + xmlns:sharedUI="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" xmlns:local="clr-namespace:Tango.MachineStudio.Technician.Views" + xmlns:converters="clr-namespace:Tango.MachineStudio.Technician.Converters" mc:Ignorable="d" d:DesignHeight="720" d:DesignWidth="1280" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}" Background="White"> + + + + + + + + + + + + + - Technician + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MainView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MainView.xaml.cs index 0701fbc50..b07fc597e 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MainView.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MainView.xaml.cs @@ -20,9 +20,12 @@ namespace Tango.MachineStudio.Technician.Views /// public partial class MainView : UserControl { + public static MainView Instance { get; set; } + public MainView() { InitializeComponent(); + Instance = this; } } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MotorsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MotorsView.xaml new file mode 100644 index 000000000..3fb49d457 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MotorsView.xaml @@ -0,0 +1,12 @@ + + + MOTORS + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MotorsView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MotorsView.xaml.cs new file mode 100644 index 000000000..bd548766c --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MotorsView.xaml.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace Tango.MachineStudio.Technician.Views +{ + /// + /// Interaction logic for MotorsView.xaml + /// + public partial class MotorsView : UserControl + { + public MotorsView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/OverviewView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/OverviewView.xaml new file mode 100644 index 000000000..3c064346d --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/OverviewView.xaml @@ -0,0 +1,12 @@ + + + OVERVIEW + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/OverviewView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/OverviewView.xaml.cs new file mode 100644 index 000000000..aeba42c00 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/OverviewView.xaml.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace Tango.MachineStudio.Technician.Views +{ + /// + /// Interaction logic for OverviewView.xaml + /// + public partial class OverviewView : UserControl + { + public OverviewView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/SensorsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/SensorsView.xaml new file mode 100644 index 000000000..2e074ec3c --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/SensorsView.xaml @@ -0,0 +1,141 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/SensorsView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/SensorsView.xaml.cs new file mode 100644 index 000000000..4727a3603 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/SensorsView.xaml.cs @@ -0,0 +1,53 @@ +using Microsoft.Practices.ServiceLocation; +using RealTimeGraphEx.Synchronization; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace Tango.MachineStudio.Technician.Views +{ + /// + /// Interaction logic for DebugView.xaml + /// + public partial class SensorsView : UserControl + { + private SyncManager _syncManager; + + public SensorsView() + { + InitializeComponent(); + + _syncManager = new SyncManager(); + _syncManager.AddGraph(graphTemperature); + _syncManager.AddGraph(graphPressure); + _syncManager.RefreshRate = 30; + _syncManager.Start(); + } + + private void OnGraphFullScreen(object sender, RoutedEventArgs e) + { + + } + + private void Graph_MouseEnter(object sender, MouseEventArgs e) + { + + } + + private void Graph_MouseLeave(object sender, MouseEventArgs e) + { + + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/IStudioModule.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/IStudioModule.cs index 21377fb5f..118afff7e 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/IStudioModule.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/IStudioModule.cs @@ -49,5 +49,10 @@ namespace Tango.MachineStudio.Common /// Perform any operations required to initialize this module. /// void Initialize(); + + /// + /// Sets a value indicating whether this module is loaded. + /// + bool IsLoaded { set; get; } } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioApplication/IStudioApplicationManager.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioApplication/IStudioApplicationManager.cs index dfdac67c7..a88a045a6 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioApplication/IStudioApplicationManager.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioApplication/IStudioApplicationManager.cs @@ -12,6 +12,11 @@ namespace Tango.MachineStudio.Common.StudioApplication /// public interface IStudioApplicationManager { + /// + /// Occurs when the connected machine property has changed. + /// + event EventHandler ConnectedMachineChanged; + /// /// Gets a value indicating whether Machine Studio is shutting down. /// diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml index 8e5876e79..fe50851a0 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml @@ -11,7 +11,10 @@ - + + + + diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Modules/DefaultStudioModuleLoader.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Modules/DefaultStudioModuleLoader.cs index 5944af2d1..0e1bd829b 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Modules/DefaultStudioModuleLoader.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Modules/DefaultStudioModuleLoader.cs @@ -25,6 +25,7 @@ namespace Tango.MachineStudio.UI.Modules { private IAuthenticationProvider _authenticationProvider; private bool _loaded; + public event EventHandler ModulesLoaded; /// /// Initializes a new instance of the class. @@ -115,6 +116,8 @@ namespace Tango.MachineStudio.UI.Modules { UserModules = AllModules.Where(x => _authenticationProvider.CurrentUser.HasPermission(x.Permission)).ToObservableCollection(); } + + ModulesLoaded?.Invoke(this, new EventArgs()); } } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Navigation/DefaultNavigationManager.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Navigation/DefaultNavigationManager.cs index 2fa8c7562..56abbd702 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Navigation/DefaultNavigationManager.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Navigation/DefaultNavigationManager.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using Tango.MachineStudio.Common; using Tango.MachineStudio.Common.Navigation; namespace Tango.MachineStudio.UI.Navigation diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs index 68af7bdc3..06b4dca7c 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs @@ -48,6 +48,11 @@ namespace Tango.MachineStudio.UI.StudioApplication /// private IExternalBridgeClient _connectedMachine; + /// + /// Occurs when the connected machine property has changed. + /// + public event EventHandler ConnectedMachineChanged; + /// /// Gets or sets the currently connected machine if any. /// @@ -66,6 +71,8 @@ namespace Tango.MachineStudio.UI.StudioApplication _connectedMachine.StateChanged -= ConnectedMachine_StateChanged; _connectedMachine.StateChanged += ConnectedMachine_StateChanged; } + + ConnectedMachineChanged?.Invoke(this, _connectedMachine); } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/SupervisingController/IMainView.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/SupervisingController/IMainView.cs index 3de061de8..fd8ef4be5 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/SupervisingController/IMainView.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/SupervisingController/IMainView.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using Tango.MachineStudio.Common; using Tango.SharedUI; namespace Tango.MachineStudio.UI.SupervisingController @@ -13,6 +14,10 @@ namespace Tango.MachineStudio.UI.SupervisingController /// public interface IMainView : IView { - + /// + /// Navigates to the specified studio module. + /// + /// The module. + void NavigateToModule(IStudioModule module); } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj index b752ca4b7..9b498cfb6 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj @@ -241,6 +241,10 @@ + + {b9ae25d6-be35-492f-9079-21a7f3e6f7cc} + RealTimeGraphEx + {a34ee0f0-649d-41c8-8489-b6f1cc6924ee} Tango.Core diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModelLocator.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModelLocator.cs index 5f315f7f4..7ceab8268 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModelLocator.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModelLocator.cs @@ -67,7 +67,7 @@ namespace Tango.MachineStudio.UI if (!ViewModelBase.IsInDesignModeStatic) { - LogManager.RegisterLogger(new VSOutputLogger()); + //LogManager.RegisterLogger(new VSOutputLogger()); LogManager.RegisterLogger(new FileLogger()); } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs index fcbdc90a3..fdab1a93c 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs @@ -1,4 +1,5 @@ -using System; +using GalaSoft.MvvmLight.Ioc; +using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.IO; @@ -275,14 +276,22 @@ namespace Tango.MachineStudio.UI.ViewModels { IsMenuOpened = false; + foreach (var m in StudioModuleLoader.AllModules.Where(x => x != module)) + { + m.IsLoaded = false; + } + if (module != null) { CurrentModule = module; + CurrentModule.IsLoaded = true; IsModuleLoaded = true; + View.NavigateToModule(module); } else { IsModuleLoaded = false; + View.NavigateToModule(null); } } 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 616187288..99654f602 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml @@ -165,95 +165,66 @@ - - - - - - - Welcome to Machine Studio - Select Your Studio Module... - - + + + + + + + + + + + Welcome to Machine Studio + Select Your Studio Module... + + - - - - - - - - + + + + + + + + - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/packages.config b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/packages.config new file mode 100644 index 000000000..4fd672b32 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/packages.config @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/MachineDesignerModule.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/MachineDesignerModule.cs index 8fbac790f..b0160abd5 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/MachineDesignerModule.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/MachineDesignerModule.cs @@ -48,7 +48,7 @@ namespace Tango.MachineStudio.MachineDesigner /// /// Gets the permission required to see and load this module. /// - public Permissions Permission => Permissions.RunDeveloperModule; + public Permissions Permission => Permissions.RunMachineDesignerModule; /// /// Gets a value indicating whether this module has been initialized. diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Tango.MachineStudio.MachineDesigner.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Tango.MachineStudio.MachineDesigner.csproj index ac1616401..64c54b357 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Tango.MachineStudio.MachineDesigner.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Tango.MachineStudio.MachineDesigner.csproj @@ -85,6 +85,9 @@ MachineVersionDialog.xaml + + MachineView.xaml + MainView.xaml @@ -96,6 +99,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + Designer MSBuild:Compile diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs index 24f2f6d43..9f44bc270 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs @@ -13,10 +13,12 @@ using Tango.DAL.Observables; using Tango.MachineStudio.Common.Notifications; using Tango.SharedUI; using SimpleValidator.Extensions; +using Tango.MachineStudio.Common.StudioApplication; +using Tango.MachineStudio.Common; namespace Tango.MachineStudio.MachineDesigner.ViewModels { - public class MainViewVM : ViewModel + public class MainViewVM : ViewModel, IModuleRequestListener { private bool _isSaving; private INotificationProvider _notification; @@ -631,5 +633,22 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels } #endregion + + #region IModuleRequestListener + + /// + /// Called when the request has been made. + /// + /// The module instance. + /// The arguments. + public void OnRequestModule(IStudioModule module, object args) + { + if (module is MachineDesignerModule) + { + SelectedMachine = args as Machine; + } + } + + #endregion } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineView.xaml new file mode 100644 index 000000000..a54f9bbdc --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineView.xaml @@ -0,0 +1,327 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Hardware + + + + + + Add IDS + + + + + + Remove IDS + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + NO IDS PACKS + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Touch Panel + + + + + + Embedded Firmware + + + + + + Dispensers + + + + + + Mid Tanks + + + + + + Cartridges + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineView.xaml.cs new file mode 100644 index 000000000..67fa0d5bf --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineView.xaml.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace Tango.MachineStudio.MachineDesigner.Views +{ + /// + /// Interaction logic for MachineView.xaml + /// + public partial class MachineView : UserControl + { + public MachineView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/TableGrid.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/TableGrid.cs new file mode 100644 index 000000000..07fd0c446 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/TableGrid.cs @@ -0,0 +1,58 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; + +namespace Tango.MachineStudio.Common.Controls +{ + public class TableGrid : Grid + { + public TableGrid() + { + ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Auto) }); + ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star) }); + this.Loaded += TableGrid_Loaded; + } + + private void TableGrid_Loaded(object sender, RoutedEventArgs e) + { + InvalidateGrid(); + } + + protected override void OnVisualChildrenChanged(DependencyObject visualAdded, DependencyObject visualRemoved) + { + base.OnVisualChildrenChanged(visualAdded, visualRemoved); + } + + protected override Size ArrangeOverride(Size arrangeSize) + { + return base.ArrangeOverride(arrangeSize); + } + + private void InvalidateGrid() + { + RowDefinitions.Clear(); + RowDefinitions.Add(new RowDefinition() { Height = new GridLength(50, GridUnitType.Pixel) }); + + int currentRow = 0; + + for (int i = 0; i < Children.Count; i++) + { + SetRow(Children[i], currentRow); + + if (i % 2 != 0) + { + SetColumn(Children[i], 1); + (Children[i] as FrameworkElement).Margin = new Thickness(20, 0, 0, 0); + currentRow++; + RowDefinitions.Add(new RowDefinition() { Height = new GridLength(50, GridUnitType.Pixel) }); + } + + (Children[i] as FrameworkElement).VerticalAlignment = VerticalAlignment.Bottom; + } + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioApplication/IModuleRequestListener.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioApplication/IModuleRequestListener.cs new file mode 100644 index 000000000..b950d7bcd --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioApplication/IModuleRequestListener.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.MachineStudio.Common.StudioApplication +{ + /// + /// Represents a type which will be notified when a new module request was made by + /// + public interface IModuleRequestListener + { + /// + /// Called when the request has been made. + /// + /// The module instance. + /// The arguments. + void OnRequestModule(IStudioModule module, Object args); + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioApplication/IStudioApplicationManager.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioApplication/IStudioApplicationManager.cs index a88a045a6..c67c34044 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioApplication/IStudioApplicationManager.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioApplication/IStudioApplicationManager.cs @@ -20,7 +20,7 @@ namespace Tango.MachineStudio.Common.StudioApplication /// /// Gets a value indicating whether Machine Studio is shutting down. /// - bool IsShuttingDown { get;} + bool IsShuttingDown { get; } /// /// Shutdown the application. @@ -40,6 +40,13 @@ namespace Tango.MachineStudio.Common.StudioApplication /// /// Gets a value indicating whether the is valid and connected through TCP/IP. /// - bool IsMachineConnectedViaTCP { get; } + bool IsMachineConnectedViaTCP { get; } + + /// + /// Loads the specified module if permitted. + /// + /// Name of the module. + /// The arguments. + void RequestModule(String moduleName, Object args); } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj index 42eae3c1e..e16703cfa 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj @@ -71,7 +71,9 @@ + + diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs index 06b4dca7c..a59ecf8e0 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs @@ -14,6 +14,8 @@ using System.Collections; using Tango.Integration.Services; using Tango.Core; using Tango.Logging; +using Tango.MachineStudio.Common.Modules; +using Tango.MachineStudio.Common; namespace Tango.MachineStudio.UI.StudioApplication { @@ -24,17 +26,16 @@ namespace Tango.MachineStudio.UI.StudioApplication /// public class DefaultStudioApplicationManager : ExtendedObject, IStudioApplicationManager { - /// - /// The navigation manager - /// private INavigationManager _navigationManager; + private IStudioModuleLoader _moduleLoader; /// /// Initializes a new instance of the class. /// /// The navigation manager. - public DefaultStudioApplicationManager(INavigationManager navigationManager) + public DefaultStudioApplicationManager(INavigationManager navigationManager, IStudioModuleLoader moduleLoader) { + _moduleLoader = moduleLoader; _navigationManager = navigationManager; } @@ -146,5 +147,30 @@ namespace Tango.MachineStudio.UI.StudioApplication }); } + + /// + /// Loads the specified module if permitted. + /// + /// Name of the module. + /// The arguments. + public void RequestModule(string moduleName, object args) + { + IStudioModule module = _moduleLoader.UserModules.SingleOrDefault(x => x.Name == moduleName); + + if (module != null) + { + ServiceLocator.Current.GetInstance().StartModule(module); + + //Notify request listeners. + foreach (var vm in ServiceLocator.Current.GetAllInstancesByBase()) + { + vm.OnRequestModule(module, args); + } + } + else + { + throw new InvalidOperationException("The module was not found or you do not have sufficient privileges."); + } + } } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs index fdab1a93c..679ba5ff3 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs @@ -272,7 +272,7 @@ namespace Tango.MachineStudio.UI.ViewModels /// Starts the specified module. /// /// The module. - private void StartModule(IStudioModule module) + internal void StartModule(IStudioModule module) { IsMenuOpened = false; -- cgit v1.3.1 From 1dd0d4988fb99109765b956adc6a371f5cb036e0 Mon Sep 17 00:00:00 2001 From: Roy Date: Sun, 11 Feb 2018 14:55:39 +0200 Subject: More work on technician view... Added auto loading of last project. Added IShutdownListener interface. Added TechName to Tech Items. Fixed issue with tech name of IO port. --- Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 8388608 -> 8388608 bytes .../ViewModels/DbTableViewModel.cs | 7 +- .../ViewModels/MainViewVM.cs | 1 - .../ViewModels/MainViewVM.cs | 7 +- .../TechItems/DispenserItem.cs | 5 +- .../TechItems/IOItem.cs | 5 +- .../TechItems/MeterItem.cs | 4 +- .../TechItems/MonitorItem.cs | 4 +- .../TechItems/MotorItem.cs | 5 +- .../TechItems/MultiGraphItem.cs | 5 +- .../TechItems/SingleGraphItem.cs | 4 +- .../TechItems/TechItem.cs | 31 ++++++- .../ViewModels/MachineTechViewVM.cs | 97 ++++++++++++++++++--- .../Views/MachineTechView.xaml | 2 +- .../StudioApplication/IShutdownListener.cs | 19 ++++ .../Tango.MachineStudio.Common.csproj | 1 + .../DefaultStudioApplicationManager.cs | 17 ++++ .../Visual_Studio/Tango.Editors/RelayCommand.cs | 6 ++ .../Operators/IMachineOperator.cs | 2 +- .../Tango.Integration/Operators/MachineOperator.cs | 4 +- .../Tango.Logging/ExceptionLogItem.cs | 2 +- .../MachineStudioSettings/TechnicianModule.cs | 2 +- 23 files changed, 175 insertions(+), 55 deletions(-) create mode 100644 Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioApplication/IShutdownListener.cs (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioApplication') diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index fed57f9d5..078b1923c 100644 Binary files a/Software/DB/Tango.mdf and b/Software/DB/Tango.mdf differ diff --git a/Software/DB/Tango_log.ldf b/Software/DB/Tango_log.ldf index 8f4baf0f9..ac9ee8d61 100644 Binary files a/Software/DB/Tango_log.ldf and b/Software/DB/Tango_log.ldf differ diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/DbTableViewModel.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/DbTableViewModel.cs index d6de58de4..a05df573c 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/DbTableViewModel.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/DbTableViewModel.cs @@ -18,7 +18,7 @@ using System.ComponentModel; namespace Tango.MachineStudio.DB.ViewModels { - public abstract class DbTableViewModel : ViewModel, IShutdownRequestBlocker where T : class, IObservableEntity + public abstract class DbTableViewModel : ViewModel where T : class, IObservableEntity { protected INotificationProvider _notification; @@ -335,10 +335,5 @@ namespace Tango.MachineStudio.DB.ViewModels { } - - public Task OnShutdownRequest() - { - return Task.FromResult(true); - } } } 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 3c83579ec..d6c127b1f 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 @@ -1234,7 +1234,6 @@ namespace Tango.MachineStudio.Developer.ViewModels SettingsManager.Default.MachineStudio.DeveloperModule.LastSelectedMachineGuid = SelectedMachine != null ? SelectedMachine.Guid : null; SettingsManager.Default.MachineStudio.DeveloperModule.LastSelectedRMLGuid = SelectedRML != null ? SelectedRML.Guid : null; SettingsManager.Default.MachineStudio.DeveloperModule.LastSelectedJobGuid = SelectedJob != null ? SelectedJob.Guid : null; - SettingsManager.SaveDefaultSettings(); return Task.FromResult(true); } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/ViewModels/MainViewVM.cs index dcb883c88..6797b15e6 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/ViewModels/MainViewVM.cs @@ -24,7 +24,7 @@ namespace Tango.MachineStudio.Stubs.ViewModels /// Represents the script execution module main view model. /// /// - public class MainViewVM : ViewModel , IShutdownRequestBlocker + public class MainViewVM : ViewModel , IShutdownListener { private UsbTransportAdapter _adapter; //Holds the USB transport adapter. private StubManager _stubManager; @@ -527,13 +527,10 @@ namespace Tango.MachineStudio.Stubs.ViewModels /// Called when [shutdown request]. /// /// - public Task OnShutdownRequest() + public void OnShuttingDown() { SettingsManager.Default.MachineStudio.StubsModule.SelectedPort = SelectedPort; SettingsManager.Default.MachineStudio.StubsModule.LastTabs = CodeTabs.Select(x => x.File).ToList(); - SettingsManager.SaveDefaultSettings(); - - return Task.FromResult(true); } #endregion diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/DispenserItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/DispenserItem.cs index 78440bd5a..bc656c67c 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/DispenserItem.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/DispenserItem.cs @@ -21,7 +21,7 @@ namespace Tango.MachineStudio.Technician.TechItems public TechDispenser TechDispenser { get { return _techDispenser; } - set { _techDispenser = value; RaisePropertyChangedAuto(); RaisePropertyChanged(nameof(Data)); ItemGuid = value != null ? value.Guid : null; } + set { _techDispenser = value; RaisePropertyChangedAuto(); TechName = _techDispenser != null ? _techDispenser.Description : null; ItemGuid = value != null ? value.Guid : null; } } private bool _isHoming; @@ -96,9 +96,6 @@ namespace Tango.MachineStudio.Technician.TechItems set { _speed = value; RaisePropertyChangedAuto(); } } - - public override object Data => TechDispenser; - public DispenserItem() : base() { Name = "Dispenser"; diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/IOItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/IOItem.cs index c0a87842a..60d47b1c0 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/IOItem.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/IOItem.cs @@ -5,6 +5,7 @@ using System.Text; using System.Threading.Tasks; using System.Windows.Media; using System.Xml.Serialization; +using Tango.Core; using Tango.SharedUI.Helpers; namespace Tango.MachineStudio.Technician.TechItems @@ -13,14 +14,12 @@ namespace Tango.MachineStudio.Technician.TechItems { public event EventHandler ValueChanged; - public override object Data => new object(); - private int _port; public int Port { get { return _port; } - set { _port = value; RaisePropertyChangedAuto(); } + set { _port = value; RaisePropertyChangedAuto(); TechName = "GPIO " + Port; } } private bool _value; diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MeterItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MeterItem.cs index f0e7a8b8b..8fb7c83cc 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MeterItem.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MeterItem.cs @@ -18,7 +18,7 @@ namespace Tango.MachineStudio.Technician.TechItems public TechMonitor TechMonitor { get { return _techMonitor; } - set { _techMonitor = value; RaisePropertyChangedAuto(); RaisePropertyChanged(nameof(Data)); ItemGuid = value != null ? value.Guid : null; } + set { _techMonitor = value; RaisePropertyChangedAuto(); TechName = _techMonitor != null ? _techMonitor.Description : null; ItemGuid = value != null ? value.Guid : null; } } private double _value; @@ -61,8 +61,6 @@ namespace Tango.MachineStudio.Technician.TechItems [XmlIgnore] public DateTime LastUpdateTime { get; set; } - public override object Data => TechMonitor; - public MeterItem() : base() { Name = "VU Monitor"; diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MonitorItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MonitorItem.cs index 59ccb6819..f81d98438 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MonitorItem.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MonitorItem.cs @@ -17,7 +17,7 @@ namespace Tango.MachineStudio.Technician.TechItems public TechMonitor TechMonitor { get { return _techMonitor; } - set { _techMonitor = value; RaisePropertyChangedAuto(); RaisePropertyChanged(nameof(Data)); ItemGuid = value != null ? value.Guid : null; } + set { _techMonitor = value; RaisePropertyChangedAuto(); TechName = _techMonitor != null ? _techMonitor.Description : null; ItemGuid = value != null ? value.Guid : null; } } private double _value; @@ -38,8 +38,6 @@ namespace Tango.MachineStudio.Technician.TechItems [XmlIgnore] public DateTime LastUpdateTime { get; set; } - public override object Data => TechMonitor; - public MonitorItem() : base() { Name = "Monitor"; diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MotorItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MotorItem.cs index 3cd67c3ec..877f06078 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MotorItem.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MotorItem.cs @@ -21,7 +21,7 @@ namespace Tango.MachineStudio.Technician.TechItems public TechMotor TechMotor { get { return _techMotor; } - set { _techMotor = value; RaisePropertyChangedAuto(); RaisePropertyChanged(nameof(Data)); ItemGuid = value != null ? value.Guid : null; } + set { _techMotor = value; RaisePropertyChangedAuto(); TechName = _techMotor != null ? _techMotor.Description : null; ItemGuid = value != null ? value.Guid : null; } } private bool _isHoming; @@ -96,9 +96,6 @@ namespace Tango.MachineStudio.Technician.TechItems set { _speed = value; RaisePropertyChangedAuto(); } } - - public override object Data => TechMotor; - public MotorItem() : base() { Name = "Motor"; diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MultiGraphItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MultiGraphItem.cs index 67a0f4de7..232442357 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MultiGraphItem.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MultiGraphItem.cs @@ -23,7 +23,6 @@ namespace Tango.MachineStudio.Technician.TechItems _techMonitor = value; RaisePropertyChangedAuto(); - RaisePropertyChanged(nameof(Data)); if (_techMonitor != old && Editor != null) { @@ -32,14 +31,14 @@ namespace Tango.MachineStudio.Technician.TechItems } ItemGuid = value != null ? value.Guid : null; + + TechName = _techMonitor != null ? _techMonitor.Description : null; } } [XmlIgnore] public MultiGraphElementEditor Editor { get; set; } - public override object Data => TechMonitor; - public MultiGraphItem() : base() { Name = "Multi Channel Graph"; diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/SingleGraphItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/SingleGraphItem.cs index 488ac8d3c..1efcd93a8 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/SingleGraphItem.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/SingleGraphItem.cs @@ -23,7 +23,6 @@ namespace Tango.MachineStudio.Technician.TechItems _techMonitor = value; RaisePropertyChangedAuto(); - RaisePropertyChanged(nameof(Data)); if (_techMonitor != old && Editor != null) { @@ -32,14 +31,13 @@ namespace Tango.MachineStudio.Technician.TechItems } ItemGuid = value != null ? value.Guid : null; + TechName = _techMonitor != null ? _techMonitor.Description : null; } } [XmlIgnore] public SingleGraphElementEditor Editor { get; set; } - public override object Data => TechMonitor; - public SingleGraphItem() : base() { Name = "Single Channel Graph"; diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/TechItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/TechItem.cs index fdabc7dd3..91d5931b6 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/TechItem.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/TechItem.cs @@ -8,6 +8,7 @@ using System.Windows.Media; using System.Windows.Media.Imaging; using System.Xml.Serialization; using Tango.Core; +using Tango.Core.Helpers; using Tango.Integration.Observables; namespace Tango.MachineStudio.Technician.TechItems @@ -119,8 +120,15 @@ namespace Tango.MachineStudio.Technician.TechItems set { _angle = value; RaisePropertyChanged(nameof(Angle)); } } + + private String _techName; [XmlIgnore] - public abstract object Data { get; } + public String TechName + { + get { return _techName; } + set { _techName = value; RaisePropertyChangedAuto(); } + } + public String ItemGuid { get; set; } @@ -129,9 +137,28 @@ namespace Tango.MachineStudio.Technician.TechItems public Color Color { get { return _color; } - set { _color = value; RaisePropertyChangedAuto(); } + set + { + _color = value; + RaisePropertyChangedAuto(); + _colorNumber = ColorHelper.ColorToInteger(value); + } + } + + private int _colorNumber; + + public int ColorNumber + { + get { return _colorNumber; } + set + { + _colorNumber = value; + _color = ColorHelper.IntegerToColor(value); + RaisePropertyChanged(nameof(Color)); + } } + public virtual TechItem Clone() { TechItem cloned = Activator.CreateInstance(this.GetType()) as TechItem; diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs index ca318f029..a4a9f0965 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs @@ -4,6 +4,7 @@ using RealTimeGraphEx.Controllers; using System; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.IO; using System.Linq; using System.Reflection; using System.Text; @@ -15,21 +16,25 @@ using Tango.Core.Helpers; using Tango.Editors; using Tango.Integration.Observables; using Tango.Integration.Operators; +using Tango.MachineStudio.Common.Notifications; using Tango.MachineStudio.Common.StudioApplication; using Tango.MachineStudio.Technician.Editors; using Tango.MachineStudio.Technician.Project; using Tango.MachineStudio.Technician.TechItems; using Tango.PMR.Diagnostics; +using Tango.Settings; using Tango.SharedUI; namespace Tango.MachineStudio.Technician.ViewModels { - public class MachineTechViewVM : ViewModel + public class MachineTechViewVM : ViewModel, IShutdownListener { private List _diagnoticsDataProperties; private Dictionary _singleControllers; private Dictionary _multiControllers; private static object _elementsLock = new object(); + private String _lastTechProjectFile; + private INotificationProvider _notification; #region Properties @@ -83,6 +88,16 @@ namespace Tango.MachineStudio.Technician.ViewModels set { _machineOperator = value; RaisePropertyChangedAuto(); } } + private bool _disableRendering; + /// + /// Gets or sets a value indicating whether [disable rendering]. + /// + public bool DisableRendering + { + get { return _disableRendering; } + set { _disableRendering = value; RaisePropertyChangedAuto(); OnDisableRenderingChanged(); } + } + #endregion #region Commands @@ -97,8 +112,9 @@ namespace Tango.MachineStudio.Technician.ViewModels #region Constructors - public MachineTechViewVM(IStudioApplicationManager applicationManager) + public MachineTechViewVM(IStudioApplicationManager applicationManager, INotificationProvider notificationProvider) { + _notification = notificationProvider; _singleControllers = new Dictionary(); _multiControllers = new Dictionary(); AvailableTechItems = TechItem.GetAvailableTechItems().ToObservableCollection(); @@ -112,6 +128,14 @@ namespace Tango.MachineStudio.Technician.ViewModels OpenProjectCommand = new RelayCommand(OpenProject); SaveAsProjectCommand = new RelayCommand(SaveAsProject); + SaveProjectCommand = new RelayCommand(SaveProject); + + _lastTechProjectFile = SettingsManager.Default.MachineStudio.TechnicianModule.LasTechProjectFile; + + if (File.Exists(_lastTechProjectFile)) + { + OpenProjectFile(_lastTechProjectFile); + } } #endregion @@ -260,6 +284,23 @@ namespace Tango.MachineStudio.Technician.ViewModels #endregion + #region Virtual Methods + + protected virtual void OnDisableRenderingChanged() + { + foreach (var controller in _singleControllers) + { + controller.Value.ChangeRenderMode(!DisableRendering); + } + + foreach (var controller in _multiControllers) + { + controller.Value.ChangeRenderMode(!DisableRendering); + } + } + + #endregion + #region Add/Remove Element public void CreateElement(Rect bounds) @@ -648,17 +689,21 @@ namespace Tango.MachineStudio.Technician.ViewModels public void OpenProjectFile(String fileName) { LoadProject(MachineTechViewProject.Load(fileName)); + _lastTechProjectFile = fileName; } public void LoadProject(MachineTechViewProject project) { - Elements.Clear(); - _singleControllers.Clear(); - _multiControllers.Clear(); - - foreach (var item in project.Items) + using (_notification.PushTaskItem("Loading technician project file...")) { - AddTechItem(item); + Elements.Clear(); + _singleControllers.Clear(); + _multiControllers.Clear(); + + foreach (var item in project.Items) + { + AddTechItem(item); + } } } @@ -670,14 +715,30 @@ namespace Tango.MachineStudio.Technician.ViewModels if (dlg.ShowDialog().Value) { - SaveProject(dlg.FileName); + SaveProjectFile(dlg.FileName); + } + } + + private void SaveProjectFile(String fileName) + { + using (_notification.PushTaskItem("Saving technician project file...")) + { + MachineTechViewProject project = CreateProjectFile(); + project.Save(fileName); + _lastTechProjectFile = fileName; } } - private void SaveProject(String fileName) + private void SaveProject() { - MachineTechViewProject project = CreateProjectFile(); - project.Save(fileName); + if (File.Exists(_lastTechProjectFile)) + { + SaveProjectFile(_lastTechProjectFile); + } + else + { + SaveAsProject(); + } } private MachineTechViewProject CreateProjectFile() @@ -694,5 +755,17 @@ namespace Tango.MachineStudio.Technician.ViewModels } #endregion + + #region IShutdownListener + + public void OnShuttingDown() + { + InvokeUINow(() => + { + SettingsManager.Default.MachineStudio.TechnicianModule.LasTechProjectFile = _lastTechProjectFile; + }); + } + + #endregion } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml index 7ca1d6b20..937f64f61 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml @@ -265,7 +265,7 @@ - + diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioApplication/IShutdownListener.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioApplication/IShutdownListener.cs new file mode 100644 index 000000000..1ca5a7df2 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioApplication/IShutdownListener.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.MachineStudio.Common.StudioApplication +{ + /// + /// Used to notify view models about application terminating. + /// + public interface IShutdownListener + { + /// + /// Called when the application is about to terminate. + /// + void OnShuttingDown(); + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj index 7def48cb5..790c95cb5 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj @@ -86,6 +86,7 @@ + diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs index 7ea18014c..886985c92 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs @@ -16,6 +16,7 @@ using Tango.Core; using Tango.Logging; using Tango.MachineStudio.Common.Modules; using Tango.MachineStudio.Common; +using Tango.Settings; namespace Tango.MachineStudio.UI.StudioApplication { @@ -148,8 +149,24 @@ namespace Tango.MachineStudio.UI.StudioApplication LogManager.Log(ex, "Error disconnecting from machine."); } + foreach (var vm in ServiceLocator.Current.GetAllInstancesByBase()) + { + vm.OnShuttingDown(); + } + + try + { + SettingsManager.SaveDefaultSettings(); + } + catch (Exception ex) + { + LogManager.Log(ex, "Error saving settings."); + } + _navigationManager.NavigateTo(NavigationView.ShutdownView); + Thread.Sleep(3000); + Environment.Exit(0); }); diff --git a/Software/Visual_Studio/Tango.Editors/RelayCommand.cs b/Software/Visual_Studio/Tango.Editors/RelayCommand.cs index ce5a7d563..6042fad93 100644 --- a/Software/Visual_Studio/Tango.Editors/RelayCommand.cs +++ b/Software/Visual_Studio/Tango.Editors/RelayCommand.cs @@ -17,6 +17,7 @@ namespace Tango.Editors #region fields readonly Predicate canExecute; readonly Action execute; + private Action saveProject; #endregion fields #region constructors @@ -40,6 +41,11 @@ namespace Tango.Editors } + public RelayCommand(Action saveProject) + { + this.saveProject = saveProject; + } + #endregion constructors #region methods diff --git a/Software/Visual_Studio/Tango.Integration/Operators/IMachineOperator.cs b/Software/Visual_Studio/Tango.Integration/Operators/IMachineOperator.cs index 6b88cad65..104bafd32 100644 --- a/Software/Visual_Studio/Tango.Integration/Operators/IMachineOperator.cs +++ b/Software/Visual_Studio/Tango.Integration/Operators/IMachineOperator.cs @@ -99,6 +99,6 @@ namespace Tango.Integration.Operators /// /// The request. /// - Task> SetGPIOState(SetGPIOStateRequest request); + Task> SetGPIOState(SetGPIOStateRequest request); } } diff --git a/Software/Visual_Studio/Tango.Integration/Operators/MachineOperator.cs b/Software/Visual_Studio/Tango.Integration/Operators/MachineOperator.cs index 426b3b865..4ac0c9e35 100644 --- a/Software/Visual_Studio/Tango.Integration/Operators/MachineOperator.cs +++ b/Software/Visual_Studio/Tango.Integration/Operators/MachineOperator.cs @@ -269,9 +269,9 @@ namespace Tango.Integration.Operators /// /// The request. /// - public Task> SetGPIOState(SetGPIOStateRequest request) + public Task> SetGPIOState(SetGPIOStateRequest request) { - return SendRequest(request); + return SendRequest(request); } #endregion diff --git a/Software/Visual_Studio/Tango.Logging/ExceptionLogItem.cs b/Software/Visual_Studio/Tango.Logging/ExceptionLogItem.cs index d9bb8b6a7..c2651d594 100644 --- a/Software/Visual_Studio/Tango.Logging/ExceptionLogItem.cs +++ b/Software/Visual_Studio/Tango.Logging/ExceptionLogItem.cs @@ -36,7 +36,7 @@ namespace Tango.Logging /// public override string ToString() { - return String.Format("[{0}] [{6}] [{1}] [{2}] [Line {3}]: {4}{5}", TimeStamp.ToString("HH:mm:ss.ff"), Path.GetFileNameWithoutExtension(CallerFile), CallerMethodName, CallerLineNumber, Description, Environment.NewLine + InnerException.Message, Category); + return String.Format("[{0}] [{6}] [{1}] [{2}] [Line {3}]: {4}{5}", TimeStamp.ToString("HH:mm:ss.ff"), Path.GetFileNameWithoutExtension(CallerFile), CallerMethodName, CallerLineNumber, Description, Environment.NewLine + InnerException.ToString(), Category); } } diff --git a/Software/Visual_Studio/Tango.Settings/MachineStudioSettings/TechnicianModule.cs b/Software/Visual_Studio/Tango.Settings/MachineStudioSettings/TechnicianModule.cs index fe5a27848..4f3ced8d7 100644 --- a/Software/Visual_Studio/Tango.Settings/MachineStudioSettings/TechnicianModule.cs +++ b/Software/Visual_Studio/Tango.Settings/MachineStudioSettings/TechnicianModule.cs @@ -12,7 +12,7 @@ namespace Tango.Settings.MachineStudioSettings public int GraphsPullingInterval { get; set; } - public object MachineViewProject { get; set; } + public String LasTechProjectFile { get; set; } public TechnicianModule() { -- cgit v1.3.1