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. --- .../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 ++- 12 files changed, 440 insertions(+), 621 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Modules') 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) -- cgit v1.3.1 From 3e4bec71b356231134ccb1b52d8faf264c57c6a1 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Wed, 26 Sep 2018 11:07:32 +0300 Subject: Working on new tech module tabs. --- Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 15400960 -> 15400960 bytes .../Project/MachineTechViewProject.cs | 4 +- .../Project/MachineTechViewProjectTab.cs | 20 + .../Tango.MachineStudio.Technician.csproj | 9 + .../ViewModels/MachineTechTabVM.cs | 62 +++ .../ViewModels/MachineTechViewVM.cs | 84 ++-- .../Views/MachineTechTabView.xaml | 13 + .../Views/MachineTechTabView.xaml.cs | 28 ++ .../Views/MachineTechView.xaml | 435 ++++++++++++--------- .../Views/MachineTechView.xaml.cs | 10 +- .../Tango.Editors/ElementsEditor.xaml | 12 +- .../Tango.Editors/ElementsEditor.xaml.cs | 12 +- 13 files changed, 456 insertions(+), 233 deletions(-) create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Project/MachineTechViewProjectTab.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechTabVM.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechTabView.xaml create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechTabView.xaml.cs (limited to 'Software/Visual_Studio/MachineStudio/Modules') diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index a0ba6351e..15b63d95f 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 7d419821a..d14575ea3 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.Technician/Project/MachineTechViewProject.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Project/MachineTechViewProject.cs index 700e04f7d..0837fde53 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,11 +10,11 @@ namespace Tango.MachineStudio.Technician.Project { public class MachineTechViewProject { - public List Items { get; set; } + public List Tabs { get; set; } public MachineTechViewProject() { - Items = new List(); + Tabs = new List(); } public void Save(String fileName) diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Project/MachineTechViewProjectTab.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Project/MachineTechViewProjectTab.cs new file mode 100644 index 000000000..c86e1ae55 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Project/MachineTechViewProjectTab.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.MachineStudio.Technician.TechItems; + +namespace Tango.MachineStudio.Technician.Project +{ + public class MachineTechViewProjectTab + { + public String Name { get; set; } + public List Items { get; set; } + + public MachineTechViewProjectTab() + { + Items = 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 2c6a08554..4df317c6a 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 @@ -171,6 +171,7 @@ + HeaterTemplate.xaml @@ -261,7 +262,11 @@ + + + MachineTechTabView.xaml + MachineTechView.xaml @@ -437,6 +442,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + MSBuild:Compile Designer diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechTabVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechTabVM.cs new file mode 100644 index 000000000..4e04a078c --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechTabVM.cs @@ -0,0 +1,62 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Editors; +using Tango.SharedUI; + +namespace Tango.MachineStudio.Technician.ViewModels +{ + public class MachineTechTabVM : ViewModel + { + private ElementsEditor _editor; + + public ElementsEditor Editor + { + get { return _editor; } + set { _editor = value; RaisePropertyChangedAuto(); } + } + + private String _name; + /// + /// Gets or sets the name. + /// + public String Name + { + get { return _name; } + set { _name = value; RaisePropertyChangedAuto(); } + } + + private bool _isSelected; + /// + /// Gets or sets a value indicating whether this instance is selected. + /// + public bool IsSelected + { + get { return _isSelected; } + set { _isSelected = value; RaisePropertyChangedAuto(); } + } + + + private ObservableCollection _elements; + /// + /// Gets or sets the visual elements. + /// + public ObservableCollection Elements + { + get { return _elements; } + set { _elements = value; RaisePropertyChangedAuto(); } + } + + /// + /// Initializes a new instance of the class. + /// + public MachineTechTabVM() + { + Name = "untitled"; + Elements = new ObservableCollection(); + } + } +} 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 6a9725106..85a431594 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 @@ -61,14 +61,35 @@ namespace Tango.MachineStudio.Technician.ViewModels #region Properties - private ObservableCollection _elements; + private ObservableCollection _tabs; /// - /// Gets or sets the visual elements. + /// Gets or sets the elements tabs. /// - public ObservableCollection Elements + public ObservableCollection Tabs { - get { return _elements; } - set { _elements = value; RaisePropertyChangedAuto(); } + get { return _tabs; } + set { _tabs = value; RaisePropertyChangedAuto(); } + } + + private MachineTechTabVM _selectedTab; + /// + /// Gets or sets the selected tab. + /// + public MachineTechTabVM SelectedTab + { + get { return _selectedTab; } + set + { + _selectedTab = value; + RaisePropertyChangedAuto(); + + foreach (var tab in Tabs.Where(x => x != _selectedTab)) + { + tab.IsSelected = false; + } + + _selectedTab.IsSelected = true; + } } private ObservableCollection _availableTechItems; @@ -223,6 +244,10 @@ namespace Tango.MachineStudio.Technician.ViewModels /// The notification provider. public MachineTechViewVM(IStudioApplicationManager applicationManager, INotificationProvider notificationProvider, IDiagnosticsFrameProvider diagnosticsFrameProvider, IEventLogger eventLogger) { + Tabs = new ObservableCollection(); + Tabs.Add(new MachineTechTabVM() { IsSelected = true }); + SelectedTab = Tabs.First(); + _settings = SettingsManager.Default.GetOrCreate(); _single_graphs_recordings = new List>(); @@ -242,7 +267,6 @@ namespace Tango.MachineStudio.Technician.ViewModels ApplicationManager.ConnectedMachineChanged += ApplicationManager_ConnectedMachineChanged; Adapter = ObservablesStaticCollections.Instance; - Elements = new ObservableCollection(); OpenProjectCommand = new RelayCommand(OpenProject); SaveAsProjectCommand = new RelayCommand(SaveAsProject); @@ -325,7 +349,7 @@ namespace Tango.MachineStudio.Technician.ViewModels lock (_elementsLock) { - var elements = Elements.ToList(); + var elements = Tabs.SelectMany(x => x.Elements).ToList(); foreach (var item in elements.Select(x => x.HostedElement as TechItem)) { @@ -680,7 +704,7 @@ namespace Tango.MachineStudio.Technician.ViewModels { TechItem item = Activator.CreateInstance(typeof(Tech), new object[] { value }) as TechItem; IElementEditor editor = Activator.CreateInstance(typeof(Editor), new object[] { ((Tech)item), bounds }) as IElementEditor; - Elements.Add(editor); + SelectedTab.Elements.Add(editor); return (Editor)editor; } @@ -693,7 +717,7 @@ namespace Tango.MachineStudio.Technician.ViewModels private Editor CreateElement(TechItem item) where Editor : IElementEditor { IElementEditor editor = Activator.CreateInstance(typeof(Editor), new object[] { item, item.GetBounds() }) as IElementEditor; - Elements.Add(editor); + SelectedTab.Elements.Add(editor); return (Editor)editor; } @@ -1555,18 +1579,26 @@ namespace Tango.MachineStudio.Technician.ViewModels { using (_notification.PushTaskItem("Loading technician project file...")) { - Elements.Clear(); + Tabs.Clear(); _singleControllers.Clear(); _multiControllers.Clear(); - foreach (var item in project.Items) + foreach (var tab in project.Tabs) { - if (item is MotorGroupItem) + MachineTechTabVM t = new MachineTechTabVM(); + t.Name = tab.Name; + t.IsSelected = true; + Tabs.Add(t); + + foreach (var item in tab.Items) { - (item as MotorGroupItem).TechMotors = ObservablesStaticCollections.Instance.HardwareMotorTypes.Where(x => (item as MotorGroupItem).ItemsGuids.Contains(x.Guid)).ToObservableCollection(); - } + if (item is MotorGroupItem) + { + (item as MotorGroupItem).TechMotors = ObservablesStaticCollections.Instance.HardwareMotorTypes.Where(x => (item as MotorGroupItem).ItemsGuids.Contains(x.Guid)).ToObservableCollection(); + } - AddTechItem(item); + AddTechItem(item); + } } } } @@ -1623,16 +1655,24 @@ namespace Tango.MachineStudio.Technician.ViewModels { MachineTechViewProject project = new MachineTechViewProject(); - foreach (var element in Elements) + foreach (var tab in Tabs) { - if (element.HostedElement is MotorGroupItem) + MachineTechViewProjectTab pTab = new MachineTechViewProjectTab(); + pTab.Name = tab.Name; + + foreach (var element in tab.Elements) { - var group = element.HostedElement as MotorGroupItem; - group.ItemsGuids = group.TechMotors.Select(x => x.Guid).ToList(); + if (element.HostedElement is MotorGroupItem) + { + var group = element.HostedElement as MotorGroupItem; + group.ItemsGuids = group.TechMotors.Select(x => x.Guid).ToList(); + } + + (element.HostedElement as TechItem).SetBounds(element.GetBounds()); + pTab.Items.Add(element.HostedElement as TechItem); } - (element.HostedElement as TechItem).SetBounds(element.GetBounds()); - project.Items.Add(element.HostedElement as TechItem); + project.Tabs.Add(pTab); } return project; @@ -1673,7 +1713,7 @@ namespace Tango.MachineStudio.Technician.ViewModels private void SyncHardwareConfiguration() { - var elements = Elements.ToList(); + var elements = Tabs.SelectMany(x => x.Elements).ToList(); if (MachineOperator != null && MachineOperator.CurrentHardwareConfiguration != null) { 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 new file mode 100644 index 000000000..fc14343a2 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechTabView.xaml @@ -0,0 +1,13 @@ + + + + + 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 new file mode 100644 index 000000000..38b1ae045 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechTabView.xaml.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace Tango.MachineStudio.Technician.Views +{ + /// + /// Interaction logic for 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 ea833db99..99ecf72f2 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 @@ -22,6 +22,101 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -192,7 +287,7 @@ - + @@ -258,210 +353,160 @@ - - - - - + + + + + - + + + + + + + + + + + + + + + + + + - + - - - - + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + - - - - - - + + + + + + + + Left + + + + Top + + + - - - - - - - - Left - - - - Top - - - + + + + Width + + + + Height + + + - - - - Width - - - - Height - - - + + + + + + + Angle + + + + + + + - - - - - - - Angle - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml.cs index 977974f8a..694debd26 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml.cs @@ -32,8 +32,6 @@ namespace Tango.MachineStudio.Technician.Views { _vm = DataContext as MachineTechViewVM; }; - - (editor.UndoRedoStatesProvider as ElementsEditorUndoRedoStatesProvider).StateExecuted += MachineTechView_StateExecuted; } private void MachineTechView_StateExecuted(object sender, UndoRedoStateExecutedEventArgs e) @@ -61,5 +59,13 @@ namespace Tango.MachineStudio.Technician.Views { //editor.DeselectElements(); } + + private void Editor_Loaded(object sender, RoutedEventArgs e) + { + ElementsEditor editor = sender as ElementsEditor; + (editor.DataContext as MachineTechTabVM).Editor = editor; + + (editor.UndoRedoStatesProvider as ElementsEditorUndoRedoStatesProvider).StateExecuted += MachineTechView_StateExecuted; + } } } diff --git a/Software/Visual_Studio/Tango.Editors/ElementsEditor.xaml b/Software/Visual_Studio/Tango.Editors/ElementsEditor.xaml index 19db3992d..3d1bedc46 100644 --- a/Software/Visual_Studio/Tango.Editors/ElementsEditor.xaml +++ b/Software/Visual_Studio/Tango.Editors/ElementsEditor.xaml @@ -7,7 +7,7 @@ xmlns:converters="clr-namespace:Tango.Editors.Converters" xmlns:core="clr-namespace:Tango.Editors" mc:Ignorable="d" - x:Name="editor" Foreground="White" Background="#151515" FontSize="8" FocusVisualStyle="{x:Null}"> + x:Name="editor" FontSize="8" FocusVisualStyle="{x:Null}"> @@ -129,7 +129,7 @@ - + @@ -137,13 +137,13 @@ - - + - + @@ -181,7 +181,7 @@ - + + + + + + + + + + + + + - - - - - - - - - - - + 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 8bb81a7302e5a72322eae61b82389dfa7039c98c Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Wed, 26 Sep 2018 15:22:13 +0300 Subject: Default step division 8. Extend graphs FIFO capacity. --- Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 15400960 -> 15400960 bytes .../ViewModels/MainViewVM.cs | 5 ++++- .../Views/JobView.xaml | 2 +- .../Converters/SecondsToTimeSpanConverter.cs | 23 +++++++++++++++++++++ .../Tango.MachineStudio.Technician.csproj | 1 + .../Views/MachineTechView.xaml | 9 ++++---- .../Tango.BL/EntitiesExtensions/BrushStop.cs | 10 ++++++++- Software/Visual_Studio/Tango.sln | 12 +++++------ 9 files changed, 49 insertions(+), 13 deletions(-) create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Converters/SecondsToTimeSpanConverter.cs (limited to 'Software/Visual_Studio/MachineStudio/Modules') diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index b3f54005e..ac80b21a8 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 e1545e683..19c454a47 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/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs index ff4f47471..1dc59ab55 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs @@ -1908,7 +1908,9 @@ namespace Tango.MachineStudio.Developer.ViewModels newJob.Machine = SelectedMachine; SelectedMachine.Jobs.Add(newJob); - newJob.AddSolidSegment(); + var segment = newJob.AddSolidSegment(); + segment.BrushStops[0].SetAllDispensingStepDivisions(BL.Dispensing.DispenserStepDivisions.D8); + LogManager.Log("Saving selected machine to database..."); await SelectedMachine.SaveAsync(_machineDbContext); SelectedMachineJob = newJob; @@ -1963,6 +1965,7 @@ namespace Tango.MachineStudio.Developer.ViewModels stop.Segment = SelectedSegment; stop.ColorSpace = ColorSpaces.FirstOrDefault(); stop.Color = Colors.Black; + stop.SetAllDispensingStepDivisions(BL.Dispensing.DispenserStepDivisions.D8); stop.SetLiquidVolumes(SelectedMachine.Configuration, SelectedRML, SelectedProcessParametersTable); SelectedSegment.BrushStops.Add(stop); SelectedSegment.BrushStops.ToList().ForEach(x => x.RaiseOffsetChanged()); 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 627e4d63e..f891f6520 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 @@ -1067,7 +1067,7 @@ - + + + + + + + + + + + + + + + + + + + + selected monitors to record + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MonitorRecorderElementEditor.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MonitorRecorderElementEditor.xaml.cs new file mode 100644 index 000000000..213fa78e0 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MonitorRecorderElementEditor.xaml.cs @@ -0,0 +1,103 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Markup; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; +using Tango.Editors; +using Tango.BL.Entities; +using Tango.MachineStudio.Technician.TechItems; +using Tango.Core; + +namespace Tango.MachineStudio.Technician.Editors +{ + [ContentProperty("InnerContent")] + public partial class MonitorRecorderElementEditor : ElementEditor + { + /// + /// Initializes a new instance of the class. + /// + public MonitorRecorderElementEditor() + : base() + { + InitializeComponent(); + } + + /// + /// Initializes a new instance of the class. + /// + /// The framework element. + public MonitorRecorderElementEditor(MonitorRecorderItem monitorRecorderItem) + : this() + { + MonitorRecorderItem = monitorRecorderItem; + DataContext = MonitorRecorderItem; + } + + /// + /// Initializes a new instance of the class. + /// + /// The framework element. + /// The bounds. + public MonitorRecorderElementEditor(MonitorRecorderItem monitorRecorderItem, Rect bounds) + : this(monitorRecorderItem) + { + Left = bounds.Left; + Top = bounds.Top; + Width = bounds.Width; + Height = bounds.Height; + } + + private MonitorRecorderItem _monitorRecorderItem; + + public MonitorRecorderItem MonitorRecorderItem + { + get { return _monitorRecorderItem; } + set { _monitorRecorderItem = value; RaisePropertyChanged(nameof(MonitorRecorderItem)); } + } + + + /// + /// Clones this instance. + /// + /// + public override IElementEditor Clone() + { + try + { + var clonedItem = MonitorRecorderItem.Clone() as MonitorRecorderItem; + MonitorRecorderElementEditor cloned = new MonitorRecorderElementEditor(clonedItem); + cloned.Top = Top; + cloned.Left = Left; + cloned.Width = Width; + cloned.Height = Height; + cloned.Angle = Angle; + return cloned; + } + catch (Exception ex) + { + throw new InvalidOperationException("Could not clone this editor. You may have to create a custom editor and implement a custom Clone method.", ex); + } + } + + /// + /// Gets the hosted element. + /// + [ParameterIgnore] + public override Object HostedElement + { + get { return MonitorRecorderItem; } + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/csv.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/csv.png new file mode 100644 index 000000000..5f03ac6bd Binary files /dev/null and b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/csv.png differ diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Models/MultiTechRecordingData.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Models/MultiTechRecordingData.cs index e9471fa74..ad3ea1352 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Models/MultiTechRecordingData.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Models/MultiTechRecordingData.cs @@ -11,11 +11,11 @@ using Tango.MachineStudio.Technician.TechItems; namespace Tango.MachineStudio.Technician.Models { - public class MultiTechRecordingData : TechRecordingData where T : TechItem + public class MultiTechRecordingData : TechRecordingData { public int ChannelCount { get; set; } - public MultiTechRecordingData(T techItem, int channel_count) : base(techItem) + public MultiTechRecordingData(String name, int channel_count, String fileName) : base(name, fileName) { ChannelCount = channel_count; Init(); @@ -54,7 +54,7 @@ namespace Tango.MachineStudio.Technician.Models protected override List GetColumnNames() { - return Enumerable.Range(1, ChannelCount).Select(x => TechItem.TechName + " " + x).ToList(); + return Enumerable.Range(1, ChannelCount).Select(x => Name + " " + x).ToList(); } } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Models/SingleTechRecordingData.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Models/SingleTechRecordingData.cs index 7aa9a2b3f..8b480bbf3 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Models/SingleTechRecordingData.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Models/SingleTechRecordingData.cs @@ -7,9 +7,9 @@ using Tango.MachineStudio.Technician.TechItems; namespace Tango.MachineStudio.Technician.Models { - public class SingleTechRecordingData : TechRecordingData where T : TechItem + public class SingleTechRecordingData : TechRecordingData { - public SingleTechRecordingData(T techItem) : base(techItem) + public SingleTechRecordingData(String name, String fileName) : base(name, fileName) { Init(); } @@ -35,7 +35,7 @@ namespace Tango.MachineStudio.Technician.Models protected override List GetColumnNames() { - return new List() { TechItem.TechName }; + return new List() { Name }; } } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Models/TechRecordingData.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Models/TechRecordingData.cs index 8024a1375..7b6439dbf 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Models/TechRecordingData.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Models/TechRecordingData.cs @@ -11,7 +11,7 @@ using Tango.MachineStudio.Technician.TechItems; namespace Tango.MachineStudio.Technician.Models { - public abstract class TechRecordingData : ExtendedObject, IDisposable where T : TechItem where TValue : TechRecordingValue + public abstract class TechRecordingData : ExtendedObject, IDisposable where TValue : TechRecordingValue { protected bool _initialized; @@ -20,16 +20,18 @@ namespace Tango.MachineStudio.Technician.Models public CsvFile CsvFile { get; set; } - public TemporaryFile TemporaryFile { get; set; } + public String File { get; set; } - public T TechItem { get; set; } + public String Name { get; set; } - public TechRecordingData(T techItem) + public Object Tag { get; set; } + + public TechRecordingData(String name, String fileName) { + File = fileName; _start_time = DateTime.Now; _last_time = DateTime.Now; - TechItem = techItem; - TemporaryFile = TemporaryManager.CreateFile(".csv"); + Name = name; } protected void Init() @@ -37,20 +39,13 @@ namespace Tango.MachineStudio.Technician.Models CsvDefinition definition = new CsvDefinition(); definition.Columns = new List() { "Time" }.Concat(GetColumnNames()); - CsvFile = new CsvFile(new CsvDestination(TemporaryFile), definition); + CsvFile = new CsvFile(new CsvDestination(File), definition); _initialized = true; } - public void Save(String fileName) - { - CsvFile.Dispose(); - File.Copy(TemporaryFile.Path, fileName, true); - } - public void Dispose() { CsvFile.Dispose(); - TemporaryFile.Delete(); } protected abstract List GetColumnNames(); diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/MonitorRecorderTemplate.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/MonitorRecorderTemplate.xaml new file mode 100644 index 000000000..023191656 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/MonitorRecorderTemplate.xaml @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/MonitorRecorderTemplate.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/MonitorRecorderTemplate.xaml.cs new file mode 100644 index 000000000..011e108cb --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/MonitorRecorderTemplate.xaml.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace Tango.MachineStudio.Technician.PropertiesTemplates +{ + /// + /// Interaction logic for MonitorTemplate.xaml + /// + public partial class MonitorRecorderTemplate : UserControl + { + public MonitorRecorderTemplate() + { + InitializeComponent(); + } + } +} 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 0d9cd5b63..d937ca15b 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 @@ -52,6 +52,15 @@ ..\..\..\packages\MaterialDesignThemes.2.3.1.953\lib\net45\MaterialDesignThemes.Wpf.dll + + ..\..\..\packages\Microsoft.WindowsAPICodePack-Core.1.1.0.0\lib\Microsoft.WindowsAPICodePack.dll + + + ..\..\..\packages\Microsoft.WindowsAPICodePack-Shell.1.1.0.0\lib\Microsoft.WindowsAPICodePack.Shell.dll + + + ..\..\..\packages\Microsoft.WindowsAPICodePack-Shell.1.1.0.0\lib\Microsoft.WindowsAPICodePack.ShellExtensions.dll + @@ -101,6 +110,9 @@ + + MonitorRecorderElementEditor.xaml + HeaterElementEditor.xaml @@ -173,6 +185,9 @@ + + MonitorRecorderTemplate.xaml + HeaterTemplate.xaml @@ -244,6 +259,7 @@ + @@ -268,6 +284,10 @@ MachineTechView.xaml + + MSBuild:Compile + Designer + MSBuild:Compile Designer @@ -352,6 +372,10 @@ MSBuild:Compile Designer + + MSBuild:Compile + Designer + MSBuild:Compile Designer @@ -658,6 +682,9 @@ + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MonitorRecorderItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MonitorRecorderItem.cs new file mode 100644 index 000000000..e2b62092d --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MonitorRecorderItem.cs @@ -0,0 +1,131 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Media; +using System.Windows.Threading; +using System.Xml.Serialization; +using Tango.BL.Entities; +using Tango.Core.Commands; +using Tango.SharedUI.Components; +using Tango.SharedUI.Helpers; + +namespace Tango.MachineStudio.Technician.TechItems +{ + [TechItem(25)] + public class MonitorRecorderItem : TechItem + { + private DispatcherTimer _timer; + private DateTime _recording_start_time; + + public event Action RecordingStarted; + public event Action RecordingStopped; + + /// + /// Gets or sets the monitors. + /// + [XmlIgnore] + public SelectedObjectCollection Monitors { get; set; } + + private bool _isRecording; + /// + /// Gets or sets a value indicating whether this instance is recording. + /// + [XmlIgnore] + public bool IsRecording + { + get { return _isRecording; } + set { _isRecording = value; RaisePropertyChangedAuto(); } + } + + private TimeSpan _recordingTime; + [XmlIgnore] + public TimeSpan RecordingTime + { + get { return _recordingTime; } + set { _recordingTime = value; RaisePropertyChangedAuto(); } + } + + private bool _isPaused; + [XmlIgnore] + public bool IsPaused + { + get { return _isPaused; } + set { _isPaused = value; RaisePropertyChangedAuto(); } + } + + + /// + /// Gets or sets the toggle recording command. + /// + [XmlIgnore] + public RelayCommand ToggleRecordingCommand { get; set; } + + [XmlIgnore] + public RelayCommand TogglePauseCommand { get; set; } + + /// + /// Initializes a new instance of the class. + /// + public MonitorRecorderItem() : base() + { + _timer = new DispatcherTimer(); + _timer.Tick += _timer_Tick; + _timer.Interval = TimeSpan.FromSeconds(1); + + Monitors = new SelectedObjectCollection(Adapter.TechMonitors.ToObservableCollection(), new ObservableCollection()); + Name = "CSV Recorder"; + Description = "Record multiple monitors to a CSV file"; + Image = ResourceHelper.GetImageFromResources("Images/csv.png"); + Color = Colors.White; + + ToggleRecordingCommand = new RelayCommand(ToggleRecording); + TogglePauseCommand = new RelayCommand(() => { IsPaused = !IsPaused; }); + } + + public MonitorRecorderItem(object dummy) : this() + { + + } + + private void _timer_Tick(object sender, EventArgs e) + { + RecordingTime = DateTime.Now - _recording_start_time; + } + + private void ToggleRecording() + { + if (!IsRecording) + { + RecordingStarted?.Invoke(); + } + else + { + RecordingStopped?.Invoke(); + } + } + + public void StartRecording() + { + _recording_start_time = DateTime.Now; + IsRecording = true; + IsPaused = false; + _timer.Start(); + } + + public void StopRecording() + { + _timer.Stop(); + IsPaused = false; + IsRecording = false; + RecordingTime = TimeSpan.FromSeconds(0); + } + + public List GetSelectedMonitors() + { + return Monitors.SynchedSource.ToList(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MultiGraphItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MultiGraphItem.cs index 5a3bd0327..a935ee5a6 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MultiGraphItem.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MultiGraphItem.cs @@ -191,20 +191,28 @@ namespace Tango.MachineStudio.Technician.TechItems { if (!IsRecording) { - _recording_start_time = DateTime.Now; - IsRecording = true; - _timer.Start(); RecordingStarted?.Invoke(); } else { - _timer.Stop(); - IsRecording = false; - RecordingTime = TimeSpan.FromSeconds(0); RecordingStopped?.Invoke(); } } + public void StartRecording() + { + _recording_start_time = DateTime.Now; + IsRecording = true; + _timer.Start(); + } + + public void StopRecording() + { + _timer.Stop(); + IsRecording = false; + RecordingTime = TimeSpan.FromSeconds(0); + } + /// /// Initializes a new instance of the class. /// diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/SingleGraphItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/SingleGraphItem.cs index aa404b215..87d971233 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/SingleGraphItem.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/SingleGraphItem.cs @@ -184,20 +184,28 @@ namespace Tango.MachineStudio.Technician.TechItems { if (!IsRecording) { - _recording_start_time = DateTime.Now; - IsRecording = true; - _timer.Start(); RecordingStarted?.Invoke(); } else { - _timer.Stop(); - IsRecording = false; - RecordingTime = TimeSpan.FromSeconds(0); RecordingStopped?.Invoke(); } } + public void StartRecording() + { + _recording_start_time = DateTime.Now; + IsRecording = true; + _timer.Start(); + } + + public void StopRecording() + { + _timer.Stop(); + IsRecording = false; + RecordingTime = TimeSpan.FromSeconds(0); + } + /// /// Initializes a new instance of the class. /// diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/TechItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/TechItem.cs index 0d7568d68..6fa00ae0a 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/TechItem.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/TechItem.cs @@ -40,6 +40,7 @@ namespace Tango.MachineStudio.Technician.TechItems [XmlInclude(typeof(JobRunnerItem))] [XmlInclude(typeof(TextItem))] [XmlInclude(typeof(HeaterItem))] + [XmlInclude(typeof(MonitorRecorderItem))] public abstract class TechItem : ExtendedObject { /// 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 738e871c9..9051b5fa9 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 @@ -34,6 +34,7 @@ using Tango.Core.Commands; using Tango.MachineStudio.Technician.Helpers; using Tango.MachineStudio.Technician.Models; using Tango.Logging; +using Microsoft.WindowsAPICodePack.Dialogs; namespace Tango.MachineStudio.Technician.ViewModels { @@ -56,8 +57,10 @@ namespace Tango.MachineStudio.Technician.ViewModels private const int MIN_DIAGNOSTICS_UPDATE_MILI = 500; private TechnicianModuleSettings _settings; - private List> _single_graphs_recordings; - private List> _multi_graph_recordings; + private List _single_graphs_recordings; + private List _multi_graph_recordings; + private List _single_monitors_recordings; + private List _multi_monitors_recordings; #region Properties @@ -276,8 +279,11 @@ namespace Tango.MachineStudio.Technician.ViewModels _settings = SettingsManager.Default.GetOrCreate(); - _single_graphs_recordings = new List>(); - _multi_graph_recordings = new List>(); + _single_graphs_recordings = new List(); + _multi_graph_recordings = new List(); + + _single_monitors_recordings = new List(); + _multi_monitors_recordings = new List(); GraphsDurationSeconds = _settings.GraphsDuration; TempGraphsDurationSeconds = GraphsDurationSeconds; @@ -378,6 +384,28 @@ namespace Tango.MachineStudio.Technician.ViewModels } + foreach (var sr in _single_monitors_recordings) + { + var prop = _diagnoticsMonitorsDataProperties.SingleOrDefault(x => x.Name == (sr.Tag as TechMonitor).Name); + + if (prop != null) + { + var points = GetDataArray((sr.Tag as TechMonitor), prop.GetValue(data.Monitors)); + sr.PushData(points); + } + } + + foreach (var mr in _multi_monitors_recordings) + { + var prop = _diagnoticsMonitorsDataProperties.SingleOrDefault(x => x.Name == (mr.Tag as TechMonitor).Name); + + if (prop != null) + { + var points = GetDataMatrix((mr.Tag as TechMonitor), prop.GetValue(data.Monitors)); + mr.PushData(points); + } + } + lock (_elementsLock) { var elements = Tabs.SelectMany(x => x.Elements).ToList(); @@ -435,7 +463,7 @@ namespace Tango.MachineStudio.Technician.ViewModels controller.PushData(points); - var _graph_recording = _single_graphs_recordings.SingleOrDefault(x => x.TechItem == graphItem); + var _graph_recording = _single_graphs_recordings.SingleOrDefault(x => x.Tag == graphItem); if (_graph_recording != null) { _graph_recording.PushData(points); @@ -469,7 +497,7 @@ namespace Tango.MachineStudio.Technician.ViewModels controller.PushData(points); - var _graph_recording = _multi_graph_recordings.SingleOrDefault(x => x.TechItem == graphItem); + var _graph_recording = _multi_graph_recordings.SingleOrDefault(x => x.Tag == graphItem); if (_graph_recording != null) { _graph_recording.PushData(points); @@ -720,6 +748,11 @@ namespace Tango.MachineStudio.Technician.ViewModels { CreateElement(bounds, null); } + else if (item is MonitorRecorderItem) + { + var editor = CreateElement(bounds, null); + InitMonitorRecorderItem(editor.MonitorRecorderItem); + } } /// @@ -869,6 +902,10 @@ namespace Tango.MachineStudio.Technician.ViewModels { CreateElement(item); } + else if (item is MonitorRecorderItem) + { + CreateElement(item); + } } /// @@ -881,20 +918,24 @@ namespace Tango.MachineStudio.Technician.ViewModels { if (element.HostedElement is SingleGraphItem) { - var _graph_recording = _single_graphs_recordings.SingleOrDefault(x => x.TechItem == element.HostedElement); + var _graph_recording = _single_graphs_recordings.SingleOrDefault(x => x.Tag == element.HostedElement); if (_graph_recording != null) { + (_graph_recording.Tag as SingleGraphItem).StopRecording(); _single_graphs_recordings.Remove(_graph_recording); + _graph_recording.Dispose(); } } else if (element.HostedElement is MultiGraphItem) { - var _graph_recording = _multi_graph_recordings.SingleOrDefault(x => x.TechItem == element.HostedElement); + var _graph_recording = _multi_graph_recordings.SingleOrDefault(x => x.Tag == element.HostedElement); if (_graph_recording != null) { + (_graph_recording.Tag as MultiGraphItem).StopRecording(); _multi_graph_recordings.Remove(_graph_recording); + _graph_recording.Dispose(); } } } @@ -981,6 +1022,50 @@ namespace Tango.MachineStudio.Technician.ViewModels #region Init Tech Items + private void InitMonitorRecorderItem(MonitorRecorderItem item) + { + item.RecordingStarted += () => + { + CommonOpenFileDialog dlg = new CommonOpenFileDialog(); + dlg.Title = "Select a folder to place all CSV files."; + dlg.IsFolderPicker = true; + if (dlg.ShowDialog() == CommonFileDialogResult.Ok) + { + foreach (var monitor in item.GetSelectedMonitors()) + { + if (!monitor.MultiChannel) + { + _single_monitors_recordings.Add(new SingleTechRecordingData(monitor.Name, dlg.FileName + "\\" + monitor.Name + ".csv") { Tag = monitor }); + } + else + { + _multi_monitors_recordings.Add(new MultiTechRecordingData(monitor.Name, monitor.ChannelCount, dlg.FileName + "\\" + monitor.Name + ".csv") { Tag = monitor }); + } + item.StartRecording(); + } + } + }; + + item.RecordingStopped += () => + { + item.StopRecording(); + + foreach (var sr in _single_monitors_recordings) + { + sr.Dispose(); + } + + _single_monitors_recordings.Clear(); + + foreach (var mr in _multi_monitors_recordings) + { + mr.Dispose(); + } + + _multi_monitors_recordings.Clear(); + }; + } + /// /// Initializes the blower item. /// @@ -1222,29 +1307,30 @@ namespace Tango.MachineStudio.Technician.ViewModels item.RecordingStarted += () => { - _single_graphs_recordings.Add(new SingleTechRecordingData(item)); + SaveFileDialog dlg = new SaveFileDialog(); + dlg.Title = "Save graph data as csv file"; + dlg.Filter = "CSV Files|*.csv"; + dlg.DefaultExt = ".csv"; + dlg.FileName = item.TechName; + if (dlg.ShowDialog().Value) + { + _single_graphs_recordings.Add(new SingleTechRecordingData(item.TechName, dlg.FileName) { Tag = item }); + item.StartRecording(); + } }; item.RecordingStopped += () => { try { - var graph_recording = _single_graphs_recordings.SingleOrDefault(x => x.TechItem == item); + item.StopRecording(); + + var graph_recording = _single_graphs_recordings.SingleOrDefault(x => x.Tag == item); if (graph_recording != null) { _single_graphs_recordings.Remove(graph_recording); - - SaveFileDialog dlg = new SaveFileDialog(); - dlg.Title = "Save graph data as csv file"; - dlg.Filter = "CSV Files|*.csv"; - dlg.DefaultExt = ".csv"; - dlg.FileName = item.TechName; - if (dlg.ShowDialog().Value) - { - graph_recording.Save(dlg.FileName); - graph_recording.Dispose(); - } + graph_recording.Dispose(); } } catch (Exception ex) @@ -1282,29 +1368,30 @@ namespace Tango.MachineStudio.Technician.ViewModels item.RecordingStarted += () => { - _multi_graph_recordings.Add(new MultiTechRecordingData(item, item.TechMonitor.ChannelCount)); + SaveFileDialog dlg = new SaveFileDialog(); + dlg.Title = "Save graph data as csv file"; + dlg.Filter = "CSV Files|*.csv"; + dlg.DefaultExt = ".csv"; + dlg.FileName = item.TechName; + if (dlg.ShowDialog().Value) + { + _multi_graph_recordings.Add(new MultiTechRecordingData(item.TechName, item.TechMonitor.ChannelCount, dlg.FileName) { Tag = item }); + item.StartRecording(); + } }; item.RecordingStopped += () => { try { - var graph_recording = _multi_graph_recordings.SingleOrDefault(x => x.TechItem == item); + item.StopRecording(); + + var graph_recording = _multi_graph_recordings.SingleOrDefault(x => x.Tag == item); if (graph_recording != null) { _multi_graph_recordings.Remove(graph_recording); - - SaveFileDialog dlg = new SaveFileDialog(); - dlg.Title = "Save graph data as csv file"; - dlg.Filter = "CSV Files|*.csv"; - dlg.DefaultExt = ".csv"; - dlg.FileName = item.TechName; - if (dlg.ShowDialog().Value) - { - graph_recording.Save(dlg.FileName); - graph_recording.Dispose(); - } + graph_recording.Dispose(); } } catch (Exception ex) 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 9e675b2ff..ac207fc55 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 @@ -489,6 +489,9 @@ + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/packages.config b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/packages.config index ea48e62ff..adee6f7b4 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/packages.config +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/packages.config @@ -8,6 +8,8 @@ + + diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.config b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.config index 4147a78ec..0395c36bb 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.config +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.config @@ -87,6 +87,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file -- cgit v1.3.1 From 8ae143fbebc5357db447eb6f72076adaaa94fa26 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Thu, 27 Sep 2018 15:03:41 +0300 Subject: Working on RML module. Fixed database diagrams. --- Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 15400960 -> 15400960 bytes .../Modules/Tango.MachineStudio.RML/App.config | 46 +++++++ .../Tango.MachineStudio.RML/Images/rml-module.jpg | Bin 0 -> 62359 bytes .../Properties/AssemblyInfo.cs | 19 +++ .../Properties/Resources.Designer.cs | 62 +++++++++ .../Properties/Resources.resx | 117 +++++++++++++++++ .../Properties/Settings.Designer.cs | 30 +++++ .../Properties/Settings.settings | 7 + .../Modules/Tango.MachineStudio.RML/RMLModule.cs | 63 +++++++++ .../Tango.MachineStudio.RML.csproj | 143 +++++++++++++++++++++ .../Tango.MachineStudio.RML/ViewModelLocator.cs | 29 +++++ .../ViewModels/MainViewVM.cs | 98 ++++++++++++++ .../Tango.MachineStudio.RML/Views/MainView.xaml | 14 ++ .../Tango.MachineStudio.RML/Views/MainView.xaml.cs | 28 ++++ .../Tango.MachineStudio.RML/packages.config | 6 + .../Tango.MachineStudio.UI.csproj | 6 +- Software/Visual_Studio/Tango.sln | 43 +++++++ 18 files changed, 710 insertions(+), 1 deletion(-) create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/App.config create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Images/rml-module.jpg create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Properties/AssemblyInfo.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Properties/Resources.Designer.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Properties/Resources.resx create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Properties/Settings.Designer.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Properties/Settings.settings create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/RMLModule.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Tango.MachineStudio.RML.csproj create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModelLocator.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/MainView.xaml create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/MainView.xaml.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/packages.config (limited to 'Software/Visual_Studio/MachineStudio/Modules') diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index 4f1e3baff..70f6e3cce 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 7339c127f..fd5b221a1 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.RML/App.config b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/App.config new file mode 100644 index 000000000..bd3d48f6d --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/App.config @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Images/rml-module.jpg b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Images/rml-module.jpg new file mode 100644 index 000000000..7999c88fd Binary files /dev/null and b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Images/rml-module.jpg differ diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Properties/AssemblyInfo.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..062f0ace5 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Properties/AssemblyInfo.cs @@ -0,0 +1,19 @@ +using System.Reflection; +using System.Resources; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Windows; + +[assembly: AssemblyTitle("Tango - Machine Studio RML Module")] +[assembly: AssemblyVersion("2.0.11.1737")] + +[assembly: ComVisible(false)] + +[assembly: ThemeInfo( + ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located + //(used if a resource is not found in the page, + // or application resource dictionaries) + ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located + //(used if a resource is not found in the page, + // app, or any theme specific resource dictionaries) +)] diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Properties/Resources.Designer.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Properties/Resources.Designer.cs new file mode 100644 index 000000000..fb62b4ba4 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Properties/Resources.Designer.cs @@ -0,0 +1,62 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Tango.MachineStudio.RML.Properties { + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if ((resourceMan == null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Tango.MachineStudio.RML.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Properties/Resources.resx b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Properties/Resources.resx new file mode 100644 index 000000000..af7dbebba --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Properties/Settings.Designer.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Properties/Settings.Designer.cs new file mode 100644 index 000000000..30784c8b0 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Tango.MachineStudio.RML.Properties +{ + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Properties/Settings.settings b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Properties/Settings.settings new file mode 100644 index 000000000..033d7a5e9 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/RMLModule.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/RMLModule.cs new file mode 100644 index 000000000..fdd8cb124 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/RMLModule.cs @@ -0,0 +1,63 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Media.Imaging; +using Tango.BL.Enumerations; +using Tango.MachineStudio.RML.Views; +using Tango.MachineStudio.Common; +using Tango.SharedUI.Helpers; + +namespace Tango.MachineStudio.ColorLab +{ + [StudioModule(7)] + public class RMLModule : StudioModuleBase + { + public override string Name + { + get + { + return "RML"; + } + } + + public override string Description + { + get + { + return "Create and manage twine's recommended media list (RML). Configure RML's default calibration data and process parameters"; + } + } + + public override BitmapSource Image + { + get + { + return ResourceHelper.GetImageFromResources("Images/rml-module.jpg"); + } + } + + public override Type MainViewType + { + get + { + return typeof(MainView); + } + } + + public override Permissions Permission + { + get + { + return Permissions.RunColorLabModule; + } + } + + public override void Dispose() + { + + } + } +} 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 new file mode 100644 index 000000000..d9e0d5cf1 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Tango.MachineStudio.RML.csproj @@ -0,0 +1,143 @@ + + + + + Debug + AnyCPU + {D0186AC0-0FCF-4D3B-9619-54812B6E524B} + library + Tango.MachineStudio.RML + Tango.MachineStudio.RML + v4.7.2 + 512 + {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 4 + + + true + full + false + ..\..\..\Build\Machine Studio\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + ..\..\..\Build\Machine Studio\Release\ + TRACE + prompt + 4 + + + + ..\..\..\packages\EntityFramework.6.0.0\lib\net45\EntityFramework.dll + + + ..\..\..\packages\EntityFramework.6.0.0\lib\net45\EntityFramework.SqlServer.dll + + + ..\..\..\packages\MahApps.Metro.1.5.0\lib\net45\MahApps.Metro.dll + + + ..\..\..\packages\MaterialDesignColors.1.1.2\lib\net45\MaterialDesignColors.dll + + + + + + ..\..\..\packages\MahApps.Metro.1.5.0\lib\net45\System.Windows.Interactivity.dll + + + + + + + + + 4.0 + + + + + + + + GlobalVersionInfo.cs + + + + Code + + + True + True + Resources.resx + + + True + Settings.settings + True + + + + + MainView.xaml + + + ResXFileCodeGenerator + Resources.Designer.cs + + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + + + {f441feee-322a-4943-b566-110e12fd3b72} + Tango.BL + + + {a34ee0f0-649d-41c8-8489-b6f1cc6924ee} + Tango.Core + + + {58e8825f-0c96-449c-b320-1e82b0aa876b} + Tango.CSV + + + {ca87a608-7b17-4c98-88f2-42abee10f4c1} + Tango.Documents + + + {bc932dbd-7cdb-488c-99e4-f02cf441f55e} + Tango.Logging + + + {d8f1ad85-526a-4f50-b6dc-d437af63d8d8} + Tango.Settings + + + {8491d07b-c1f6-4b62-a412-41b9fd2d6538} + Tango.SharedUI + + + {cb0b0aa2-bb24-4bca-a720-45e397684e12} + Tango.MachineStudio.Common + + + + + + + + Designer + MSBuild:Compile + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModelLocator.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModelLocator.cs new file mode 100644 index 000000000..9c2bf2c6b --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModelLocator.cs @@ -0,0 +1,29 @@ +using Tango.Core.DI; +using Tango.MachineStudio.RML.ViewModels; +using Tango.MachineStudio.RML.Views; + +namespace Tango.MachineStudio.RML +{ + /// + /// This class contains static references to all the view models in the + /// application and provides an entry point for the bindings. + /// + public static class ViewModelLocator + { + /// + /// Initializes a new instance of the ViewModelLocator class. + /// + static ViewModelLocator() + { + TangoIOC.Default.Register(); + } + + public static MainViewVM MainViewVM + { + get + { + return TangoIOC.Default.GetInstance(); + } + } + } +} \ 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 new file mode 100644 index 000000000..ff42d870c --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs @@ -0,0 +1,98 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL; +using Tango.BL.Builders; +using Tango.BL.Entities; +using Tango.MachineStudio.Common; +using Tango.MachineStudio.Common.Notifications; + +namespace Tango.MachineStudio.RML.ViewModels +{ + public class MainViewVM : StudioViewModel + { + private INotificationProvider _notification; + + private ObservablesContext _rmls_context; + private ObservablesContext _active_context; + + private ObservableCollection _rmls; + public ObservableCollection Rmls + { + get { return _rmls; } + set { _rmls = value; RaisePropertyChangedAuto(); } + } + + private Rml _selectedRML; + public Rml SelectedRML + { + get { return _selectedRML; } + set { _selectedRML = value; RaisePropertyChangedAuto(); OnSelectedRmlChanged(); } + } + + private Rml _activeRML; + public Rml ActiveRML + { + get { return _activeRML; } + set { _activeRML = value; RaisePropertyChangedAuto(); } + } + + public MainViewVM(INotificationProvider notificationProvider) + { + _notification = notificationProvider; + } + + public override void OnApplicationReady() + { + LoadRmls(); + } + + private void LoadRmls() + { + using (_rmls_context = ObservablesContext.CreateDefault()) + { + Rmls = _rmls.ToList().ToObservableCollection(); + } + } + + private void OnSelectedRmlChanged() + { + if (SelectedRML != null) + { + LoadActiveRML(SelectedRML.Guid); + } + else + { + UnloadActiveRML(); + } + } + + private void UnloadActiveRML() + { + ActiveRML = null; + } + + private async void LoadActiveRML(String guid) + { + using (_notification.PushTaskItem("Loading RML...")) + { + if (_active_context != null) + { + _active_context.Dispose(); + } + + _active_context = ObservablesContext.CreateDefault(); + + ActiveRML = await new RmlBuilder(_active_context) + .Set(guid) + .WithAllParametersGroup() + .WithCCT() + .WithLiquidFactors() + .BuildAsync(); + } + } + } +} 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 new file mode 100644 index 000000000..bdd36af7a --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/MainView.xaml @@ -0,0 +1,14 @@ + + + + + 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 new file mode 100644 index 000000000..0fdcd11b8 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/MainView.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.RML.Views +{ + /// + /// Interaction logic for MainView.xaml + /// + public partial class MainView : UserControl + { + public MainView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/packages.config b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/packages.config new file mode 100644 index 000000000..efdb0fb1c --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/packages.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj index 5a646e9c0..fce0e717f 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj @@ -433,6 +433,10 @@ {d0ce8122-077d-42a2-9490-028ae4769b52} Tango.MachineStudio.MachineDesigner + + {d0186ac0-0fcf-4d3b-9619-54812b6e524b} + Tango.MachineStudio.RML + {22c2aa72-9493-4d0d-b421-8ef9789fb192} Tango.MachineStudio.Stubs @@ -579,7 +583,7 @@ copy /Y "$(SolutionDir)Referenced Assemblies\Microsoft.WITDataStore32.dll" "$(Ta - + \ No newline at end of file diff --git a/Software/Visual_Studio/Tango.sln b/Software/Visual_Studio/Tango.sln index 2879565a9..4cfc8f5ae 100644 --- a/Software/Visual_Studio/Tango.sln +++ b/Software/Visual_Studio/Tango.sln @@ -224,6 +224,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tango.EmbroideryUI", "Tango EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tango.WiFi", "Tango.WiFi\Tango.WiFi.csproj", "{6AA425C9-EA6A-4B01-AAED-5FF122E8B663}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tango.MachineStudio.RML", "MachineStudio\Modules\Tango.MachineStudio.RML\Tango.MachineStudio.RML.csproj", "{D0186AC0-0FCF-4D3B-9619-54812B6E524B}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution AppVeyor|Any CPU = AppVeyor|Any CPU @@ -3947,6 +3949,46 @@ Global {6AA425C9-EA6A-4B01-AAED-5FF122E8B663}.Release|x64.Build.0 = Release|Any CPU {6AA425C9-EA6A-4B01-AAED-5FF122E8B663}.Release|x86.ActiveCfg = Release|Any CPU {6AA425C9-EA6A-4B01-AAED-5FF122E8B663}.Release|x86.Build.0 = Release|Any CPU + {D0186AC0-0FCF-4D3B-9619-54812B6E524B}.AppVeyor|Any CPU.ActiveCfg = Release|Any CPU + {D0186AC0-0FCF-4D3B-9619-54812B6E524B}.AppVeyor|Any CPU.Build.0 = Release|Any CPU + {D0186AC0-0FCF-4D3B-9619-54812B6E524B}.AppVeyor|ARM.ActiveCfg = Release|Any CPU + {D0186AC0-0FCF-4D3B-9619-54812B6E524B}.AppVeyor|ARM.Build.0 = Release|Any CPU + {D0186AC0-0FCF-4D3B-9619-54812B6E524B}.AppVeyor|ARM64.ActiveCfg = Release|Any CPU + {D0186AC0-0FCF-4D3B-9619-54812B6E524B}.AppVeyor|ARM64.Build.0 = Release|Any CPU + {D0186AC0-0FCF-4D3B-9619-54812B6E524B}.AppVeyor|x64.ActiveCfg = Release|Any CPU + {D0186AC0-0FCF-4D3B-9619-54812B6E524B}.AppVeyor|x64.Build.0 = Release|Any CPU + {D0186AC0-0FCF-4D3B-9619-54812B6E524B}.AppVeyor|x86.ActiveCfg = Release|Any CPU + {D0186AC0-0FCF-4D3B-9619-54812B6E524B}.AppVeyor|x86.Build.0 = Release|Any CPU + {D0186AC0-0FCF-4D3B-9619-54812B6E524B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D0186AC0-0FCF-4D3B-9619-54812B6E524B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D0186AC0-0FCF-4D3B-9619-54812B6E524B}.Debug|ARM.ActiveCfg = Debug|Any CPU + {D0186AC0-0FCF-4D3B-9619-54812B6E524B}.Debug|ARM.Build.0 = Debug|Any CPU + {D0186AC0-0FCF-4D3B-9619-54812B6E524B}.Debug|ARM64.ActiveCfg = Debug|Any CPU + {D0186AC0-0FCF-4D3B-9619-54812B6E524B}.Debug|ARM64.Build.0 = Debug|Any CPU + {D0186AC0-0FCF-4D3B-9619-54812B6E524B}.Debug|x64.ActiveCfg = Debug|Any CPU + {D0186AC0-0FCF-4D3B-9619-54812B6E524B}.Debug|x64.Build.0 = Debug|Any CPU + {D0186AC0-0FCF-4D3B-9619-54812B6E524B}.Debug|x86.ActiveCfg = Debug|Any CPU + {D0186AC0-0FCF-4D3B-9619-54812B6E524B}.Debug|x86.Build.0 = Debug|Any CPU + {D0186AC0-0FCF-4D3B-9619-54812B6E524B}.DefaultBuild|Any CPU.ActiveCfg = Debug|Any CPU + {D0186AC0-0FCF-4D3B-9619-54812B6E524B}.DefaultBuild|Any CPU.Build.0 = Debug|Any CPU + {D0186AC0-0FCF-4D3B-9619-54812B6E524B}.DefaultBuild|ARM.ActiveCfg = Debug|Any CPU + {D0186AC0-0FCF-4D3B-9619-54812B6E524B}.DefaultBuild|ARM.Build.0 = Debug|Any CPU + {D0186AC0-0FCF-4D3B-9619-54812B6E524B}.DefaultBuild|ARM64.ActiveCfg = Debug|Any CPU + {D0186AC0-0FCF-4D3B-9619-54812B6E524B}.DefaultBuild|ARM64.Build.0 = Debug|Any CPU + {D0186AC0-0FCF-4D3B-9619-54812B6E524B}.DefaultBuild|x64.ActiveCfg = Debug|Any CPU + {D0186AC0-0FCF-4D3B-9619-54812B6E524B}.DefaultBuild|x64.Build.0 = Debug|Any CPU + {D0186AC0-0FCF-4D3B-9619-54812B6E524B}.DefaultBuild|x86.ActiveCfg = Debug|Any CPU + {D0186AC0-0FCF-4D3B-9619-54812B6E524B}.DefaultBuild|x86.Build.0 = Debug|Any CPU + {D0186AC0-0FCF-4D3B-9619-54812B6E524B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D0186AC0-0FCF-4D3B-9619-54812B6E524B}.Release|Any CPU.Build.0 = Release|Any CPU + {D0186AC0-0FCF-4D3B-9619-54812B6E524B}.Release|ARM.ActiveCfg = Release|Any CPU + {D0186AC0-0FCF-4D3B-9619-54812B6E524B}.Release|ARM.Build.0 = Release|Any CPU + {D0186AC0-0FCF-4D3B-9619-54812B6E524B}.Release|ARM64.ActiveCfg = Release|Any CPU + {D0186AC0-0FCF-4D3B-9619-54812B6E524B}.Release|ARM64.Build.0 = Release|Any CPU + {D0186AC0-0FCF-4D3B-9619-54812B6E524B}.Release|x64.ActiveCfg = Release|Any CPU + {D0186AC0-0FCF-4D3B-9619-54812B6E524B}.Release|x64.Build.0 = Release|Any CPU + {D0186AC0-0FCF-4D3B-9619-54812B6E524B}.Release|x86.ActiveCfg = Release|Any CPU + {D0186AC0-0FCF-4D3B-9619-54812B6E524B}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -4014,6 +4056,7 @@ Global {01C3EF89-6A17-4D70-A71F-0395A212F2F8} = {C81ED1A3-D18C-4D80-A8F5-061994A14A60} {D0E71A4D-9EEA-4F07-983F-EEB4416C587F} = {C81ED1A3-D18C-4D80-A8F5-061994A14A60} {0BDA9B52-9879-4C5E-84E3-81D00B75DACC} = {5F6BBAA8-EAD0-4B18-97E5-55B4F56DD760} + {D0186AC0-0FCF-4D3B-9619-54812B6E524B} = {B2AF4F3F-2828-47C3-8F3E-A0EA0BD66FF8} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {7986F7F4-A86A-4994-B1B6-0988D7F057B6} -- cgit v1.3.1 From 5c07f82c9690ca53928a9489eba7bb88f1352f8d Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Thu, 27 Sep 2018 16:45:06 +0300 Subject: Fixed issue with liquid volume loading (Copied from 3.43 branch) --- .../Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'Software/Visual_Studio/MachineStudio/Modules') diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs index 1dc59ab55..6c3e31325 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs @@ -1605,6 +1605,11 @@ namespace Tango.MachineStudio.Developer.ViewModels SegmentsCollectionView = CollectionViewSource.GetDefaultView(ActiveJob.Segments); SegmentsCollectionView.SortDescriptions.Add(new SortDescription(nameof(Segment.SegmentIndex), ListSortDirection.Ascending)); + foreach (var segment in ActiveJob.Segments) + { + SetSegmentBrushStopsLiquidVolumes(segment); + } + SelectedSegment = _selectedSegment; UIHelper.DoEvents(); -- cgit v1.3.1 From 79be5ab4903b98e2960913d7b07ec49d14410b27 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Thu, 27 Sep 2018 17:59:51 +0300 Subject: Working on RML module. Fixed issue with CSV trying to add rows after dispose was called. --- Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 15400960 -> 15400960 bytes .../Tango.MachineStudio.RML.csproj | 14 +++++++++++ .../ViewModels/MainViewVM.cs | 14 ++++++----- .../Tango.MachineStudio.RML/Views/RmlView.xaml | 14 +++++++++++ .../Tango.MachineStudio.RML/Views/RmlView.xaml.cs | 28 +++++++++++++++++++++ .../Tango.MachineStudio.RML/Views/RmlsView.xaml | 14 +++++++++++ .../Tango.MachineStudio.RML/Views/RmlsView.xaml.cs | 28 +++++++++++++++++++++ .../ViewModels/MachineTechViewVM.cs | 17 +++++++------ Software/Visual_Studio/Tango.CSV/CsvFile.cs | 11 +++++--- 10 files changed, 124 insertions(+), 16 deletions(-) create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlView.xaml create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlView.xaml.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlsView.xaml create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlsView.xaml.cs (limited to 'Software/Visual_Studio/MachineStudio/Modules') diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index 1202fb0bd..fdf00e2cd 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 fa9d8431c..62a4048b7 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.RML/Tango.MachineStudio.RML.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Tango.MachineStudio.RML.csproj index d9e0d5cf1..fcd933f4b 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 @@ -85,6 +85,12 @@ MainView.xaml + + RmlsView.xaml + + + RmlView.xaml + ResXFileCodeGenerator Resources.Designer.cs @@ -138,6 +144,14 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + + + Designer + 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 ff42d870c..9e108d0a8 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 @@ -50,12 +50,15 @@ namespace Tango.MachineStudio.RML.ViewModels LoadRmls(); } - private void LoadRmls() + private async void LoadRmls() { - using (_rmls_context = ObservablesContext.CreateDefault()) - { - Rmls = _rmls.ToList().ToObservableCollection(); - } + //using (_rmls_context = ObservablesContext.CreateDefault()) + //{ + // await Task.Factory.StartNew(() => + // { + // Rmls = _rmls.ToList().ToObservableCollection(); + // }); + //} } private void OnSelectedRmlChanged() @@ -89,7 +92,6 @@ namespace Tango.MachineStudio.RML.ViewModels ActiveRML = await new RmlBuilder(_active_context) .Set(guid) .WithAllParametersGroup() - .WithCCT() .WithLiquidFactors() .BuildAsync(); } 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 new file mode 100644 index 000000000..92b8506f5 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlView.xaml @@ -0,0 +1,14 @@ + + + + + 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 new file mode 100644 index 000000000..e01654243 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlView.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.RML.Views +{ + /// + /// Interaction logic for RmlView.xaml + /// + public partial class RmlView : UserControl + { + public RmlView() + { + InitializeComponent(); + } + } +} 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 new file mode 100644 index 000000000..2ba5e44c9 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlsView.xaml @@ -0,0 +1,14 @@ + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlsView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlsView.xaml.cs new file mode 100644 index 000000000..66f52d8c8 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlsView.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.RML.Views +{ + /// + /// Interaction logic for RmlsView.xaml + /// + public partial class RmlsView : UserControl + { + public RmlsView() + { + InitializeComponent(); + } + } +} 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 9051b5fa9..2ca5aa43b 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 @@ -383,25 +383,28 @@ namespace Tango.MachineStudio.Technician.ViewModels CurrentDiagnosticsResponseSize = data.CalculateSize(); } - foreach (var sr in _single_monitors_recordings) { - var prop = _diagnoticsMonitorsDataProperties.SingleOrDefault(x => x.Name == (sr.Tag as TechMonitor).Name); + var techMonitor = (sr.Tag as TechMonitor); + + var prop = _diagnoticsMonitorsDataProperties.SingleOrDefault(x => x.Name == techMonitor.Name); if (prop != null) { - var points = GetDataArray((sr.Tag as TechMonitor), prop.GetValue(data.Monitors)); + var points = GetDataArray(techMonitor, prop.GetValue(data.Monitors)); sr.PushData(points); } } foreach (var mr in _multi_monitors_recordings) { - var prop = _diagnoticsMonitorsDataProperties.SingleOrDefault(x => x.Name == (mr.Tag as TechMonitor).Name); + var techMonitor = (mr.Tag as TechMonitor); + + var prop = _diagnoticsMonitorsDataProperties.SingleOrDefault(x => x.Name == techMonitor.Name); if (prop != null) { - var points = GetDataMatrix((mr.Tag as TechMonitor), prop.GetValue(data.Monitors)); + var points = GetDataMatrix(techMonitor, prop.GetValue(data.Monitors)); mr.PushData(points); } } @@ -1035,11 +1038,11 @@ namespace Tango.MachineStudio.Technician.ViewModels { if (!monitor.MultiChannel) { - _single_monitors_recordings.Add(new SingleTechRecordingData(monitor.Name, dlg.FileName + "\\" + monitor.Name + ".csv") { Tag = monitor }); + _single_monitors_recordings.Add(new SingleTechRecordingData(monitor.Name, dlg.FileName + "\\" + monitor.Description + ".csv") { Tag = monitor }); } else { - _multi_monitors_recordings.Add(new MultiTechRecordingData(monitor.Name, monitor.ChannelCount, dlg.FileName + "\\" + monitor.Name + ".csv") { Tag = monitor }); + _multi_monitors_recordings.Add(new MultiTechRecordingData(monitor.Name, monitor.ChannelCount, dlg.FileName + "\\" + monitor.Description + ".csv") { Tag = monitor }); } item.StartRecording(); } diff --git a/Software/Visual_Studio/Tango.CSV/CsvFile.cs b/Software/Visual_Studio/Tango.CSV/CsvFile.cs index 8a908b6d8..d180f0139 100644 --- a/Software/Visual_Studio/Tango.CSV/CsvFile.cs +++ b/Software/Visual_Studio/Tango.CSV/CsvFile.cs @@ -19,6 +19,8 @@ namespace Tango.CSV /// public class CsvFile : IDisposable { + protected bool _is_disposed; + internal protected Stream BaseStream; protected static DateTime DateTimeZero = new DateTime(); @@ -190,6 +192,7 @@ namespace Tango.CSV { if (disposing) { + _is_disposed = true; // free managed resources addAsyncTask.Wait(); if (csvLinesToWrite != null) @@ -243,15 +246,17 @@ namespace Tango.CSV /// The record. public void Append(T record) { - if (CsvFile.UseTasks) { var linesWaiting = Interlocked.Increment(ref this.linesToWrite); Action addRecord = (t) => { - var csvLine = this.ToCsv(record); - this.csvLinesToWrite.Add(csvLine); + if (!_is_disposed) + { + var csvLine = this.ToCsv(record); + this.csvLinesToWrite.Add(csvLine); + } }; if (linesWaiting < 10000) -- 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/Modules') 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 From c23d740d6a80db62b7b43ea17639ba4c2ef4e336 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Wed, 3 Oct 2018 14:19:04 +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 .../Tango.MachineStudio.ColorLab.csproj | 6 +- .../ViewModels/CalibrationDataPointVM.cs | 3 +- .../ViewModels/CalibrationDataVM.cs | 12 ++- .../ViewModels/LiquidVolumeVM.cs | 3 +- .../ViewModels/RgbVM.cs | 3 +- .../Tango.MachineStudio.RML.csproj | 8 ++ .../ViewModels/AddLiquidFactorViewVM.cs | 50 ++++++++++ .../ViewModels/MainViewVM.cs | 71 ++++++++++++++ .../Views/AddLiquidFactorView.xaml | 56 +++++++++++ .../Views/AddLiquidFactorView.xaml.cs | 28 ++++++ .../Tango.MachineStudio.RML/Views/RmlView.xaml | 13 ++- .../Resources/Calibration Data Template.xlsx | Bin 0 -> 9306 bytes .../Visual_Studio/Tango.BL/Builders/RmlBuilder.cs | 2 +- .../Visual_Studio/Tango.Documents/ExcelWriter.cs | 104 +++++++++++++++++++++ .../Tango.Documents/Tango.Documents.csproj | 3 +- .../Tango.UnitTesting/ColorLib_TST.cs | 28 ++++++ Software/Visual_Studio/Tango.UnitTesting/Helper.cs | 2 +- .../Tango.UnitTesting/Tango.UnitTesting.csproj | 10 +- 22 files changed, 389 insertions(+), 13 deletions(-) create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/AddLiquidFactorViewVM.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/AddLiquidFactorView.xaml create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/AddLiquidFactorView.xaml.cs create mode 100644 Software/Visual_Studio/Resources/Calibration Data Template.xlsx create mode 100644 Software/Visual_Studio/Tango.Documents/ExcelWriter.cs (limited to 'Software/Visual_Studio/MachineStudio/Modules') diff --git a/Software/DB/PPC/Tango.mdf b/Software/DB/PPC/Tango.mdf index cea4bce53..198fdf37c 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 81d900e41..e6f724f8b 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 6a62ca559..dc1bf2460 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 e84ee38f5..fbffee0bd 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.ColorLab/Tango.MachineStudio.ColorLab.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Tango.MachineStudio.ColorLab.csproj index 18d51aa09..b4ab87be6 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 @@ -131,6 +131,10 @@ {a34ee0f0-649d-41c8-8489-b6f1cc6924ee} Tango.Core + + {ca87a608-7b17-4c98-88f2-42abee10f4c1} + Tango.Documents + {942134ac-6ea2-4500-8f22-0f739b70a05f} Tango.Hive @@ -187,7 +191,7 @@ - + \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/CalibrationDataPointVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/CalibrationDataPointVM.cs index 74f892a81..33110d50e 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/CalibrationDataPointVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/CalibrationDataPointVM.cs @@ -3,11 +3,12 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using Tango.Core; using Tango.SharedUI; namespace Tango.MachineStudio.ColorLab.ViewModels { - public class CalibrationDataPointVM : ViewModel + public class CalibrationDataPointVM : ExtendedObject { private double _x; diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/CalibrationDataVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/CalibrationDataVM.cs index 87bbacab5..8fe8ec4ac 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/CalibrationDataVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/CalibrationDataVM.cs @@ -5,12 +5,22 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using Tango.BL.Entities; +using Tango.Core; using Tango.SharedUI; namespace Tango.MachineStudio.ColorLab.ViewModels { - public class CalibrationDataVM : ViewModel + public class CalibrationDataVM : ExtendedObject { + private LiquidType _liquidType; + + public LiquidType LiquidType + { + get { return _liquidType; } + set { _liquidType = value; RaisePropertyChangedAuto(); } + } + + private String _name; public String Name diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/LiquidVolumeVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/LiquidVolumeVM.cs index 245fda239..ca4f12b5d 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/LiquidVolumeVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/LiquidVolumeVM.cs @@ -4,11 +4,12 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using Tango.BL.Entities; +using Tango.Core; using Tango.SharedUI; namespace Tango.MachineStudio.ColorLab.ViewModels { - public class LiquidVolumeVM : ViewModel + public class LiquidVolumeVM : ExtendedObject { public event EventHandler VolumeChanged; diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/RgbVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/RgbVM.cs index badb238fb..aae490a6e 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/RgbVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/RgbVM.cs @@ -4,11 +4,12 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Media; +using Tango.Core; using Tango.SharedUI; namespace Tango.MachineStudio.ColorLab.ViewModels { - public class RgbVM : ViewModel + public class RgbVM : ExtendedObject { public event EventHandler ColorChanged; 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 99b0a3c19..b9d77e95a 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 @@ -88,7 +88,11 @@ True + + + AddLiquidFactorView.xaml + MainView.xaml @@ -159,6 +163,10 @@ + + Designer + MSBuild:Compile + Designer MSBuild:Compile diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/AddLiquidFactorViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/AddLiquidFactorViewVM.cs new file mode 100644 index 000000000..f6fca0ac2 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/AddLiquidFactorViewVM.cs @@ -0,0 +1,50 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL; +using Tango.BL.Entities; +using Tango.SharedUI; +using System.Data.Entity; + +namespace Tango.MachineStudio.RML.ViewModels +{ + public class AddLiquidFactorViewVM : DialogViewVM + { + private ObservablesContext _context; + + private ObservableCollection _liquidTypes; + public ObservableCollection LiquidTypes + { + get + { + return _liquidTypes; + } + set + { + _liquidTypes = value; RaisePropertyChangedAuto(); + } + } + + private LiquidType _selectedLiquidType; + public LiquidType SelectedLiquidType + { + get { return _selectedLiquidType; } + set { _selectedLiquidType = value; RaisePropertyChangedAuto(); } + } + + public AddLiquidFactorViewVM(ObservablesContext context) + { + _context = context; + } + + public async override void OnShow() + { + base.OnShow(); + LiquidTypes = (await _context.LiquidTypes.ToListAsync()).ToObservableCollection(); + SelectedLiquidType = LiquidTypes.FirstOrDefault(); + } + } +} 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 b7e7859ac..be46e2148 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 @@ -14,6 +14,7 @@ using Tango.MachineStudio.ColorLab.ViewModels; using Tango.MachineStudio.Common; using Tango.MachineStudio.Common.Notifications; using Tango.MachineStudio.RML.Contracts; +using Tango.MachineStudio.RML.Views; namespace Tango.MachineStudio.RML.ViewModels { @@ -140,6 +141,14 @@ namespace Tango.MachineStudio.RML.ViewModels public RelayCommand AddProcessParametersTableCommand { get; set; } + public RelayCommand RemoveProcessParametersTableCommand { get; set; } + + public RelayCommand AddLiquidFactorCommand { get; set; } + + public RelayCommand RemoveLiquidFactorCommand { get; set; } + + public RelayCommand CreateCalibrationDataExcelTemplateCommand { get; set; } + /// /// Gets or sets the back to RMLS command. /// @@ -153,6 +162,10 @@ namespace Tango.MachineStudio.RML.ViewModels AddRmlCommand = new RelayCommand(AddNewRml); BackToRmlsCommand = new RelayCommand(BackToRmls); AddProcessParametersTableCommand = new RelayCommand(AddProcessParametersTable); + RemoveProcessParametersTableCommand = new RelayCommand(RemoveProcessParametersTable); + AddLiquidFactorCommand = new RelayCommand(AddLiquidFactor); + RemoveLiquidFactorCommand = new RelayCommand(RemoveLiquidFactor); + CreateCalibrationDataExcelTemplateCommand = new RelayCommand(CreateCalibrationDataExcelTemplate); } public override void OnApplicationReady() @@ -205,6 +218,7 @@ namespace Tango.MachineStudio.RML.ViewModels CalibrationDataVM catVM = new CalibrationDataVM(); catVM.Name = liquidTypeRml.LiquidType.Name; catVM.Color = liquidTypeRml.LiquidType.Color; + catVM.LiquidType = liquidTypeRml.LiquidType; if (liquidTypeRml.DefaultCatData != null) { @@ -316,6 +330,63 @@ namespace Tango.MachineStudio.RML.ViewModels ActiveProcessParametersTableView.Refresh(); } + private void RemoveLiquidFactor(LiquidTypesRml liquidFactor) + { + if (_notification.ShowQuestion("Removing this liquid factor will remove the liquid type association with the RML and will drop the calibration data. Are you sure?")) + { + var catVM = CalibrationDataViewVM.LiquidsCalibrationData.SingleOrDefault(x => x.LiquidType == liquidFactor.LiquidType); + CalibrationDataViewVM.LiquidsCalibrationData.Remove(catVM); + _active_context.LiquidTypesRmls.Remove(liquidFactor); + } + } + + private void AddLiquidFactor() + { + AddLiquidFactorViewVM vm = new AddLiquidFactorViewVM(_active_context); + _notification.ShowModalDialog(vm, (_) => + { + if (LiquidTypesRmls.ToList().Exists(x => x.LiquidType == vm.SelectedLiquidType)) + { + _notification.ShowError("The selected liquid type is already associated with this RML."); + return; + } + + LiquidTypesRml liquidFactor = new LiquidTypesRml() + { + LiquidType = vm.SelectedLiquidType, + Rml = ActiveRML, + }; + + _active_context.LiquidTypesRmls.Add(liquidFactor); + + CalibrationDataVM catVM = new CalibrationDataVM(); + catVM.Name = liquidFactor.LiquidType.Name; + catVM.Color = liquidFactor.LiquidType.Color; + + CalibrationDataViewVM.LiquidsCalibrationData.Add(catVM); + + }, () => { }); + } + + private void RemoveProcessParametersTable(ProcessParametersTable processParametersTable) + { + if (ActiveProcessParametersGroup.ProcessParametersTables.Count == 1) + { + _notification.ShowError("The process group must contain at least one table."); + return; + } + + if (_notification.ShowQuestion("Are you sure you want to remove this process parameters table?")) + { + _active_context.ProcessParametersTables.Remove(processParametersTable); + } + } + + private void CreateCalibrationDataExcelTemplate() + { + + } + private void BackToRmls() { View.NavigateTo(RmlNavigationView.RmlsView); diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/AddLiquidFactorView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/AddLiquidFactorView.xaml new file mode 100644 index 000000000..6d9b68edb --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/AddLiquidFactorView.xaml @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + , + v + + + + + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/AddLiquidFactorView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/AddLiquidFactorView.xaml.cs new file mode 100644 index 000000000..cdacddf42 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/AddLiquidFactorView.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.RML.Views +{ + /// + /// Interaction logic for AddLiquidFactorView.xaml + /// + public partial class AddLiquidFactorView : UserControl + { + public AddLiquidFactorView() + { + InitializeComponent(); + } + } +} 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 e77663de4..aa6f39d9e 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 @@ -155,7 +155,7 @@ - @@ -221,7 +221,7 @@ LIQUID FACTORS - @@ -234,9 +234,9 @@ - + - @@ -269,7 +269,12 @@ + CALIBRATION DATA + + diff --git a/Software/Visual_Studio/Resources/Calibration Data Template.xlsx b/Software/Visual_Studio/Resources/Calibration Data Template.xlsx new file mode 100644 index 000000000..cd6b52fba Binary files /dev/null and b/Software/Visual_Studio/Resources/Calibration Data Template.xlsx differ diff --git a/Software/Visual_Studio/Tango.BL/Builders/RmlBuilder.cs b/Software/Visual_Studio/Tango.BL/Builders/RmlBuilder.cs index 8eab66c85..0fe653a67 100644 --- a/Software/Visual_Studio/Tango.BL/Builders/RmlBuilder.cs +++ b/Software/Visual_Studio/Tango.BL/Builders/RmlBuilder.cs @@ -58,7 +58,7 @@ namespace Tango.BL.Builders { return AddStep(5, () => { - Context.LiquidTypesRmls.Where(x => x.RmlGuid == Entity.Guid).Include(x => x.LiquidType).ToList(); + Context.LiquidTypesRmls.Where(x => x.RmlGuid == Entity.Guid).Include(x => x.LiquidType).OrderBy(x => x.LiquidType.Code).ToList(); }); } diff --git a/Software/Visual_Studio/Tango.Documents/ExcelWriter.cs b/Software/Visual_Studio/Tango.Documents/ExcelWriter.cs new file mode 100644 index 000000000..613bbd90f --- /dev/null +++ b/Software/Visual_Studio/Tango.Documents/ExcelWriter.cs @@ -0,0 +1,104 @@ +using DocumentFormat.OpenXml.Packaging; +using DocumentFormat.OpenXml.Spreadsheet; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Text.RegularExpressions; +using System.Threading.Tasks; + +namespace Tango.Documents +{ + public class ExcelWriter : IDisposable + { + private Stream _stream; + private SpreadsheetDocument _document; + private List _column_names; + + public ExcelWriter(Stream source) + { + _stream = source; + _document = SpreadsheetDocument.Open(_stream, true); + _column_names = new List(); + + if (_document.WorkbookPart.Workbook.GetFirstChild() != null) + { + foreach (DefinedName name in _document.WorkbookPart.Workbook.GetFirstChild()) + { + _column_names.Add(name); + } + } + } + + public ExcelWriter(String fileName) : this(new FileStream(fileName, FileMode.OpenOrCreate, FileAccess.ReadWrite)) + { + + } + + public void WriteData(IEnumerable data, String sheetName) + { + var props = typeof(T).GetProperties(BindingFlags.Public | BindingFlags.Instance).ToList(); + + WorksheetPart work_sheet_part = GetWorkSheetPart(sheetName); + Worksheet workSheet = work_sheet_part.Worksheet; + SheetData sheetData = workSheet.GetFirstChild(); + List rows = sheetData.Elements().ToList(); + + var list = data.ToList(); + + for (int i = 0; i < list.Count; i++) + { + var item = list[i]; + + Row newRow = new Row(); + + sheetData.InsertAfter(newRow, sheetData.Elements().Last()); + + foreach (var prop in props) + { + var definedName = _column_names.SingleOrDefault(x => x.Name == prop.Name); + + if (definedName != null) + { + SetCellRow(newRow, GetCellReference(definedName, i + 2), prop.GetValue(item)); + } + } + } + } + + private void SetCellRow(Row row, string cellReference, object value) + { + Cell cell = row.Descendants().FirstOrDefault(c => c.CellReference == cellReference); + if (cell == null) + { + cell = new Cell(); + cell.CellReference = cellReference; + } + cell.CellValue = new CellValue(value.ToString()); + cell.DataType = CellValues.String; + row.Append(cell); + } + + private WorksheetPart GetWorkSheetPart(String sheetName) + { + var sheet = _document.WorkbookPart.Workbook.Descendants().FirstOrDefault(x => x.Name.Value == sheetName); + string relId = sheet.Id; + return (WorksheetPart)_document.WorkbookPart.GetPartById(relId); + } + + private string GetCellReference(DefinedName name, int rowIndex) + { + Regex rowPatern = new Regex("^.*\\!\\$(.*)\\$\\d*$"); + Match match = rowPatern.Match(name.Text); + return match.Groups[1].Value + rowIndex.ToString(); + } + + public void Dispose() + { + _document.Save(); + _stream.Dispose(); + } + } +} diff --git a/Software/Visual_Studio/Tango.Documents/Tango.Documents.csproj b/Software/Visual_Studio/Tango.Documents/Tango.Documents.csproj index cbfd9c79b..17ba03257 100644 --- a/Software/Visual_Studio/Tango.Documents/Tango.Documents.csproj +++ b/Software/Visual_Studio/Tango.Documents/Tango.Documents.csproj @@ -60,6 +60,7 @@ GlobalVersionInfo.cs + @@ -87,7 +88,7 @@ - + \ No newline at end of file diff --git a/Software/Visual_Studio/Tango.UnitTesting/ColorLib_TST.cs b/Software/Visual_Studio/Tango.UnitTesting/ColorLib_TST.cs index 5541bc286..dc19c77dd 100644 --- a/Software/Visual_Studio/Tango.UnitTesting/ColorLib_TST.cs +++ b/Software/Visual_Studio/Tango.UnitTesting/ColorLib_TST.cs @@ -11,6 +11,9 @@ using System.Collections.Generic; using Tango.BL; using System.IO; using System.Diagnostics; +using Tango.Documents; +using Tango.Core.IO; +using Tango.MachineStudio.ColorLab.ViewModels; namespace Tango.UnitTesting { @@ -163,6 +166,31 @@ namespace Tango.UnitTesting Assert.IsTrue(output.SingleCoordinates.OutputLiquids.Count == conversionInput.InputCoordinates.InputLiquids.Count); } + [TestMethod] + public void Write_Calibration_Data_Excel_File() + { + String temp_file = Helper.GetTempFolderPath() + "\\CalibrationData.xlsx"; + File.Copy(Helper.GetResourcePath("Calibration Data Template.xlsx"), temp_file); + + CalibrationDataVM vm = new CalibrationDataVM(); + + for (int i = 0; i < 10; i++) + { + vm.CalibrationPoints.Add(new CalibrationDataPointVM() + { + X = i + 1, + Y = (i + 1) * 10, + }); + } + + using (ExcelWriter writer = new ExcelWriter(temp_file)) + { + writer.WriteData(vm.CalibrationPoints, "CalibrationData"); + } + + Helper.ShowInExplorer(temp_file); + } + private static CalibrationData GenerateCalibrationData(PMR.ColorLab.LiquidType liquidType) { CalibrationData data = new CalibrationData(); diff --git a/Software/Visual_Studio/Tango.UnitTesting/Helper.cs b/Software/Visual_Studio/Tango.UnitTesting/Helper.cs index 67252f914..ae7636c7b 100644 --- a/Software/Visual_Studio/Tango.UnitTesting/Helper.cs +++ b/Software/Visual_Studio/Tango.UnitTesting/Helper.cs @@ -22,7 +22,7 @@ namespace Tango.UnitTesting /// public static String GetResourcePath(String fileName) { - return Path.GetFullPath(@"..\..\Resources\" + fileName); + return Path.GetFullPath(@"..\..\..\Resources\" + fileName); } /// diff --git a/Software/Visual_Studio/Tango.UnitTesting/Tango.UnitTesting.csproj b/Software/Visual_Studio/Tango.UnitTesting/Tango.UnitTesting.csproj index 7a37655a8..49d2d8cb5 100644 --- a/Software/Visual_Studio/Tango.UnitTesting/Tango.UnitTesting.csproj +++ b/Software/Visual_Studio/Tango.UnitTesting/Tango.UnitTesting.csproj @@ -115,6 +115,10 @@ + + {4d183aca-552b-4135-ae81-7c5a8e5fc3b1} + Tango.MachineStudio.ColorLab + {1674f726-0e66-414f-b9fd-c6f20d7f07c7} Tango.MachineStudio.Logging @@ -143,6 +147,10 @@ {38197109-8610-4d3f-92b9-16d48df94d7c} Tango.DAL.Remote + + {ca87a608-7b17-4c98-88f2-42abee10f4c1} + Tango.Documents + {4206ac58-3b57-4699-8835-90bf6db01a61} Tango.Integration @@ -202,7 +210,7 @@ - + \ No newline at end of file -- cgit v1.3.1