From 28de564b35207886d181e4a3870f70c3bde04c3d Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Mon, 17 Sep 2018 16:06:27 +0300 Subject: Implemented keep modules windows states and bounds after restart. --- .../Tango.MachineStudio.Common/MachineStudioSettings.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common') diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/MachineStudioSettings.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/MachineStudioSettings.cs index f54611d9c..22ed1a33d 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/MachineStudioSettings.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/MachineStudioSettings.cs @@ -11,6 +11,13 @@ namespace Tango.MachineStudio.Common { public class MachineStudioSettings : SettingsBase { + public class StudioModuleBounds + { + public String Name { get; set; } + public Rect Bounds { get; set; } + public WindowState State { get; set; } + } + /// /// Gets or sets the last login email. /// @@ -66,6 +73,11 @@ namespace Tango.MachineStudio.Common /// public bool UseExternalBridgeEmulator { get; set; } + /// + /// Gets or sets the studio modules bounds. + /// + public List StudioModulesBounds { get; set; } + /// /// Initializes a new instance of the class. /// @@ -75,6 +87,7 @@ namespace Tango.MachineStudio.Common LoggingCategories = new List(); UpdateServiceAddress = "http://twine01/MachineStudioUpdateService/MachineStudioUpdateService.svc"; DefaultIssueReportTags = new List(); + StudioModulesBounds = new List(); } } } -- cgit v1.3.1 From 09d6814981ea6103f27843aef998ae261269c632 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Mon, 17 Sep 2018 16:47:08 +0300 Subject: Increased research module process parameters font size. --- Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 15400960 -> 15400960 bytes .../Views/JobView.xaml | 4 ++-- .../Tango.MachineStudio.Common.csproj | 2 +- 4 files changed, 3 insertions(+), 3 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common') diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index addf78007..f6cd64958 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 76ffa3c27..bbc28ea0b 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.Developer/Views/JobView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml index 1f2e9294d..4733ebf07 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml @@ -1468,8 +1468,8 @@ - - + + 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 09678b515..81b155748 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 @@ -300,7 +300,7 @@ - + \ No newline at end of file -- cgit v1.3.1 From aeb14d2d27e479a88cb638c91be77454d250e19b Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Tue, 25 Sep 2018 15:58:28 +0300 Subject: Implemented new single value controller widget. Implemented new blower controller. Changed tech board styles to dark. --- Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 15400960 -> 15400960 bytes Software/PMR/Messages/Common/MessageType.proto | 2 + .../Diagnostics/SetBlowerStateRequest.proto | 13 + .../Diagnostics/SetBlowerStateResponse.proto | 9 + .../Editors/BlowerElementEditor.xaml | 64 ++++- .../Editors/ControllerElementEditor.xaml | 75 ++++-- .../Editors/DispenserElementEditor.xaml | 273 +++++++-------------- .../Editors/HeaterElementEditor.xaml | 4 +- .../Editors/MotorElementEditor.xaml | 251 ++++++------------- .../Editors/MotorGroupElementEditor.xaml | 221 +++++------------ .../Editors/TextElementEditor.xaml | 2 +- .../Editors/ThreadMotionElementEditor.xaml | 75 +----- .../TechItems/BlowerItem.cs | 40 +++ .../TechItems/ControllerItem.cs | 15 +- .../TechItems/HeaterItem.cs | 1 + .../ViewModels/MachineTechViewVM.cs | 40 ++- .../Controls/RealTimeGraphControl.xaml | 20 +- .../Controls/RealTimeGraphMultiControl.xaml | 20 +- .../Resources/MaterialDesign.xaml | 109 +++++++- .../Tango.Emulations/Emulators/MachineEmulator.cs | 34 ++- .../Operation/IMachineOperator.cs | 9 + .../Tango.Integration/Operation/MachineOperator.cs | 32 +++ .../Visual_Studio/Tango.PMR/Common/MessageType.cs | 43 ++-- .../Tango.PMR/Diagnostics/SetBlowerStateRequest.cs | 218 ++++++++++++++++ .../Diagnostics/SetBlowerStateResponse.cs | 131 ++++++++++ Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj | 2 + 27 files changed, 1033 insertions(+), 670 deletions(-) create mode 100644 Software/PMR/Messages/Diagnostics/SetBlowerStateRequest.proto create mode 100644 Software/PMR/Messages/Diagnostics/SetBlowerStateResponse.proto create mode 100644 Software/Visual_Studio/Tango.PMR/Diagnostics/SetBlowerStateRequest.cs create mode 100644 Software/Visual_Studio/Tango.PMR/Diagnostics/SetBlowerStateResponse.cs (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common') diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index db7b9f4f8..a0ba6351e 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 78312551b..7d419821a 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 595a167ad..85ad16999 100644 --- a/Software/PMR/Messages/Common/MessageType.proto +++ b/Software/PMR/Messages/Common/MessageType.proto @@ -162,6 +162,8 @@ enum MessageType StopEventsNotificationResponse = 2033; SetHeaterStateRequest = 2034; SetHeaterStateResponse = 2035; + SetBlowerStateRequest = 2036; + SetBlowerStateResponse = 2037; //Printing diff --git a/Software/PMR/Messages/Diagnostics/SetBlowerStateRequest.proto b/Software/PMR/Messages/Diagnostics/SetBlowerStateRequest.proto new file mode 100644 index 000000000..f89c18269 --- /dev/null +++ b/Software/PMR/Messages/Diagnostics/SetBlowerStateRequest.proto @@ -0,0 +1,13 @@ +syntax = "proto3"; + +import "HardwareBlowerType.proto"; + +package Tango.PMR.Diagnostics; +option java_package = "com.twine.tango.pmr.diagnostics"; + +message SetBlowerStateRequest +{ + PMR.Hardware.HardwareBlowerType BlowerType = 1; + double Voltage = 2; + bool IsActive = 3; +} \ No newline at end of file diff --git a/Software/PMR/Messages/Diagnostics/SetBlowerStateResponse.proto b/Software/PMR/Messages/Diagnostics/SetBlowerStateResponse.proto new file mode 100644 index 000000000..2409077e5 --- /dev/null +++ b/Software/PMR/Messages/Diagnostics/SetBlowerStateResponse.proto @@ -0,0 +1,9 @@ +syntax = "proto3"; + +package Tango.PMR.Diagnostics; +option java_package = "com.twine.tango.pmr.diagnostics"; + +message SetBlowerStateResponse +{ + +} \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/BlowerElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/BlowerElementEditor.xaml index e06d1f559..e5545ca61 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/BlowerElementEditor.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/BlowerElementEditor.xaml @@ -2,13 +2,15 @@ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" xmlns:sharedConverters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" xmlns:items="clr-namespace:Tango.MachineStudio.Technician.TechItems" xmlns:converters="clr-namespace:Tango.Editors.Converters;assembly=Tango.Editors" xmlns:visuals="clr-namespace:Tango.Visuals;assembly=Tango.Visuals" xmlns:local="clr-namespace:Tango.Editors;assembly=Tango.Editors" - mc:Ignorable="d" Background="Transparent" ClipToBounds="False" BorderThickness="0" MinWidth="1" MinHeight="1" RenderTransformOrigin="0.5,0.5" d:DataContext="{d:DesignInstance Type=items:BlowerItem, IsDesignTimeCreatable=False}" Height="99.188" Width="163.459"> + mc:Ignorable="d" Background="Transparent" ClipToBounds="False" BorderThickness="0" MinWidth="1" MinHeight="1" RenderTransformOrigin="0.5,0.5" d:DataContext="{d:DesignInstance Type=items:BlowerItem, IsDesignTimeCreatable=False}" Height="101.188" Width="352.459"> @@ -29,7 +31,65 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + MV + + + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/ControllerElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/ControllerElementEditor.xaml index de604625d..999c03e78 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/ControllerElementEditor.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/ControllerElementEditor.xaml @@ -8,8 +8,9 @@ xmlns:gauge="clr-namespace:Tango.CircularGauge;assembly=Tango.CircularGauge" xmlns:converters="clr-namespace:Tango.Editors.Converters;assembly=Tango.Editors" xmlns:visuals="clr-namespace:Tango.Visuals;assembly=Tango.Visuals" + xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls" xmlns:local="clr-namespace:Tango.Editors;assembly=Tango.Editors" - mc:Ignorable="d" Background="Transparent" ClipToBounds="False" BorderThickness="0" MinWidth="1" MinHeight="1" RenderTransformOrigin="0.5,0.5" d:DataContext="{d:DesignInstance Type=items:ControllerItem, IsDesignTimeCreatable=False}" Height="245.074" Width="321.75"> + mc:Ignorable="d" Background="Transparent" ClipToBounds="False" BorderThickness="0" MinWidth="1" MinHeight="1" RenderTransformOrigin="0.5,0.5" d:DataContext="{d:DesignInstance Type=items:ControllerItem, IsDesignTimeCreatable=False}" Height="245.074" Width="500.75"> @@ -30,15 +31,17 @@ - + - - + + + - + - + + + + + + + + + + + + + + PV + + + + + + + + + + + SV + + + + + - - - - - - - - - + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DispenserElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DispenserElementEditor.xaml index 1fa1c6c48..630dddec7 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DispenserElementEditor.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DispenserElementEditor.xaml @@ -32,7 +32,7 @@ - + @@ -45,205 +45,106 @@ - - - - - - - - - - - - - - - - - + + + + + + + - - - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + - - - - - - + + + + + + + - - - - - + + + + + + + - - - - + + + + + + + - - - - - - - - - - - - - + - - + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/HeaterElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/HeaterElementEditor.xaml index ca9f6140c..3ffeaaa77 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/HeaterElementEditor.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/HeaterElementEditor.xaml @@ -61,7 +61,7 @@ - PV + PV @@ -83,7 +83,7 @@ - SV + SV diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MotorElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MotorElementEditor.xaml index 80bfe8f96..25907fd8f 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MotorElementEditor.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MotorElementEditor.xaml @@ -34,7 +34,7 @@ - + @@ -47,192 +47,93 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - + - - - - - + + + + - - - - - + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MotorGroupElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MotorGroupElementEditor.xaml index 3adee13d6..ac07f1390 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MotorGroupElementEditor.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MotorGroupElementEditor.xaml @@ -34,7 +34,7 @@ - + @@ -47,178 +47,79 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - + + + + + + - - - - + - - - - - + + + + + + + - - + + + + + - + + + + + + + + + + + + + + + + + + + + + + - + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/TextElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/TextElementEditor.xaml index 33b0645ab..2d6c61c5e 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/TextElementEditor.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/TextElementEditor.xaml @@ -28,7 +28,7 @@ - + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/ThreadMotionElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/ThreadMotionElementEditor.xaml index 6e2315dc8..51de5dc95 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/ThreadMotionElementEditor.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/ThreadMotionElementEditor.xaml @@ -56,9 +56,6 @@ - - - @@ -67,83 +64,19 @@ - - - - + - + - - - - + - + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/BlowerItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/BlowerItem.cs index 6b532204e..f581988f7 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/BlowerItem.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/BlowerItem.cs @@ -7,6 +7,7 @@ using System.Windows.Media; using System.Xml.Serialization; using Tango.BL; using Tango.BL.Entities; +using Tango.Core.Commands; using Tango.SharedUI.Helpers; namespace Tango.MachineStudio.Technician.TechItems @@ -18,6 +19,8 @@ namespace Tango.MachineStudio.Technician.TechItems [TechItem(16)] public class BlowerItem : TechItem { + public event EventHandler SetCommandClicked; + private static List _BlowerConfigurations; /// /// Gets or sets the Blower configurations. @@ -68,6 +71,36 @@ namespace Tango.MachineStudio.Technician.TechItems set { _hardwareBlower = value; RaisePropertyChangedAuto(); } } + private bool _isActive; + [XmlIgnore] + public bool IsActive + { + get { return _isActive; } + set { _isActive = value; RaisePropertyChangedAuto(); } + } + + private bool _effectiveActive; + [XmlIgnore] + public bool EffectiveActive + { + get { return _effectiveActive; } + set + { + _effectiveActive = value; + RaisePropertyChangedAuto(); + IsActive = _effectiveActive; + } + } + + /// + /// Gets or sets the set command. + /// + [XmlIgnore] + public RelayCommand SetCommand { get; set; } + + [XmlIgnore] + public RelayCommand ToggleActiveCommand { get; set; } + /// /// Initializes a new instance of the class. /// @@ -78,6 +111,13 @@ namespace Tango.MachineStudio.Technician.TechItems Image = ResourceHelper.GetImageFromResources("Images/blower.png"); Color = Colors.White; HardwareBlower = new HardwareBlower(); + + SetCommand = new RelayCommand(() => { SetCommandClicked?.Invoke(this, _isActive); }); + + ToggleActiveCommand = new RelayCommand(() => + { + SetCommandClicked?.Invoke(this, _isActive); + }); } /// diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/ControllerItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/ControllerItem.cs index 8a9cba883..2d8763f74 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/ControllerItem.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/ControllerItem.cs @@ -6,6 +6,7 @@ using System.Threading.Tasks; using System.Windows.Media; using System.Xml.Serialization; using Tango.BL.Entities; +using Tango.Core.Commands; using Tango.SharedUI.Helpers; namespace Tango.MachineStudio.Technician.TechItems @@ -17,10 +18,7 @@ namespace Tango.MachineStudio.Technician.TechItems [TechItem(10)] public class ControllerItem : TechItem { - /// - /// Occurs when the controller value has changed. - /// - public event EventHandler ValueChanged; + public event EventHandler SetCommandClicked; private TechController _techController; /// @@ -56,7 +54,6 @@ namespace Tango.MachineStudio.Technician.TechItems set { _value = value; RaisePropertyChangedAuto(); - ValueChanged?.Invoke(this, _value); } } @@ -119,6 +116,12 @@ namespace Tango.MachineStudio.Technician.TechItems public bool IsSetToDefault { get; set; } + /// + /// Gets or sets the set command. + /// + [XmlIgnore] + public RelayCommand SetCommand { get; set; } + /// /// Initializes a new instance of the class. /// @@ -130,6 +133,8 @@ namespace Tango.MachineStudio.Technician.TechItems Color = Colors.DodgerBlue; LastUpdateTime = DateTime.Now; UpdateInterval = 10; + + SetCommand = new RelayCommand(() => { SetCommandClicked?.Invoke(this, new EventArgs()); }); } /// diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/HeaterItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/HeaterItem.cs index c1b876e9b..e91c3f185 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/HeaterItem.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/HeaterItem.cs @@ -35,6 +35,7 @@ namespace Tango.MachineStudio.Technician.TechItems /// /// Gets or sets the set command. /// + [XmlIgnore] public RelayCommand SetCommand { get; set; } /// 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 5f439e1ca..6a9725106 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 @@ -455,6 +455,15 @@ namespace Tango.MachineStudio.Technician.ViewModels heaterItem.HeaterState = heaterState; } } + else if (item.GetType() == typeof(BlowerItem)) + { + BlowerItem blowerItem = item as BlowerItem; + + if (data.Monitors.BlowerVoltage.Count > 0) + { + blowerItem.EffectiveActive = data.Monitors.BlowerVoltage.Last() > 0; + } + } else if (item.GetType() == typeof(ControllerItem)) { ControllerItem controllerItem = item as ControllerItem; @@ -635,7 +644,8 @@ namespace Tango.MachineStudio.Technician.ViewModels } else if (item is BlowerItem) { - CreateElement(bounds, Adapter.HardwareBlowerTypes.FirstOrDefault()); + var editor = CreateElement(bounds, Adapter.HardwareBlowerTypes.FirstOrDefault()); + InitBlowerItem(editor.BlowerItem); } else if (item is BreakSensorItem) { @@ -782,7 +792,8 @@ namespace Tango.MachineStudio.Technician.ViewModels else if (item is BlowerItem) { (item as BlowerItem).HardwareBlowerType = Adapter.HardwareBlowerTypes.FirstOrDefault(x => x.Guid == item.ItemGuid); - CreateElement(item); + var editor = CreateElement(item); + InitBlowerItem(editor.BlowerItem); } else if (item is BreakSensorItem) { @@ -915,6 +926,27 @@ namespace Tango.MachineStudio.Technician.ViewModels #region Init Tech Items + /// + /// Initializes the blower item. + /// + /// The blower item. + private void InitBlowerItem(BlowerItem item) + { + item.SetCommandClicked += async (_, isActive) => + { + try + { + CheckMachineOperator(); + await MachineOperator.SetBlowerState((PMR.Hardware.HardwareBlowerType)item.HardwareBlower.HardwareBlowerType.Code, isActive, item.HardwareBlower.Voltage); + } + catch (Exception ex) + { + LogManager.Log(ex, $"Error executing SetBlowerState command for blower {item.HardwareBlower.HardwareBlowerType.Name}."); + _eventLogger.Log(ex, $"Error executing SetBlowerState command for blower {item.HardwareBlower.HardwareBlowerType.Name}."); + } + }; + } + /// /// Initializes the tech heater. /// @@ -1377,7 +1409,7 @@ namespace Tango.MachineStudio.Technician.ViewModels /// The controller item. private void InitControllerItem(ControllerItem item) { - item.ValueChanged += async (x, value) => + item.SetCommandClicked += async (_, __) => { try { @@ -1385,7 +1417,7 @@ namespace Tango.MachineStudio.Technician.ViewModels await MachineOperator.SetComponentValue(new SetComponentValueRequest() { Component = (ValueComponent)item.TechController.Code, - Value = value + Value = item.Value }); } catch (Exception ex) diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphControl.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphControl.xaml index 33755f909..74ce549bf 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphControl.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphControl.xaml @@ -56,29 +56,29 @@ - + - + - - + + - - - + + + - - + + diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphMultiControl.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphMultiControl.xaml index 45b4aa9fb..c5ecf60d5 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphMultiControl.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphMultiControl.xaml @@ -56,29 +56,29 @@ - + - + - - + + - - - + + + - - + + diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Resources/MaterialDesign.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Resources/MaterialDesign.xaml index 6fcf6dd72..eea369dfe 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Resources/MaterialDesign.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Resources/MaterialDesign.xaml @@ -199,7 +199,7 @@ Silver - #FFE9E9E9 + #FF464646 Gray #03A9F4 @@ -222,18 +222,18 @@ - - + + - - + + - - + + @@ -302,7 +302,7 @@ - + @@ -484,7 +484,100 @@ + + + + diff --git a/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs b/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs index abeb1238b..d39842531 100644 --- a/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs +++ b/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs @@ -59,6 +59,7 @@ namespace Tango.Emulations.Emulators private bool _diagnostics_enabled; private bool _debug_logs_enabled; private bool _events_enabled; + private List _blower_states; #region Properties @@ -109,6 +110,7 @@ namespace Tango.Emulations.Emulators { EventsStates = MachineEventState.GetAllEventsStates(); + _blower_states = new List(); _heater_states = new List(); _continousResponseTokens = new List(); _motorJoggingRequestTypes = new List(); @@ -148,6 +150,14 @@ namespace Tango.Emulations.Emulators }); } + foreach (var item in adapter.HardwareBlowerTypes) + { + _blower_states.Add(new SetBlowerStateRequest() + { + BlowerType = (PMR.Hardware.HardwareBlowerType)item.Code, + }); + } + ResetGraphFactors(); } @@ -274,6 +284,9 @@ namespace Tango.Emulations.Emulators case MessageType.SetHeaterStateRequest: HandleSetHeaterStateRequest(MessageFactory.ParseTangoMessageFromContainer(container)); break; + case MessageType.SetBlowerStateRequest: + HandleSetBlowerStateRequest(MessageFactory.ParseTangoMessageFromContainer(container)); + break; } } @@ -331,7 +344,13 @@ namespace Tango.Emulations.Emulators { value++; monitors.Dancer1Angle.Add((int)(150 + _graphAmplitude * Math.Sin(2 * 3.14 * ((int)_graphFrequency) * value))); - monitors.BlowerVoltage.Add((int)(150 + _graphAmplitude * Math.Sin(2 * 3.14 * ((int)_graphFrequency) * value))); + } + + var blower_state = _blower_states.FirstOrDefault(); + + if (blower_state != null) + { + monitors.BlowerVoltage.Add(blower_state.IsActive ? blower_state.Voltage : 0); } monitors.Dancer2Angle.Add(Cursor.Position.Y); @@ -816,6 +835,19 @@ namespace Tango.Emulations.Emulators Transporter.SendResponse(new SetHeaterStateResponse(), request.Container.Token); } + private void HandleSetBlowerStateRequest(TangoMessage request) + { + var blower_state = _blower_states.FirstOrDefault(); + + if (blower_state != null) + { + blower_state.Voltage = request.Message.Voltage; + blower_state.IsActive = request.Message.IsActive; + } + + Transporter.SendResponse(new SetBlowerStateResponse(), request.Container.Token); + } + #endregion #region Public Methods diff --git a/Software/Visual_Studio/Tango.Integration/Operation/IMachineOperator.cs b/Software/Visual_Studio/Tango.Integration/Operation/IMachineOperator.cs index ba8d0e085..01de74f5d 100644 --- a/Software/Visual_Studio/Tango.Integration/Operation/IMachineOperator.cs +++ b/Software/Visual_Studio/Tango.Integration/Operation/IMachineOperator.cs @@ -273,6 +273,15 @@ namespace Tango.Integration.Operation /// Task SetHeaterState(HeaterType heater, double setPoint); + /// + /// Sets the state of the specified blower. + /// + /// The blower. + /// Blower on/off. + /// The voltage in millivolts. + /// + Task SetBlowerState(PMR.Hardware.HardwareBlowerType blower, bool isActive, double voltage); + /// /// Resolves the specified event type. /// diff --git a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs index ac264a8a4..01af2b3e3 100644 --- a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs +++ b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs @@ -1217,6 +1217,38 @@ namespace Tango.Integration.Operation return response; } + /// + /// Sets the state of the specified blower. + /// + /// The blower. + /// Blower on/off. + /// The voltage in millivolts. + /// + public async Task SetBlowerState(PMR.Hardware.HardwareBlowerType blower, bool isActive, double voltage) + { + SetBlowerStateResponse response = null; + SetBlowerStateRequest request = new SetBlowerStateRequest() + { + BlowerType = blower, + Voltage = voltage, + IsActive = isActive, + }; + + try + { + LogRequestSent(request); + response = await SendRequest(request); + LogResponseReceived(response); + } + catch (Exception ex) + { + LogRequestFailed(request, ex); + throw ex; + } + + return response; + } + /// /// Resolves the specified event type. /// diff --git a/Software/Visual_Studio/Tango.PMR/Common/MessageType.cs b/Software/Visual_Studio/Tango.PMR/Common/MessageType.cs index fbf6299d1..99697250d 100644 --- a/Software/Visual_Studio/Tango.PMR/Common/MessageType.cs +++ b/Software/Visual_Studio/Tango.PMR/Common/MessageType.cs @@ -22,7 +22,7 @@ namespace Tango.PMR.Common { static MessageTypeReflection() { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( - "ChFNZXNzYWdlVHlwZS5wcm90bxIQVGFuZ28uUE1SLkNvbW1vbirtJgoLTWVz", + "ChFNZXNzYWdlVHlwZS5wcm90bxIQVGFuZ28uUE1SLkNvbW1vbiqmJwoLTWVz", "c2FnZVR5cGUSCAoETm9uZRAAEhEKDUVycm9yUmVzcG9uc2UQARIUChBDYWxj", "dWxhdGVSZXF1ZXN0EAMSFQoRQ2FsY3VsYXRlUmVzcG9uc2UQBBITCg9Qcm9n", "cmVzc1JlcXVlc3QQBRIUChBQcm9ncmVzc1Jlc3BvbnNlEAYSHAoYU3R1YkNh", @@ -116,25 +116,26 @@ namespace Tango.PMR.Common { "Ch9TdGFydEV2ZW50c05vdGlmaWNhdGlvblJlc3BvbnNlEO8PEiIKHVN0b3BF", "dmVudHNOb3RpZmljYXRpb25SZXF1ZXN0EPAPEiMKHlN0b3BFdmVudHNOb3Rp", "ZmljYXRpb25SZXNwb25zZRDxDxIaChVTZXRIZWF0ZXJTdGF0ZVJlcXVlc3QQ", - "8g8SGwoWU2V0SGVhdGVyU3RhdGVSZXNwb25zZRDzDxIPCgpKb2JSZXF1ZXN0", - "ELgXEhAKC0pvYlJlc3BvbnNlELkXEhQKD0Fib3J0Sm9iUmVxdWVzdBC6FxIV", - "ChBBYm9ydEpvYlJlc3BvbnNlELsXEiMKHlVwbG9hZFByb2Nlc3NQYXJhbWV0", - "ZXJzUmVxdWVzdBC8FxIkCh9VcGxvYWRQcm9jZXNzUGFyYW1ldGVyc1Jlc3Bv", - "bnNlEL0XEhkKFFN0YXJ0RGVidWdMb2dSZXF1ZXN0EKAfEhoKFVN0YXJ0RGVi", - "dWdMb2dSZXNwb25zZRChHxIYChNTdG9wRGVidWdMb2dSZXF1ZXN0EKIfEhkK", - "FFN0b3BEZWJ1Z0xvZ1Jlc3BvbnNlEKMfEicKIlVwbG9hZEhhcmR3YXJlQ29u", - "ZmlndXJhdGlvblJlcXVlc3QQiCcSKAojVXBsb2FkSGFyZHdhcmVDb25maWd1", - "cmF0aW9uUmVzcG9uc2UQiScSFwoSU3lzdGVtUmVzZXRSZXF1ZXN0EIonEhgK", - "E1N5c3RlbVJlc2V0UmVzcG9uc2UQiycSFQoQS2VlcEFsaXZlUmVxdWVzdBDw", - "LhIWChFLZWVwQWxpdmVSZXNwb25zZRDxLhITCg5Db25uZWN0UmVxdWVzdBDy", - "LhIUCg9Db25uZWN0UmVzcG9uc2UQ8y4SFgoRRGlzY29ubmVjdFJlcXVlc3QQ", - "9C4SFwoSRGlzY29ubmVjdFJlc3BvbnNlEPUuEhYKEUZpbGVVcGxvYWRSZXF1", - "ZXN0ENg2EhcKEkZpbGVVcGxvYWRSZXNwb25zZRDZNhIbChZGaWxlQ2h1bmtV", - "cGxvYWRSZXF1ZXN0ENo2EhwKF0ZpbGVDaHVua1VwbG9hZFJlc3BvbnNlENs2", - "EhoKFUV4ZWN1dGVQcm9jZXNzUmVxdWVzdBDcNhIbChZFeGVjdXRlUHJvY2Vz", - "c1Jlc3BvbnNlEN02EhcKEktpbGxQcm9jZXNzUmVxdWVzdBDeNhIYChNLaWxs", - "UHJvY2Vzc1Jlc3BvbnNlEN82QhwKGmNvbS50d2luZS50YW5nby5wbXIuY29t", - "bW9uYgZwcm90bzM=")); + "8g8SGwoWU2V0SGVhdGVyU3RhdGVSZXNwb25zZRDzDxIaChVTZXRCbG93ZXJT", + "dGF0ZVJlcXVlc3QQ9A8SGwoWU2V0Qmxvd2VyU3RhdGVSZXNwb25zZRD1DxIP", + "CgpKb2JSZXF1ZXN0ELgXEhAKC0pvYlJlc3BvbnNlELkXEhQKD0Fib3J0Sm9i", + "UmVxdWVzdBC6FxIVChBBYm9ydEpvYlJlc3BvbnNlELsXEiMKHlVwbG9hZFBy", + "b2Nlc3NQYXJhbWV0ZXJzUmVxdWVzdBC8FxIkCh9VcGxvYWRQcm9jZXNzUGFy", + "YW1ldGVyc1Jlc3BvbnNlEL0XEhkKFFN0YXJ0RGVidWdMb2dSZXF1ZXN0EKAf", + "EhoKFVN0YXJ0RGVidWdMb2dSZXNwb25zZRChHxIYChNTdG9wRGVidWdMb2dS", + "ZXF1ZXN0EKIfEhkKFFN0b3BEZWJ1Z0xvZ1Jlc3BvbnNlEKMfEicKIlVwbG9h", + "ZEhhcmR3YXJlQ29uZmlndXJhdGlvblJlcXVlc3QQiCcSKAojVXBsb2FkSGFy", + "ZHdhcmVDb25maWd1cmF0aW9uUmVzcG9uc2UQiScSFwoSU3lzdGVtUmVzZXRS", + "ZXF1ZXN0EIonEhgKE1N5c3RlbVJlc2V0UmVzcG9uc2UQiycSFQoQS2VlcEFs", + "aXZlUmVxdWVzdBDwLhIWChFLZWVwQWxpdmVSZXNwb25zZRDxLhITCg5Db25u", + "ZWN0UmVxdWVzdBDyLhIUCg9Db25uZWN0UmVzcG9uc2UQ8y4SFgoRRGlzY29u", + "bmVjdFJlcXVlc3QQ9C4SFwoSRGlzY29ubmVjdFJlc3BvbnNlEPUuEhYKEUZp", + "bGVVcGxvYWRSZXF1ZXN0ENg2EhcKEkZpbGVVcGxvYWRSZXNwb25zZRDZNhIb", + "ChZGaWxlQ2h1bmtVcGxvYWRSZXF1ZXN0ENo2EhwKF0ZpbGVDaHVua1VwbG9h", + "ZFJlc3BvbnNlENs2EhoKFUV4ZWN1dGVQcm9jZXNzUmVxdWVzdBDcNhIbChZF", + "eGVjdXRlUHJvY2Vzc1Jlc3BvbnNlEN02EhcKEktpbGxQcm9jZXNzUmVxdWVz", + "dBDeNhIYChNLaWxsUHJvY2Vzc1Jlc3BvbnNlEN82QhwKGmNvbS50d2luZS50", + "YW5nby5wbXIuY29tbW9uYgZwcm90bzM=")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Tango.PMR.Common.MessageType), }, null)); @@ -302,6 +303,8 @@ namespace Tango.PMR.Common { [pbr::OriginalName("StopEventsNotificationResponse")] StopEventsNotificationResponse = 2033, [pbr::OriginalName("SetHeaterStateRequest")] SetHeaterStateRequest = 2034, [pbr::OriginalName("SetHeaterStateResponse")] SetHeaterStateResponse = 2035, + [pbr::OriginalName("SetBlowerStateRequest")] SetBlowerStateRequest = 2036, + [pbr::OriginalName("SetBlowerStateResponse")] SetBlowerStateResponse = 2037, /// ///Printing /// diff --git a/Software/Visual_Studio/Tango.PMR/Diagnostics/SetBlowerStateRequest.cs b/Software/Visual_Studio/Tango.PMR/Diagnostics/SetBlowerStateRequest.cs new file mode 100644 index 000000000..f0d22b881 --- /dev/null +++ b/Software/Visual_Studio/Tango.PMR/Diagnostics/SetBlowerStateRequest.cs @@ -0,0 +1,218 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: SetBlowerStateRequest.proto +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +namespace Tango.PMR.Diagnostics { + + /// Holder for reflection information generated from SetBlowerStateRequest.proto + public static partial class SetBlowerStateRequestReflection { + + #region Descriptor + /// File descriptor for SetBlowerStateRequest.proto + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static SetBlowerStateRequestReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "ChtTZXRCbG93ZXJTdGF0ZVJlcXVlc3QucHJvdG8SFVRhbmdvLlBNUi5EaWFn", + "bm9zdGljcxoYSGFyZHdhcmVCbG93ZXJUeXBlLnByb3RvInYKFVNldEJsb3dl", + "clN0YXRlUmVxdWVzdBI6CgpCbG93ZXJUeXBlGAEgASgOMiYuVGFuZ28uUE1S", + "LkhhcmR3YXJlLkhhcmR3YXJlQmxvd2VyVHlwZRIPCgdWb2x0YWdlGAIgASgB", + "EhAKCElzQWN0aXZlGAMgASgIQiEKH2NvbS50d2luZS50YW5nby5wbXIuZGlh", + "Z25vc3RpY3NiBnByb3RvMw==")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { global::Tango.PMR.Hardware.HardwareBlowerTypeReflection.Descriptor, }, + new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Diagnostics.SetBlowerStateRequest), global::Tango.PMR.Diagnostics.SetBlowerStateRequest.Parser, new[]{ "BlowerType", "Voltage", "IsActive" }, null, null, null) + })); + } + #endregion + + } + #region Messages + public sealed partial class SetBlowerStateRequest : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new SetBlowerStateRequest()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tango.PMR.Diagnostics.SetBlowerStateRequestReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public SetBlowerStateRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public SetBlowerStateRequest(SetBlowerStateRequest other) : this() { + blowerType_ = other.blowerType_; + voltage_ = other.voltage_; + isActive_ = other.isActive_; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public SetBlowerStateRequest Clone() { + return new SetBlowerStateRequest(this); + } + + /// Field number for the "BlowerType" field. + public const int BlowerTypeFieldNumber = 1; + private global::Tango.PMR.Hardware.HardwareBlowerType blowerType_ = 0; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Tango.PMR.Hardware.HardwareBlowerType BlowerType { + get { return blowerType_; } + set { + blowerType_ = value; + } + } + + /// Field number for the "Voltage" field. + public const int VoltageFieldNumber = 2; + private double voltage_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public double Voltage { + get { return voltage_; } + set { + voltage_ = value; + } + } + + /// Field number for the "IsActive" field. + public const int IsActiveFieldNumber = 3; + private bool isActive_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool IsActive { + get { return isActive_; } + set { + isActive_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as SetBlowerStateRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(SetBlowerStateRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (BlowerType != other.BlowerType) return false; + if (Voltage != other.Voltage) return false; + if (IsActive != other.IsActive) return false; + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (BlowerType != 0) hash ^= BlowerType.GetHashCode(); + if (Voltage != 0D) hash ^= Voltage.GetHashCode(); + if (IsActive != false) hash ^= IsActive.GetHashCode(); + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (BlowerType != 0) { + output.WriteRawTag(8); + output.WriteEnum((int) BlowerType); + } + if (Voltage != 0D) { + output.WriteRawTag(17); + output.WriteDouble(Voltage); + } + if (IsActive != false) { + output.WriteRawTag(24); + output.WriteBool(IsActive); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (BlowerType != 0) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) BlowerType); + } + if (Voltage != 0D) { + size += 1 + 8; + } + if (IsActive != false) { + size += 1 + 1; + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(SetBlowerStateRequest other) { + if (other == null) { + return; + } + if (other.BlowerType != 0) { + BlowerType = other.BlowerType; + } + if (other.Voltage != 0D) { + Voltage = other.Voltage; + } + if (other.IsActive != false) { + IsActive = other.IsActive; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + case 8: { + blowerType_ = (global::Tango.PMR.Hardware.HardwareBlowerType) input.ReadEnum(); + break; + } + case 17: { + Voltage = input.ReadDouble(); + break; + } + case 24: { + IsActive = input.ReadBool(); + break; + } + } + } + } + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/Software/Visual_Studio/Tango.PMR/Diagnostics/SetBlowerStateResponse.cs b/Software/Visual_Studio/Tango.PMR/Diagnostics/SetBlowerStateResponse.cs new file mode 100644 index 000000000..9c5670f07 --- /dev/null +++ b/Software/Visual_Studio/Tango.PMR/Diagnostics/SetBlowerStateResponse.cs @@ -0,0 +1,131 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: SetBlowerStateResponse.proto +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +namespace Tango.PMR.Diagnostics { + + /// Holder for reflection information generated from SetBlowerStateResponse.proto + public static partial class SetBlowerStateResponseReflection { + + #region Descriptor + /// File descriptor for SetBlowerStateResponse.proto + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static SetBlowerStateResponseReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "ChxTZXRCbG93ZXJTdGF0ZVJlc3BvbnNlLnByb3RvEhVUYW5nby5QTVIuRGlh", + "Z25vc3RpY3MiGAoWU2V0Qmxvd2VyU3RhdGVSZXNwb25zZUIhCh9jb20udHdp", + "bmUudGFuZ28ucG1yLmRpYWdub3N0aWNzYgZwcm90bzM=")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { }, + new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Diagnostics.SetBlowerStateResponse), global::Tango.PMR.Diagnostics.SetBlowerStateResponse.Parser, null, null, null, null) + })); + } + #endregion + + } + #region Messages + public sealed partial class SetBlowerStateResponse : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new SetBlowerStateResponse()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tango.PMR.Diagnostics.SetBlowerStateResponseReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public SetBlowerStateResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public SetBlowerStateResponse(SetBlowerStateResponse other) : this() { + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public SetBlowerStateResponse Clone() { + return new SetBlowerStateResponse(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as SetBlowerStateResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(SetBlowerStateResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(SetBlowerStateResponse other) { + if (other == null) { + return; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + } + } + } + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj b/Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj index c2480d8c0..06aebdb3e 100644 --- a/Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj +++ b/Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj @@ -99,6 +99,8 @@ + + -- cgit v1.3.1 From dee664eaeaf48edfa2ad2f90d6384d727dc35432 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Wed, 26 Sep 2018 14:35:47 +0300 Subject: Implemented Tech board tabs and project!!! --- Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 15400960 -> 15400960 bytes .../Build/Shortcuts/Machine Emulator.lnk | Bin 1471 -> 1455 bytes .../Build/Shortcuts/Proto Compiler GUI.lnk | Bin 1464 -> 1448 bytes .../Project/MachineTechViewProject.cs | 7 + .../Tango.MachineStudio.Technician.csproj | 9 +- .../ViewModels/MachineTechViewVM.cs | 154 ++++++++++++++++++++- .../Views/MachineTechTabView.xaml | 13 -- .../Views/MachineTechTabView.xaml.cs | 28 ---- .../Views/MachineTechView.xaml | 107 ++++++++++---- .../Controls/RealTimeGraphControl.xaml | 8 +- .../Controls/RealTimeGraphMultiControl.xaml | 8 +- .../Resources/MaterialDesign.xaml | 2 +- .../Notifications/TextInputBoxWindow.xaml.cs | 12 +- 14 files changed, 252 insertions(+), 96 deletions(-) delete mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechTabView.xaml delete mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechTabView.xaml.cs (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common') diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index 15b63d95f..b3f54005e 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 d14575ea3..e1545e683 100644 Binary files a/Software/DB/Tango_log.ldf and b/Software/DB/Tango_log.ldf differ diff --git a/Software/Visual_Studio/Build/Shortcuts/Machine Emulator.lnk b/Software/Visual_Studio/Build/Shortcuts/Machine Emulator.lnk index 72aadc5cf..bcc3c888a 100644 Binary files a/Software/Visual_Studio/Build/Shortcuts/Machine Emulator.lnk and b/Software/Visual_Studio/Build/Shortcuts/Machine Emulator.lnk differ diff --git a/Software/Visual_Studio/Build/Shortcuts/Proto Compiler GUI.lnk b/Software/Visual_Studio/Build/Shortcuts/Proto Compiler GUI.lnk index edc2f528f..8472e8003 100644 Binary files a/Software/Visual_Studio/Build/Shortcuts/Proto Compiler GUI.lnk and b/Software/Visual_Studio/Build/Shortcuts/Proto Compiler GUI.lnk differ diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Project/MachineTechViewProject.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Project/MachineTechViewProject.cs index 0837fde53..2e7ba6cf7 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Project/MachineTechViewProject.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Project/MachineTechViewProject.cs @@ -10,10 +10,17 @@ namespace Tango.MachineStudio.Technician.Project { public class MachineTechViewProject { + +#warning This is legacy and should be removed + public List Items { get; set; } + public List Tabs { get; set; } + public int SelectedTabIndex { get; set; } + public MachineTechViewProject() { + Items = new List(); Tabs = new List(); } 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 4df317c6a..38868a649 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 @@ -264,9 +264,6 @@ - - MachineTechTabView.xaml - MachineTechView.xaml @@ -442,10 +439,6 @@ Designer MSBuild:Compile - - Designer - MSBuild:Compile - MSBuild:Compile Designer @@ -667,7 +660,7 @@ - + \ No newline at end of file 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 85a431594..738e871c9 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 @@ -33,6 +33,7 @@ using Tango.MachineStudio.Common; using Tango.Core.Commands; using Tango.MachineStudio.Technician.Helpers; using Tango.MachineStudio.Technician.Models; +using Tango.Logging; namespace Tango.MachineStudio.Technician.ViewModels { @@ -88,7 +89,10 @@ namespace Tango.MachineStudio.Technician.ViewModels tab.IsSelected = false; } - _selectedTab.IsSelected = true; + if (_selectedTab != null) + { + _selectedTab.IsSelected = true; + } } } @@ -231,8 +235,30 @@ namespace Tango.MachineStudio.Technician.ViewModels /// public RelayCommand ResetHardwareConfigurationCommand { get; set; } + /// + /// Gets or sets the update graphs duration command. + /// public RelayCommand UpdateGraphsDurationCommand { get; set; } + /// + /// Gets or sets the add tab command. + /// + public RelayCommand AddTabCommand { get; set; } + + /// + /// Gets or sets the remove tab command. + /// + public RelayCommand RemoveTabCommand { get; set; } + + /// + /// Gets or sets the new project command. + /// + public RelayCommand NewProjectCommand { get; set; } + + /// + /// Gets or sets the rename tab command. + /// + public RelayCommand RenameTabCommand { get; set; } #endregion #region Constructors @@ -245,7 +271,7 @@ namespace Tango.MachineStudio.Technician.ViewModels public MachineTechViewVM(IStudioApplicationManager applicationManager, INotificationProvider notificationProvider, IDiagnosticsFrameProvider diagnosticsFrameProvider, IEventLogger eventLogger) { Tabs = new ObservableCollection(); - Tabs.Add(new MachineTechTabVM() { IsSelected = true }); + Tabs.Add(new MachineTechTabVM() { IsSelected = true, Name = "Untitled" }); SelectedTab = Tabs.First(); _settings = SettingsManager.Default.GetOrCreate(); @@ -298,6 +324,11 @@ namespace Tango.MachineStudio.Technician.ViewModels _settings.GraphsDuration = GraphsDurationSeconds; ClearAllGraphs(); }); + + AddTabCommand = new RelayCommand(() => AddNewTab()); + RemoveTabCommand = new RelayCommand(RemoveTab); + NewProjectCommand = new RelayCommand(CreateNewProject); + RenameTabCommand = new RelayCommand(RenameTab); } #endregion @@ -1544,7 +1575,7 @@ namespace Tango.MachineStudio.Technician.ViewModels #endregion - #region Public Methods + #region Project Management /// /// Opens a file open dialog to select a project file. @@ -1567,8 +1598,31 @@ namespace Tango.MachineStudio.Technician.ViewModels /// File path. public void OpenProjectFile(String fileName) { - LoadProject(MachineTechViewProject.Load(fileName)); - _lastTechProjectFile = fileName; + try + { + MachineTechViewProject project = null; + + project = MachineTechViewProject.Load(fileName); + + if (project.Tabs.Count == 0) + { + LogManager.Log($"Error loading project file {fileName}. Trying to load using legacy project loader.", LogCategory.Warning); + + MachineTechViewProjectTab tab = new MachineTechViewProjectTab(); + tab.Name = "Untitled"; + tab.Items.AddRange(project.Items); + project.Items.Clear(); + project.Tabs.Add(tab); + } + + LoadProject(project); + _lastTechProjectFile = fileName; + } + catch (Exception ex) + { + LogManager.Log(ex, $"Error loading project file {fileName}."); + _notification.ShowError("An error occurred while trying to load the tech board project file."); + } } /// @@ -1587,9 +1641,10 @@ namespace Tango.MachineStudio.Technician.ViewModels { MachineTechTabVM t = new MachineTechTabVM(); t.Name = tab.Name; - t.IsSelected = true; Tabs.Add(t); + SelectedTab = t; + foreach (var item in tab.Items) { if (item is MotorGroupItem) @@ -1600,6 +1655,8 @@ namespace Tango.MachineStudio.Technician.ViewModels AddTechItem(item); } } + + SelectedTab = Tabs.ElementAt(project.SelectedTabIndex); } } @@ -1654,6 +1711,7 @@ namespace Tango.MachineStudio.Technician.ViewModels private MachineTechViewProject GenerateProjectFile() { MachineTechViewProject project = new MachineTechViewProject(); + project.SelectedTabIndex = Tabs.IndexOf(SelectedTab); foreach (var tab in Tabs) { @@ -1678,6 +1736,90 @@ namespace Tango.MachineStudio.Technician.ViewModels return project; } + /// + /// Removes the specified tab. + /// + /// The tab. + private void RemoveTab(MachineTechTabVM tab) + { + if (_notification.ShowQuestion("Are you sure you want to delete the selected tab?")) + { + Tabs.Remove(tab); + SelectedTab = Tabs.LastOrDefault(); + + if (SelectedTab == null) + { + AddNewTab("Untitled"); + } + } + } + + /// + /// Adds a new tab. + /// + private bool AddNewTab(String name = null) + { + if (Tabs.Count > 7) + { + _notification.ShowError("Cannot exceed the maximum number of 8 tabs. You can remove a tab, or create a new project."); + return false; + } + + if (name == null) + { + name = _notification.ShowTextInput("Enter tab name", "Tab Name", "Untitled"); + } + + if (!String.IsNullOrWhiteSpace(name)) + { + MachineTechTabVM t = new MachineTechTabVM(); + t.Name = name; + Tabs.Add(t); + SelectedTab = t; + return true; + } + else + { + return false; + } + } + + /// + /// Creates a new project. + /// + private void CreateNewProject() + { + var to_remove = Tabs.ToList(); + + if (AddNewTab()) + { + _singleControllers.Clear(); + _multiControllers.Clear(); + + foreach (var tab in to_remove) + { + Tabs.Remove(tab); + } + } + } + + /// + /// Renames the tab. + /// + /// The tab. + private void RenameTab() + { + if (SelectedTab != null) + { + var name = _notification.ShowTextInput("Enter tab name", "Tab Name", SelectedTab.Name); + + if (!String.IsNullOrWhiteSpace(name)) + { + SelectedTab.Name = name; + } + } + } + #endregion #region IStudioModuleVM diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechTabView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechTabView.xaml deleted file mode 100644 index fc14343a2..000000000 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechTabView.xaml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechTabView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechTabView.xaml.cs deleted file mode 100644 index 38b1ae045..000000000 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechTabView.xaml.cs +++ /dev/null @@ -1,28 +0,0 @@ -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 MachineTechTabView.xaml - /// - public partial class MachineTechTabView : UserControl - { - public MachineTechTabView() - { - InitializeComponent(); - } - } -} 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 99ecf72f2..dec4cee44 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 @@ -134,6 +134,12 @@ + + + + + + @@ -152,58 +158,58 @@ - + - + - + - + - + - + - + - + - + - + @@ -355,28 +361,73 @@ - + - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - + diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphControl.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphControl.xaml index 74ce549bf..bf2e41afa 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphControl.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphControl.xaml @@ -56,13 +56,13 @@ - + - + @@ -72,8 +72,8 @@ diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphMultiControl.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphMultiControl.xaml index c5ecf60d5..4976739e4 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphMultiControl.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphMultiControl.xaml @@ -56,13 +56,13 @@ - + - + @@ -72,8 +72,8 @@ diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Resources/MaterialDesign.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Resources/MaterialDesign.xaml index eea369dfe..acddeec6e 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Resources/MaterialDesign.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Resources/MaterialDesign.xaml @@ -251,7 +251,7 @@ - + diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/TextInputBoxWindow.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/TextInputBoxWindow.xaml.cs index d774c14eb..bc11dfd18 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/TextInputBoxWindow.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/TextInputBoxWindow.xaml.cs @@ -26,6 +26,14 @@ namespace Tango.MachineStudio.UI.Notifications { InitializeComponent(); this.Loaded += TextInputBoxWindow_Loaded; + + ContentRendered += TextInputBoxWindow_ContentRendered; + } + + private void TextInputBoxWindow_ContentRendered(object sender, EventArgs e) + { + txtText.Focus(); + txtText.SelectAll(); } private void TextInputBoxWindow_Loaded(object sender, RoutedEventArgs e) @@ -34,12 +42,8 @@ namespace Tango.MachineStudio.UI.Notifications ani.To = 1; ani.Duration = TimeSpan.FromSeconds(0.5); this.BeginAnimation(Window.OpacityProperty, ani); - - txtText.Focus(); } - - public String Hint { get { return (String)GetValue(HintProperty); } -- cgit v1.3.1 From 438f517fd49d1bb10d08d8a279533e82eb67801a Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Tue, 2 Oct 2018 17:54:40 +0300 Subject: Working on RML module.. --- Software/DB/PPC/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/PPC/Tango_log.ldf | Bin 1048576 -> 1048576 bytes Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 15400960 -> 15400960 bytes Software/Graphics/thread_128px.png | Bin 0 -> 2191 bytes Software/Graphics/threads.png | Bin 0 -> 315399 bytes .../Tango.MachineStudio.ColorLab.csproj | 10 +- .../ViewModels/CalibrationDataViewVM.cs | 41 +++ .../ViewModels/MainViewVM.cs | 8 + .../Views/CalibrationDataView.xaml | 72 ++++++ .../Views/CalibrationDataView.xaml.cs | 28 +++ .../Views/MainView.xaml | 40 +-- .../Tango.MachineStudio.RML/Contracts/IMainView.cs | 20 ++ .../Images/thread_128px.png | Bin 0 -> 2191 bytes .../Tango.MachineStudio.RML/Images/threads.png | Bin 0 -> 315399 bytes .../Tango.MachineStudio.RML.csproj | 25 ++ .../ViewModels/MainViewVM.cs | 275 ++++++++++++++++++-- .../Tango.MachineStudio.RML/Views/MainView.xaml | 6 +- .../Tango.MachineStudio.RML/Views/MainView.xaml.cs | 11 +- .../Tango.MachineStudio.RML/Views/RmlView.xaml | 276 ++++++++++++++++++++- .../Tango.MachineStudio.RML/Views/RmlView.xaml.cs | 23 ++ .../Tango.MachineStudio.RML/Views/RmlsView.xaml | 53 +++- .../Tango.MachineStudio.RML/packages.config | 2 + .../Tango.MachineStudio.Common/StudioViewModel.cs | 5 +- .../Visual_Studio/Tango.BL/Builders/RmlBuilder.cs | 19 +- .../Tango.BL/Entities/LiquidTypesRml.cs | 22 ++ .../Tango.BL/EntitiesExtensions/LiquidTypesRml.cs | 22 ++ Software/Visual_Studio/Tango.BL/Tango.BL.csproj | 3 +- .../Tango.DAL.Remote/DB/LIQUID_TYPES_RMLS.cs | 1 + .../Tango.DAL.Remote/DB/RemoteADO.edmx | 3 + .../Tango.DAL.Remote/DB/RemoteADO.edmx.diagram | 150 +++++------ Software/Visual_Studio/Tango.SharedUI/IView.cs | 5 +- 32 files changed, 968 insertions(+), 152 deletions(-) create mode 100644 Software/Graphics/thread_128px.png create mode 100644 Software/Graphics/threads.png create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/CalibrationDataViewVM.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Views/CalibrationDataView.xaml create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Views/CalibrationDataView.xaml.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Contracts/IMainView.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Images/thread_128px.png create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Images/threads.png create mode 100644 Software/Visual_Studio/Tango.BL/EntitiesExtensions/LiquidTypesRml.cs (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common') diff --git a/Software/DB/PPC/Tango.mdf b/Software/DB/PPC/Tango.mdf index 0a107bfca..cea4bce53 100644 Binary files a/Software/DB/PPC/Tango.mdf and b/Software/DB/PPC/Tango.mdf differ diff --git a/Software/DB/PPC/Tango_log.ldf b/Software/DB/PPC/Tango_log.ldf index 44f24cfff..81d900e41 100644 Binary files a/Software/DB/PPC/Tango_log.ldf and b/Software/DB/PPC/Tango_log.ldf differ diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index fdf00e2cd..51ca79c83 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 62a4048b7..b6b95993f 100644 Binary files a/Software/DB/Tango_log.ldf and b/Software/DB/Tango_log.ldf differ diff --git a/Software/Graphics/thread_128px.png b/Software/Graphics/thread_128px.png new file mode 100644 index 000000000..36533fbeb Binary files /dev/null and b/Software/Graphics/thread_128px.png differ diff --git a/Software/Graphics/threads.png b/Software/Graphics/threads.png new file mode 100644 index 000000000..86eb0b335 Binary files /dev/null and b/Software/Graphics/threads.png differ diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Tango.MachineStudio.ColorLab.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Tango.MachineStudio.ColorLab.csproj index 7e8a9e126..18d51aa09 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Tango.MachineStudio.ColorLab.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Tango.MachineStudio.ColorLab.csproj @@ -74,10 +74,14 @@ + + + CalibrationDataView.xaml + MainView.xaml @@ -157,6 +161,10 @@ + + Designer + MSBuild:Compile + Designer MSBuild:Compile @@ -179,7 +187,7 @@ - + \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/CalibrationDataViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/CalibrationDataViewVM.cs new file mode 100644 index 000000000..c9c83dde0 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/CalibrationDataViewVM.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.MachineStudio.Common; +using Tango.SharedUI; + +namespace Tango.MachineStudio.ColorLab.ViewModels +{ + public class CalibrationDataViewVM : ViewModel + { + private ObservableCollection _liquidsCalibrationData; + /// + /// Gets or sets the liquids calibration data. + /// + public ObservableCollection LiquidsCalibrationData + { + get { return _liquidsCalibrationData; } + set { _liquidsCalibrationData = value; RaisePropertyChangedAuto(); } + } + + /// + /// Initializes a new instance of the class. + /// + public CalibrationDataViewVM() + { + LiquidsCalibrationData = new ObservableCollection(); + } + + /// + /// Initializes a new instance of the class. + /// + /// The liquids calibration data. + public CalibrationDataViewVM(ObservableCollection liquidsCalibrationData) + { + LiquidsCalibrationData = liquidsCalibrationData; + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/MainViewVM.cs index 02f496b1f..d0fa80a20 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/MainViewVM.cs @@ -150,6 +150,13 @@ namespace Tango.MachineStudio.ColorLab.ViewModels set { _liquidsCalibrationData = value; RaisePropertyChangedAuto(); } } + private CalibrationDataViewVM _calibrationDataViewVM; + public CalibrationDataViewVM CalibrationDataViewVM + { + get { return _calibrationDataViewVM; } + set { _calibrationDataViewVM = value; RaisePropertyChangedAuto(); } + } + private RgbVM _sourceColor; /// /// Gets or sets the color of the source. @@ -566,6 +573,7 @@ namespace Tango.MachineStudio.ColorLab.ViewModels //RmlProcessParametersTableGroup = SelectedRML.ProcessParametersTablesGroups.ToList().SingleOrDefault(x => x.Active); LiquidsCalibrationData = new ObservableCollection(); + CalibrationDataViewVM = new CalibrationDataViewVM(LiquidsCalibrationData); LiquidsCalibrationData.EnableCrossThreadOperations(); foreach (var idsPack in SelectedMachine.Configuration.NoneEmptyIdsPacks.OrderBy(x => x.PackIndex)) diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Views/CalibrationDataView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Views/CalibrationDataView.xaml new file mode 100644 index 000000000..28279bd50 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Views/CalibrationDataView.xaml @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Views/CalibrationDataView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Views/CalibrationDataView.xaml.cs new file mode 100644 index 000000000..26100f16d --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Views/CalibrationDataView.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.ColorLab.Views +{ + /// + /// Interaction logic for CalibrationDataView.xaml + /// + public partial class CalibrationDataView : UserControl + { + public CalibrationDataView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Views/MainView.xaml index 78eaf04e8..4e8703a6e 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Views/MainView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Views/MainView.xaml @@ -360,44 +360,8 @@ CALIBRATION DATA - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Contracts/IMainView.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Contracts/IMainView.cs new file mode 100644 index 000000000..7431f1ef1 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Contracts/IMainView.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.SharedUI; + +namespace Tango.MachineStudio.RML.Contracts +{ + public enum RmlNavigationView + { + RmlsView, + RmlView, + } + + public interface IMainView : IView + { + void NavigateTo(RmlNavigationView view); + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Images/thread_128px.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Images/thread_128px.png new file mode 100644 index 000000000..36533fbeb Binary files /dev/null and b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Images/thread_128px.png differ diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Images/threads.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Images/threads.png new file mode 100644 index 000000000..86eb0b335 Binary files /dev/null and b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Images/threads.png differ diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Tango.MachineStudio.RML.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Tango.MachineStudio.RML.csproj index fcd933f4b..99b0a3c19 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Tango.MachineStudio.RML.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Tango.MachineStudio.RML.csproj @@ -37,12 +37,18 @@ ..\..\..\packages\EntityFramework.6.0.0\lib\net45\EntityFramework.SqlServer.dll + + ..\..\..\packages\Google.Protobuf.3.4.1\lib\net45\Google.Protobuf.dll + ..\..\..\packages\MahApps.Metro.1.5.0\lib\net45\MahApps.Metro.dll ..\..\..\packages\MaterialDesignColors.1.1.2\lib\net45\MaterialDesignColors.dll + + ..\..\..\packages\MaterialDesignThemes.2.3.1.953\lib\net45\MaterialDesignThemes.Wpf.dll + @@ -66,6 +72,7 @@ GlobalVersionInfo.cs + Code @@ -119,10 +126,18 @@ {ca87a608-7b17-4c98-88f2-42abee10f4c1} Tango.Documents + + {b112d89a-a106-41ae-a0c1-4abc84c477f5} + Tango.DragAndDrop + {bc932dbd-7cdb-488c-99e4-f02cf441f55e} Tango.Logging + + {e4927038-348d-4295-aaf4-861c58cb3943} + Tango.PMR + {d8f1ad85-526a-4f50-b6dc-d437af63d8d8} Tango.Settings @@ -135,6 +150,10 @@ {cb0b0aa2-bb24-4bca-a720-45e397684e12} Tango.MachineStudio.Common + + {4d183aca-552b-4135-ae81-7c5a8e5fc3b1} + Tango.MachineStudio.ColorLab + @@ -153,5 +172,11 @@ MSBuild:Compile + + + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs index 9e108d0a8..b7e7859ac 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs @@ -1,18 +1,23 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.ComponentModel; using System.Linq; using System.Text; using System.Threading.Tasks; +using System.Windows.Data; using Tango.BL; using Tango.BL.Builders; using Tango.BL.Entities; +using Tango.Core.Commands; +using Tango.MachineStudio.ColorLab.ViewModels; using Tango.MachineStudio.Common; using Tango.MachineStudio.Common.Notifications; +using Tango.MachineStudio.RML.Contracts; namespace Tango.MachineStudio.RML.ViewModels { - public class MainViewVM : StudioViewModel + public class MainViewVM : StudioViewModel { private INotificationProvider _notification; @@ -26,11 +31,60 @@ namespace Tango.MachineStudio.RML.ViewModels set { _rmls = value; RaisePropertyChangedAuto(); } } + private ObservableCollection _materials; + public ObservableCollection Materials + { + get { return _materials; } + set { _materials = value; RaisePropertyChangedAuto(); } + } + + private ObservableCollection _colors; + public ObservableCollection Colors + { + get { return _colors; } + set { _colors = value; RaisePropertyChangedAuto(); } + } + + private ObservableCollection _purposes; + public ObservableCollection Purposes + { + get { return _purposes; } + set { _purposes = value; RaisePropertyChangedAuto(); } + } + + private ObservableCollection _conditions; + public ObservableCollection Conditions + { + get { return _conditions; } + set { _conditions = value; RaisePropertyChangedAuto(); } + } + + private ObservableCollection _linearMassDensityUnits; + public ObservableCollection LinearMassDensityUnits + { + get { return _linearMassDensityUnits; } + set { _linearMassDensityUnits = value; RaisePropertyChangedAuto(); } + } + + private ObservableCollection _fiberShapes; + public ObservableCollection FiberShapes + { + get { return _fiberShapes; } + set { _fiberShapes = value; RaisePropertyChangedAuto(); } + } + + private ObservableCollection _fiberSynths; + public ObservableCollection FiberSynths + { + get { return _fiberSynths; } + set { _fiberSynths = value; RaisePropertyChangedAuto(); } + } + private Rml _selectedRML; public Rml SelectedRML { get { return _selectedRML; } - set { _selectedRML = value; RaisePropertyChangedAuto(); OnSelectedRmlChanged(); } + set { _selectedRML = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); } } private Rml _activeRML; @@ -40,9 +94,65 @@ namespace Tango.MachineStudio.RML.ViewModels set { _activeRML = value; RaisePropertyChangedAuto(); } } + private CalibrationDataViewVM _calibrationDataViewVM; + public CalibrationDataViewVM CalibrationDataViewVM + { + get { return _calibrationDataViewVM; } + set { _calibrationDataViewVM = value; RaisePropertyChangedAuto(); } + } + + private ObservableCollection _liquidTypesRmls; + public ObservableCollection LiquidTypesRmls + { + get { return _liquidTypesRmls; } + set { _liquidTypesRmls = value; RaisePropertyChangedAuto(); } + } + + private ProcessParametersTablesGroup _activeProcessParametersGroup; + public ProcessParametersTablesGroup ActiveProcessParametersGroup + { + get { return _activeProcessParametersGroup; } + set { _activeProcessParametersGroup = value; RaisePropertyChangedAuto(); } + } + + private ICollectionView _activeProcessParametersTableView; + public ICollectionView ActiveProcessParametersTableView + { + get { return _activeProcessParametersTableView; } + set { _activeProcessParametersTableView = value; RaisePropertyChangedAuto(); } + } + + + /// + /// Gets or sets the manage RML command. + /// + public RelayCommand ManageRmlCommand { get; set; } + + /// + /// Gets or sets the add RML command. + /// + public RelayCommand AddRmlCommand { get; set; } + + /// + /// Gets or sets the remove RML command. + /// + public RelayCommand RemoveRmlCommand { get; set; } + + public RelayCommand AddProcessParametersTableCommand { get; set; } + + /// + /// Gets or sets the back to RMLS command. + /// + public RelayCommand BackToRmlsCommand { get; set; } + public MainViewVM(INotificationProvider notificationProvider) { _notification = notificationProvider; + ManageRmlCommand = new RelayCommand(() => LoadActiveRML(SelectedRML.Guid), () => SelectedRML != null); + RemoveRmlCommand = new RelayCommand(RemoveSelectedRml); + AddRmlCommand = new RelayCommand(AddNewRml); + BackToRmlsCommand = new RelayCommand(BackToRmls); + AddProcessParametersTableCommand = new RelayCommand(AddProcessParametersTable); } public override void OnApplicationReady() @@ -52,36 +162,21 @@ namespace Tango.MachineStudio.RML.ViewModels private async void LoadRmls() { - //using (_rmls_context = ObservablesContext.CreateDefault()) - //{ - // await Task.Factory.StartNew(() => - // { - // Rmls = _rmls.ToList().ToObservableCollection(); - // }); - //} - } - - private void OnSelectedRmlChanged() - { - if (SelectedRML != null) - { - LoadActiveRML(SelectedRML.Guid); - } - else + using (_rmls_context = ObservablesContext.CreateDefault()) { - UnloadActiveRML(); + await Task.Factory.StartNew(() => + { + Rmls = _rmls_context.Rmls.ToList().ToObservableCollection(); + }); } } - private void UnloadActiveRML() - { - ActiveRML = null; - } - private async void LoadActiveRML(String guid) { using (_notification.PushTaskItem("Loading RML...")) { + IsFree = false; + if (_active_context != null) { _active_context.Dispose(); @@ -89,12 +184,142 @@ namespace Tango.MachineStudio.RML.ViewModels _active_context = ObservablesContext.CreateDefault(); + LoadRmlProperties(); + ActiveRML = await new RmlBuilder(_active_context) .Set(guid) - .WithAllParametersGroup() + .WithActiveParametersGroup() .WithLiquidFactors() + .WithMediaProperties() .BuildAsync(); + + ActiveProcessParametersGroup = ActiveRML.ProcessParametersTablesGroups.ToList().FirstOrDefault(); + ActiveProcessParametersTableView = CollectionViewSource.GetDefaultView(ActiveProcessParametersGroup.ProcessParametersTables); + ActiveProcessParametersTableView.SortDescriptions.Add(new SortDescription(nameof(ProcessParametersTable.TableIndex), ListSortDirection.Ascending)); + + CalibrationDataViewVM = new CalibrationDataViewVM(); + LiquidTypesRmls = ActiveRML.LiquidTypesRmls; + + foreach (var liquidTypeRml in LiquidTypesRmls) + { + CalibrationDataVM catVM = new CalibrationDataVM(); + catVM.Name = liquidTypeRml.LiquidType.Name; + catVM.Color = liquidTypeRml.LiquidType.Color; + + if (liquidTypeRml.DefaultCatData != null) + { + catVM.CalibrationPoints = liquidTypeRml.GetCalibrationData().CalibrationPoints.Select(x => new CalibrationDataPointVM(x.X, x.Y)).ToObservableCollection(); + } + + CalibrationDataViewVM.LiquidsCalibrationData.Add(catVM); + } + + + View.NavigateTo(RmlNavigationView.RmlView); + + IsFree = true; } } + + private void LoadRmlProperties() + { + Materials = _active_context.MediaMaterials.ToObservableCollection(); + Colors = _active_context.MediaColors.ToObservableCollection(); + Purposes = _active_context.MediaPurposes.ToObservableCollection(); + Conditions = _active_context.MediaConditions.ToObservableCollection(); + LinearMassDensityUnits = _active_context.LinearMassDensityUnits.ToObservableCollection(); + FiberShapes = _active_context.FiberShapes.ToObservableCollection(); + FiberSynths = _active_context.FiberSynths.ToObservableCollection(); + } + + private async void AddNewRml() + { + var name = _notification.ShowTextInput("Please enter RML name", "Name"); + + if (!String.IsNullOrWhiteSpace(name)) + { + if (Rmls.ToList().Exists(x => x.Name == name)) + { + _notification.ShowError("The specified RML name already exists. Please select a different name."); + return; + } + + using (_notification.PushTaskItem("Creating new RML...")) + { + IsFree = false; + + if (_active_context != null) + { + _active_context.Dispose(); + } + + LoadRmlProperties(); + + Rml rml = new Rml(); + rml.Name = name; + rml.Manufacturer = "Twine"; + rml.Code = Rmls.Max(x => x.Code) + 1; + rml.MediaMaterial = Materials.FirstOrDefault(); + rml.MediaColor = Colors.FirstOrDefault(); + rml.MediaPurpose = Purposes.FirstOrDefault(); + rml.MediaCondition = Conditions.FirstOrDefault(); + rml.LinearMassDensityUnit = LinearMassDensityUnits.FirstOrDefault(); + rml.FiberShape = FiberShapes.FirstOrDefault(); + rml.FiberSynth = FiberSynths.FirstOrDefault(); + _active_context.Rmls.Add(rml); + await _active_context.SaveChangesAsync(); + LoadActiveRML(rml.Guid); + + IsFree = true; + } + } + } + + private void RemoveSelectedRml() + { + + } + + private void AddProcessParametersTable() + { + var name = _notification.ShowTextInput("Enter table name", "Name"); + + if (!String.IsNullOrWhiteSpace(name)) + { + _active_context.ProcessParametersTables.Add(new ProcessParametersTable() + { + ProcessParametersTablesGroup = ActiveProcessParametersGroup, + Name = name, + TableIndex = ActiveProcessParametersGroup.ProcessParametersTables.Max(x => x.TableIndex) + 1, + }); + } + } + + public void OnProcessParametersTableDropped(ProcessParametersTable dragged, ProcessParametersTable dropped) + { + if (dragged.TableIndex > dropped.TableIndex) + { + dragged.TableIndex = dropped.TableIndex - 1; + } + else + { + dragged.TableIndex = dropped.TableIndex + 1; + } + + int index = 0; + + foreach (var table in ActiveProcessParametersGroup.ProcessParametersTables.OrderBy(x => x.TableIndex)) + { + table.TableIndex = index++; + } + + ActiveProcessParametersTableView.Refresh(); + } + + private void BackToRmls() + { + View.NavigateTo(RmlNavigationView.RmlsView); + LoadRmls(); + } } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/MainView.xaml index bdd36af7a..ab5207722 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/MainView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/MainView.xaml @@ -5,10 +5,14 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:global="clr-namespace:Tango.MachineStudio.RML" xmlns:vm="clr-namespace:Tango.MachineStudio.RML.ViewModels" + xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" xmlns:local="clr-namespace:Tango.MachineStudio.RML.Views" mc:Ignorable="d" d:DesignHeight="1080" d:DesignWidth="1920" Background="Transparent" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}"> - + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/MainView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/MainView.xaml.cs index 0fdcd11b8..20ff4c076 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/MainView.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/MainView.xaml.cs @@ -12,17 +12,26 @@ using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; +using Tango.Core.DI; +using Tango.MachineStudio.RML.Contracts; +using Tango.SharedUI; namespace Tango.MachineStudio.RML.Views { /// /// Interaction logic for MainView.xaml /// - public partial class MainView : UserControl + public partial class MainView : UserControl, IMainView { public MainView() { InitializeComponent(); + TangoIOC.Default.Register(this); + } + + public void NavigateTo(RmlNavigationView view) + { + navigationControl.NavigateTo(view.ToString()); } } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlView.xaml index 92b8506f5..e77663de4 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlView.xaml @@ -4,11 +4,283 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:global="clr-namespace:Tango.MachineStudio.RML" + xmlns:observables="clr-namespace:Tango.BL.Entities;assembly=Tango.BL" + xmlns:shapes="clr-namespace:Tango.SharedUI.Shapes;assembly=Tango.SharedUI" + xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" + xmlns:editors="clr-namespace:Tango.SharedUI.Editors;assembly=Tango.SharedUI" + xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls" + xmlns:colorLabViews="clr-namespace:Tango.MachineStudio.ColorLab.Views;assembly=Tango.MachineStudio.ColorLab" + xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" + xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" + xmlns:dragAndDrop="clr-namespace:Tango.DragAndDrop;assembly=Tango.DragAndDrop" xmlns:vm="clr-namespace:Tango.MachineStudio.RML.ViewModels" xmlns:local="clr-namespace:Tango.MachineStudio.RML.Views" mc:Ignorable="d" d:DesignHeight="1080" d:DesignWidth="1920" Background="Transparent" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}"> - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + PROPERTIES + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ACTIVE PROCESS GROUP + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LIQUID FACTORS + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CALIBRATION DATA + + + + + + + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlView.xaml.cs index e01654243..c1bc9ad4a 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlView.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlView.xaml.cs @@ -12,6 +12,9 @@ using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; +using Tango.BL.Entities; +using Tango.DragAndDrop; +using Tango.MachineStudio.RML.ViewModels; namespace Tango.MachineStudio.RML.Views { @@ -20,9 +23,29 @@ namespace Tango.MachineStudio.RML.Views /// public partial class RmlView : UserControl { + private MainViewVM _vm; + + public DraggingSurface DraggingSurface + { + get { return (DraggingSurface)GetValue(DraggingSurfaceProperty); } + set { SetValue(DraggingSurfaceProperty, value); } + } + public static readonly DependencyProperty DraggingSurfaceProperty = + DependencyProperty.Register("DraggingSurface", typeof(DraggingSurface), typeof(RmlView), new PropertyMetadata(null)); + + public RmlView() { InitializeComponent(); + DraggingSurface = draggingSurface; + Loaded += (_, __) => { _vm = DataContext as MainViewVM; }; + } + + private void OnProcessTableDropped(object sender, DropEventArgs e) + { + ProcessParametersTable dragged = e.Draggable.DataContext as ProcessParametersTable; + ProcessParametersTable dropped = e.Droppable.DataContext as ProcessParametersTable; + _vm.OnProcessParametersTableDropped(dragged, dropped); } } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlsView.xaml index 2ba5e44c9..b597c1dd2 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlsView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlsView.xaml @@ -5,10 +5,61 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:global="clr-namespace:Tango.MachineStudio.RML" xmlns:vm="clr-namespace:Tango.MachineStudio.RML.ViewModels" + xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" + xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" xmlns:local="clr-namespace:Tango.MachineStudio.RML.Views" mc:Ignorable="d" d:DesignHeight="1080" d:DesignWidth="1920" Background="Transparent" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}"> + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/packages.config b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/packages.config index efdb0fb1c..d8e0c7e97 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/packages.config +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/packages.config @@ -1,6 +1,8 @@  + + \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioViewModel.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioViewModel.cs index 63ff2119a..9ce79703f 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioViewModel.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioViewModel.cs @@ -109,7 +109,10 @@ namespace Tango.MachineStudio.Common /// Called when the view has been attached /// /// The view. - protected abstract void OnViewAttached(TView view); + protected virtual void OnViewAttached(TView view) + { + //Do Nothing. + } } } diff --git a/Software/Visual_Studio/Tango.BL/Builders/RmlBuilder.cs b/Software/Visual_Studio/Tango.BL/Builders/RmlBuilder.cs index 3d288e470..8eab66c85 100644 --- a/Software/Visual_Studio/Tango.BL/Builders/RmlBuilder.cs +++ b/Software/Visual_Studio/Tango.BL/Builders/RmlBuilder.cs @@ -33,7 +33,8 @@ namespace Tango.BL.Builders { return AddStep(2, () => { - Context.ProcessParametersTablesGroups.Where(x => x.RmlGuid == Entity.Guid && x.Active).Include(x => x.ProcessParametersTables).FirstOrDefault(); + var group = Context.ProcessParametersTablesGroups.Where(x => x.RmlGuid == Entity.Guid && x.Active).FirstOrDefault(); + Context.ProcessParametersTables.Where(x => x.ProcessParametersTablesGroupGuid == group.Guid).OrderBy(x => x.TableIndex).ToList(); }); } @@ -57,7 +58,21 @@ namespace Tango.BL.Builders { return AddStep(5, () => { - Context.LiquidTypesRmls.Where(x => x.RmlGuid == Entity.Guid).ToList(); + Context.LiquidTypesRmls.Where(x => x.RmlGuid == Entity.Guid).Include(x => x.LiquidType).ToList(); + }); + } + + public virtual RmlBuilder WithMediaProperties() + { + return AddStep(6, () => + { + Context.MediaMaterials.SingleOrDefault(x => x.Guid == Entity.MediaMaterialGuid); + Context.MediaColors.SingleOrDefault(x => x.Guid == Entity.MediaColorGuid); + Context.MediaPurposes.SingleOrDefault(x => x.Guid == Entity.MediaPurposeGuid); + Context.MediaConditions.SingleOrDefault(x => x.Guid == Entity.MediaConditionGuid); + Context.LinearMassDensityUnits.SingleOrDefault(x => x.Guid == Entity.LinearMassDensityUnitGuid); + Context.FiberShapes.SingleOrDefault(x => x.Guid == Entity.FiberShapeGuid); + Context.FiberSynths.SingleOrDefault(x => x.Guid == Entity.FiberSynthGuid); }); } } diff --git a/Software/Visual_Studio/Tango.BL/Entities/LiquidTypesRml.cs b/Software/Visual_Studio/Tango.BL/Entities/LiquidTypesRml.cs index 2464111da..e6ad7b573 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/LiquidTypesRml.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/LiquidTypesRml.cs @@ -93,6 +93,28 @@ namespace Tango.BL.Entities } + protected Byte[] _defaultcatdata; + + /// + /// Gets or sets the liquidtypesrml default cat data. + /// + + [Column("DEFAULT_CAT_DATA")] + + public Byte[] DefaultCatData + { + get + { + return _defaultcatdata; + } + + set + { + _defaultcatdata = value; RaisePropertyChanged(nameof(DefaultCatData)); + } + + } + protected LiquidType _liquidtype; /// diff --git a/Software/Visual_Studio/Tango.BL/EntitiesExtensions/LiquidTypesRml.cs b/Software/Visual_Studio/Tango.BL/EntitiesExtensions/LiquidTypesRml.cs new file mode 100644 index 000000000..c4ccb4ab6 --- /dev/null +++ b/Software/Visual_Studio/Tango.BL/EntitiesExtensions/LiquidTypesRml.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.PMR.ColorLab; + +namespace Tango.BL.Entities +{ + public partial class LiquidTypesRml + { + public CalibrationData GetCalibrationData() + { + return CalibrationData.Parser.ParseFrom(DefaultCatData); + } + + public void PutCalibrationData(CalibrationData data) + { + DefaultCatData = data.ToBytes(); + } + } +} diff --git a/Software/Visual_Studio/Tango.BL/Tango.BL.csproj b/Software/Visual_Studio/Tango.BL/Tango.BL.csproj index 932a0279f..c2d368160 100644 --- a/Software/Visual_Studio/Tango.BL/Tango.BL.csproj +++ b/Software/Visual_Studio/Tango.BL/Tango.BL.csproj @@ -111,6 +111,7 @@ + @@ -335,7 +336,7 @@ - + \ No newline at end of file diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/LIQUID_TYPES_RMLS.cs b/Software/Visual_Studio/Tango.DAL.Remote/DB/LIQUID_TYPES_RMLS.cs index 782f70d6c..dd0425502 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/LIQUID_TYPES_RMLS.cs +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/LIQUID_TYPES_RMLS.cs @@ -20,6 +20,7 @@ namespace Tango.DAL.Remote.DB public string LIQUID_TYPE_GUID { get; set; } public string RML_GUID { get; set; } public double MAX_NL_PER_CM { get; set; } + public byte[] DEFAULT_CAT_DATA { get; set; } public virtual LIQUID_TYPES LIQUID_TYPES { get; set; } public virtual RML RML { get; set; } diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx index 1609463e7..307e09764 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx @@ -661,6 +661,7 @@ + @@ -3735,6 +3736,7 @@ + @@ -5993,6 +5995,7 @@ + diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram index 27afb3f0f..c55d6bcf2 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram @@ -5,81 +5,81 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/Tango.SharedUI/IView.cs b/Software/Visual_Studio/Tango.SharedUI/IView.cs index d26bb68f8..7f57c6121 100644 --- a/Software/Visual_Studio/Tango.SharedUI/IView.cs +++ b/Software/Visual_Studio/Tango.SharedUI/IView.cs @@ -11,9 +11,6 @@ namespace Tango.SharedUI /// public interface IView { - /// - /// Occurs when the view is loaded and view model is defined as data context. - /// - event EventHandler ViewAttached; + } } -- cgit v1.3.1