From c14073e78d2c5b9569f91f47609d431da48ba706 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Sun, 6 May 2018 13:50:14 +0300 Subject: Added start/stop diagnostics and debugging on PMR. Added device info to connected machine view. Added enable/disable diagnostics/debugging to connected machine view. Improved transfer rate calculation. --- .../ViewModels/MachineTechViewVM.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs') 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 4cc1852a6..4a8cd82a5 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 @@ -122,11 +122,11 @@ namespace Tango.MachineStudio.Technician.ViewModels set { _hideMenu = value; RaisePropertyChangedAuto(); } } - private PushDiagnosticsResponse _currentDiagnosticsResponse; + private StartDiagnosticsResponse _currentDiagnosticsResponse; /// /// Gets or sets the current diagnostics response. /// - public PushDiagnosticsResponse CurrentDiagnosticsResponse + public StartDiagnosticsResponse CurrentDiagnosticsResponse { get { return _currentDiagnosticsResponse; } set { _currentDiagnosticsResponse = value; RaisePropertyChanged(nameof(CurrentDiagnosticsResponse)); } @@ -221,7 +221,7 @@ namespace Tango.MachineStudio.Technician.ViewModels /// /// The sender. /// The response. - private void DiagnosticsFrameProvider_FrameReceived(object sender, PushDiagnosticsResponse response) + private void DiagnosticsFrameProvider_FrameReceived(object sender, StartDiagnosticsResponse response) { PopulateDiagnosticsData(response); } @@ -234,7 +234,7 @@ namespace Tango.MachineStudio.Technician.ViewModels /// Populates the diagnostics data to the proper elements. /// /// The data. - private void PopulateDiagnosticsData(PushDiagnosticsResponse data) + private void PopulateDiagnosticsData(StartDiagnosticsResponse data) { if (DateTime.Now > _lastDiagnosticsResponseUpdate.AddMilliseconds(MIN_DIAGNOSTICS_UPDATE_MILI)) { -- cgit v1.3.1 From 47c0f9224c370009c3b37f6db83ec99c31d859f8 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Sun, 6 May 2018 18:39:56 +0300 Subject: Added support for Win7 for stubs UI. Added Dancers, Winders, PID Controls on tech module. Some code cleanups. --- Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 1572864 -> 1572864 bytes Software/Graphics/dancer-big.png | Bin 0 -> 7870 bytes Software/Graphics/dancer-small.png | Bin 0 -> 2072 bytes Software/Graphics/function.png | Bin 0 -> 1867 bytes Software/Graphics/pid.png | Bin 0 -> 14262 bytes Software/Graphics/winder-big.png | Bin 0 -> 10598 bytes Software/Graphics/winder-small.png | Bin 0 -> 2819 bytes .../ViewModels/DbTableViewModel.cs | 10 - .../Editors/DancerElementEditor.xaml | 79 ++++++++ .../Editors/DancerElementEditor.xaml.cs | 102 ++++++++++ .../Editors/PidElementEditor.xaml | 79 ++++++++ .../Editors/PidElementEditor.xaml.cs | 102 ++++++++++ .../Editors/WinderElementEditor.xaml | 79 ++++++++ .../Editors/WinderElementEditor.xaml.cs | 102 ++++++++++ .../Images/dancer-big.png | Bin 0 -> 7870 bytes .../Images/dancer-small.png | Bin 0 -> 2072 bytes .../Images/function.png | Bin 0 -> 1867 bytes .../Tango.MachineStudio.Technician/Images/pid.png | Bin 0 -> 14262 bytes .../Images/winder-big.png | Bin 0 -> 10598 bytes .../Images/winder-small.png | Bin 0 -> 2819 bytes .../PropertiesTemplates/DancerTemplate.xaml | 78 ++++++++ .../PropertiesTemplates/DancerTemplate.xaml.cs | 28 +++ .../PropertiesTemplates/PidTemplate.xaml | 78 ++++++++ .../PropertiesTemplates/PidTemplate.xaml.cs | 28 +++ .../PropertiesTemplates/WinderTemplate.xaml | 78 ++++++++ .../PropertiesTemplates/WinderTemplate.xaml.cs | 28 +++ .../Tango.MachineStudio.Technician.csproj | 59 ++++++ .../TechItems/DancerItem.cs | 104 ++++++++++ .../TechItems/PidItem.cs | 104 ++++++++++ .../TechItems/TechItem.cs | 3 + .../TechItems/WinderItem.cs | 104 ++++++++++ .../ViewModels/MachineTechViewVM.cs | 218 +++++++++++++++++++++ .../Views/MachineTechView.xaml | 33 +++- .../Diagnostics/DefaultDiagnosticsFrameProvider.cs | 5 - .../ViewModels/MachineSerialViewVM.cs | 2 - .../Tango.MachineStudio.UI/Views/UpdateView.xaml | 6 +- .../ExtensionMethods/ObjectExtensions.cs | 2 +- .../Tango.Editors/ElementsEditor.xaml.cs | 1 + .../Visual_Studio/Tango.Editors/HybridControl.cs | 1 + .../Tango.Editors/ISupportEditingOperations.cs | 1 + .../Tango.Editors/ISupportUndoRedoOperations.cs | 1 + .../Visual_Studio/Tango.Editors/RelayCommand.cs | 6 + .../Tango.Editors/Tango.Editors.csproj | 2 +- .../Tango.Emulations/Emulators/MachineEmulator.cs | 9 + Software/Visual_Studio/Tango.SharedUI/ViewModel.cs | 2 +- .../Adapters/TcpTransportAdapter.cs | 1 - .../Adapters/UsbTransportAdapter.cs | 1 - .../Tango.Stubs.Installer.vdproj | 51 ++++- 49 files changed, 1557 insertions(+), 30 deletions(-) create mode 100644 Software/Graphics/dancer-big.png create mode 100644 Software/Graphics/dancer-small.png create mode 100644 Software/Graphics/function.png create mode 100644 Software/Graphics/pid.png create mode 100644 Software/Graphics/winder-big.png create mode 100644 Software/Graphics/winder-small.png create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DancerElementEditor.xaml create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DancerElementEditor.xaml.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/PidElementEditor.xaml create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/PidElementEditor.xaml.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/WinderElementEditor.xaml create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/WinderElementEditor.xaml.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/dancer-big.png create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/dancer-small.png create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/function.png create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/pid.png create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/winder-big.png create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/winder-small.png create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/DancerTemplate.xaml create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/DancerTemplate.xaml.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/PidTemplate.xaml create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/PidTemplate.xaml.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/WinderTemplate.xaml create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/WinderTemplate.xaml.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/DancerItem.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/PidItem.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/WinderItem.cs (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs') diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index 3883b9927..254fd1904 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 ae751d129..f23c7df0d 100644 Binary files a/Software/DB/Tango_log.ldf and b/Software/DB/Tango_log.ldf differ diff --git a/Software/Graphics/dancer-big.png b/Software/Graphics/dancer-big.png new file mode 100644 index 000000000..ce3e97b55 Binary files /dev/null and b/Software/Graphics/dancer-big.png differ diff --git a/Software/Graphics/dancer-small.png b/Software/Graphics/dancer-small.png new file mode 100644 index 000000000..df35577d8 Binary files /dev/null and b/Software/Graphics/dancer-small.png differ diff --git a/Software/Graphics/function.png b/Software/Graphics/function.png new file mode 100644 index 000000000..92ccdbf4b Binary files /dev/null and b/Software/Graphics/function.png differ diff --git a/Software/Graphics/pid.png b/Software/Graphics/pid.png new file mode 100644 index 000000000..a0295f7fb Binary files /dev/null and b/Software/Graphics/pid.png differ diff --git a/Software/Graphics/winder-big.png b/Software/Graphics/winder-big.png new file mode 100644 index 000000000..46906084f Binary files /dev/null and b/Software/Graphics/winder-big.png differ diff --git a/Software/Graphics/winder-small.png b/Software/Graphics/winder-small.png new file mode 100644 index 000000000..4a9e5e779 Binary files /dev/null and b/Software/Graphics/winder-small.png differ diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/DbTableViewModel.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/DbTableViewModel.cs index f4a0c6b0b..8366a3e83 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/DbTableViewModel.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/DbTableViewModel.cs @@ -102,16 +102,6 @@ namespace Tango.MachineStudio.DB.ViewModels set { _filter = value; RaisePropertyChangedAuto(); OnFilterChanged(value); } } - private ObservableCollection _validationErrors; - /// - /// Gets or sets the validation errors. - /// - public ObservableCollection ValidationErrors - { - get { return _validationErrors; } - set { _validationErrors = value; RaisePropertyChangedAuto(); } - } - /// /// Gets or sets the dialog OK command. /// diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DancerElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DancerElementEditor.xaml new file mode 100644 index 000000000..3c6ee7d49 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DancerElementEditor.xaml @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DancerElementEditor.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DancerElementEditor.xaml.cs new file mode 100644 index 000000000..a83050194 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DancerElementEditor.xaml.cs @@ -0,0 +1,102 @@ +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; + +namespace Tango.MachineStudio.Technician.Editors +{ + [ContentProperty("InnerContent")] + public partial class DancerElementEditor : ElementEditor + { + /// + /// Initializes a new instance of the class. + /// + public DancerElementEditor() + : base() + { + InitializeComponent(); + } + + /// + /// Initializes a new instance of the class. + /// + /// The framework element. + public DancerElementEditor(DancerItem dancerItem) + : this() + { + DancerItem = dancerItem; + DataContext = DancerItem; + } + + /// + /// Initializes a new instance of the class. + /// + /// The framework element. + /// The bounds. + public DancerElementEditor(DancerItem dancerItem, Rect bounds) + : this(dancerItem) + { + Left = bounds.Left; + Top = bounds.Top; + Width = bounds.Width; + Height = bounds.Height; + } + + private DancerItem _dancerItem; + + public DancerItem DancerItem + { + get { return _dancerItem; } + set { _dancerItem = value; RaisePropertyChanged(nameof(DancerItem)); } + } + + + /// + /// Clones this instance. + /// + /// + public override IElementEditor Clone() + { + try + { + var clonedItem = DancerItem.Clone() as DancerItem; + DancerElementEditor cloned = new DancerElementEditor(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 DancerItem; } + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/PidElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/PidElementEditor.xaml new file mode 100644 index 000000000..6d4f49ace --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/PidElementEditor.xaml @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/PidElementEditor.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/PidElementEditor.xaml.cs new file mode 100644 index 000000000..7e7f9c131 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/PidElementEditor.xaml.cs @@ -0,0 +1,102 @@ +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; + +namespace Tango.MachineStudio.Technician.Editors +{ + [ContentProperty("InnerContent")] + public partial class PidElementEditor : ElementEditor + { + /// + /// Initializes a new instance of the class. + /// + public PidElementEditor() + : base() + { + InitializeComponent(); + } + + /// + /// Initializes a new instance of the class. + /// + /// The framework element. + public PidElementEditor(PidItem pidItem) + : this() + { + PidItem = pidItem; + DataContext = PidItem; + } + + /// + /// Initializes a new instance of the class. + /// + /// The framework element. + /// The bounds. + public PidElementEditor(PidItem pidItem, Rect bounds) + : this(pidItem) + { + Left = bounds.Left; + Top = bounds.Top; + Width = bounds.Width; + Height = bounds.Height; + } + + private PidItem _pidItem; + + public PidItem PidItem + { + get { return _pidItem; } + set { _pidItem = value; RaisePropertyChanged(nameof(PidItem)); } + } + + + /// + /// Clones this instance. + /// + /// + public override IElementEditor Clone() + { + try + { + var clonedItem = PidItem.Clone() as PidItem; + PidElementEditor cloned = new PidElementEditor(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 PidItem; } + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/WinderElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/WinderElementEditor.xaml new file mode 100644 index 000000000..f81597574 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/WinderElementEditor.xaml @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/WinderElementEditor.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/WinderElementEditor.xaml.cs new file mode 100644 index 000000000..5ccb05fc5 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/WinderElementEditor.xaml.cs @@ -0,0 +1,102 @@ +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; + +namespace Tango.MachineStudio.Technician.Editors +{ + [ContentProperty("InnerContent")] + public partial class WinderElementEditor : ElementEditor + { + /// + /// Initializes a new instance of the class. + /// + public WinderElementEditor() + : base() + { + InitializeComponent(); + } + + /// + /// Initializes a new instance of the class. + /// + /// The framework element. + public WinderElementEditor(WinderItem winderItem) + : this() + { + WinderItem = winderItem; + DataContext = WinderItem; + } + + /// + /// Initializes a new instance of the class. + /// + /// The framework element. + /// The bounds. + public WinderElementEditor(WinderItem winderItem, Rect bounds) + : this(winderItem) + { + Left = bounds.Left; + Top = bounds.Top; + Width = bounds.Width; + Height = bounds.Height; + } + + private WinderItem _winderItem; + + public WinderItem WinderItem + { + get { return _winderItem; } + set { _winderItem = value; RaisePropertyChanged(nameof(WinderItem)); } + } + + + /// + /// Clones this instance. + /// + /// + public override IElementEditor Clone() + { + try + { + var clonedItem = WinderItem.Clone() as WinderItem; + WinderElementEditor cloned = new WinderElementEditor(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 WinderItem; } + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/dancer-big.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/dancer-big.png new file mode 100644 index 000000000..ce3e97b55 Binary files /dev/null and b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/dancer-big.png differ diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/dancer-small.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/dancer-small.png new file mode 100644 index 000000000..df35577d8 Binary files /dev/null and b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/dancer-small.png differ diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/function.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/function.png new file mode 100644 index 000000000..92ccdbf4b Binary files /dev/null and b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/function.png differ diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/pid.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/pid.png new file mode 100644 index 000000000..a0295f7fb Binary files /dev/null and b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/pid.png differ diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/winder-big.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/winder-big.png new file mode 100644 index 000000000..46906084f Binary files /dev/null and b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/winder-big.png differ diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/winder-small.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/winder-small.png new file mode 100644 index 000000000..4a9e5e779 Binary files /dev/null and b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/winder-small.png differ diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/DancerTemplate.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/DancerTemplate.xaml new file mode 100644 index 000000000..71112a86e --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/DancerTemplate.xaml @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + Selected Dancer + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/DancerTemplate.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/DancerTemplate.xaml.cs new file mode 100644 index 000000000..0bcd9a797 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/DancerTemplate.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 DancerTemplate : UserControl + { + public DancerTemplate() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/PidTemplate.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/PidTemplate.xaml new file mode 100644 index 000000000..316b9a681 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/PidTemplate.xaml @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + Selected PID Control + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/PidTemplate.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/PidTemplate.xaml.cs new file mode 100644 index 000000000..96f265ba8 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/PidTemplate.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 PidTemplate : UserControl + { + public PidTemplate() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/WinderTemplate.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/WinderTemplate.xaml new file mode 100644 index 000000000..47f6d4380 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/WinderTemplate.xaml @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + Selected Winder + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/WinderTemplate.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/WinderTemplate.xaml.cs new file mode 100644 index 000000000..32ec860c7 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/WinderTemplate.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 WinderTemplate : UserControl + { + public WinderTemplate() + { + 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 27b15cb34..cafa8540c 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 @@ -102,6 +102,15 @@ DigitalOutElementEditor.xaml + + DancerElementEditor.xaml + + + WinderElementEditor.xaml + + + PidElementEditor.xaml + MotorGroupElementEditor.xaml @@ -143,6 +152,15 @@ MotorGroupTemplate.xaml + + DancerTemplate.xaml + + + WinderTemplate.xaml + + + PidTemplate.xaml + ThreadMotionTemplate.xaml @@ -164,6 +182,9 @@ + + + @@ -213,6 +234,18 @@ MSBuild:Compile Designer + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + MSBuild:Compile Designer @@ -265,6 +298,18 @@ MSBuild:Compile Designer + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + MSBuild:Compile Designer @@ -470,5 +515,19 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/DancerItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/DancerItem.cs new file mode 100644 index 000000000..e5651acce --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/DancerItem.cs @@ -0,0 +1,104 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Media; +using System.Xml.Serialization; +using Tango.Core.Commands; +using Tango.BL.Entities; +using Tango.SharedUI.Helpers; +using System.Collections.ObjectModel; + +namespace Tango.MachineStudio.Technician.TechItems +{ + /// + /// Represents a dancer controller item. + /// + /// + [TechItem(15)] + public class DancerItem : TechItem + { + private static List _dancerConfigurations; + /// + /// Gets or sets the winder configurations. + /// + public static List DancerConfigurations + { + get { return _dancerConfigurations; } + set { _dancerConfigurations = value; } + } + + static DancerItem() + { + DancerConfigurations = new List(); + + foreach (var winderType in BL.ObservablesEntitiesAdapter.Instance.HardwareDancerTypes) + { + DancerConfigurations.Add(new HardwareDancer() { HardwareDancerType = winderType }); + } + } + + private HardwareDancerType _hardwareDancerType; + /// + /// Gets or sets the type of the hardware winder. + /// + [XmlIgnore] + public HardwareDancerType HardwareDancerType + { + get { return _hardwareDancerType; } + set + { + _hardwareDancerType = value; RaisePropertyChangedAuto(); TechName = _hardwareDancerType != null ? _hardwareDancerType.Description : null; ItemGuid = value != null ? value.Guid : null; + + if (_hardwareDancerType != null) + { + HardwareDancer = DancerConfigurations.SingleOrDefault(x => x.HardwareDancerType == _hardwareDancerType); + } + } + } + + private HardwareDancer _hardwareDancer; + /// + /// Gets or sets the hardware winder. + /// + [XmlIgnore] + public HardwareDancer HardwareDancer + { + get { return _hardwareDancer; } + set { _hardwareDancer = value; RaisePropertyChangedAuto(); } + } + + /// + /// Initializes a new instance of the class. + /// + public DancerItem() : base() + { + Name = "Dancer"; + Description = "Dancer Controller"; + Image = ResourceHelper.GetImageFromResources("Images/dancer-small.png"); + Color = Colors.White; + HardwareDancer = new HardwareDancer(); + } + + /// + /// Initializes a new instance of the class. + /// + /// Type of the winder. + public DancerItem(HardwareDancerType winderType) : this() + { + HardwareDancerType = winderType; + } + + /// + /// Clones this instance. + /// + /// + public override TechItem Clone() + { + DancerItem cloned = base.Clone() as DancerItem; + cloned.HardwareDancerType = HardwareDancerType; + return cloned; + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/PidItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/PidItem.cs new file mode 100644 index 000000000..a56c3b0c1 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/PidItem.cs @@ -0,0 +1,104 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Media; +using System.Xml.Serialization; +using Tango.Core.Commands; +using Tango.BL.Entities; +using Tango.SharedUI.Helpers; +using System.Collections.ObjectModel; + +namespace Tango.MachineStudio.Technician.TechItems +{ + /// + /// Represents a PID controller item. + /// + /// + [TechItem(12)] + public class PidItem : TechItem + { + private static List _pidConfigurations; + /// + /// Gets or sets the pid configurations. + /// + public static List PidConfigurations + { + get { return _pidConfigurations; } + set { _pidConfigurations = value; } + } + + static PidItem() + { + PidConfigurations = new List(); + + foreach (var pidType in BL.ObservablesEntitiesAdapter.Instance.HardwarePidControlTypes) + { + PidConfigurations.Add(new HardwarePidControl() { HardwarePidControlType = pidType }); + } + } + + private HardwarePidControlType _hardwarePidType; + /// + /// Gets or sets the type of the hardware pid. + /// + [XmlIgnore] + public HardwarePidControlType HardwarePidType + { + get { return _hardwarePidType; } + set + { + _hardwarePidType = value; RaisePropertyChangedAuto(); TechName = _hardwarePidType != null ? _hardwarePidType.Description : null; ItemGuid = value != null ? value.Guid : null; + + if (_hardwarePidType != null) + { + HardwarePid = PidConfigurations.SingleOrDefault(x => x.HardwarePidControlType == _hardwarePidType); + } + } + } + + private HardwarePidControl _hardwarePid; + /// + /// Gets or sets the hardware pid. + /// + [XmlIgnore] + public HardwarePidControl HardwarePid + { + get { return _hardwarePid; } + set { _hardwarePid = value; RaisePropertyChangedAuto(); } + } + + /// + /// Initializes a new instance of the class. + /// + public PidItem() : base() + { + Name = "PID"; + Description = "PID Controller"; + Image = ResourceHelper.GetImageFromResources("Images/function.png"); + Color = Colors.White; + HardwarePid = new HardwarePidControl(); + } + + /// + /// Initializes a new instance of the class. + /// + /// Type of the pid. + public PidItem(HardwarePidControlType pidType) : this() + { + HardwarePidType = pidType; + } + + /// + /// Clones this instance. + /// + /// + public override TechItem Clone() + { + PidItem cloned = base.Clone() as PidItem; + cloned.HardwarePidType = HardwarePidType; + return cloned; + } + } +} 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 e18250594..1071c3511 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 @@ -30,6 +30,9 @@ namespace Tango.MachineStudio.Technician.TechItems [XmlInclude(typeof(MotorGroupItem))] [XmlInclude(typeof(DigitalInItem))] [XmlInclude(typeof(ControllerItem))] + [XmlInclude(typeof(PidItem))] + [XmlInclude(typeof(WinderItem))] + [XmlInclude(typeof(DancerItem))] public abstract class TechItem : ExtendedObject { /// diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/WinderItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/WinderItem.cs new file mode 100644 index 000000000..425baf471 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/WinderItem.cs @@ -0,0 +1,104 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Media; +using System.Xml.Serialization; +using Tango.Core.Commands; +using Tango.BL.Entities; +using Tango.SharedUI.Helpers; +using System.Collections.ObjectModel; + +namespace Tango.MachineStudio.Technician.TechItems +{ + /// + /// Represents a winder controller item. + /// + /// + [TechItem(14)] + public class WinderItem : TechItem + { + private static List _winderConfigurations; + /// + /// Gets or sets the winder configurations. + /// + public static List WinderConfigurations + { + get { return _winderConfigurations; } + set { _winderConfigurations = value; } + } + + static WinderItem() + { + WinderConfigurations = new List(); + + foreach (var winderType in BL.ObservablesEntitiesAdapter.Instance.HardwareWinderTypes) + { + WinderConfigurations.Add(new HardwareWinder() { HardwareWinderType = winderType }); + } + } + + private HardwareWinderType _hardwareWinderType; + /// + /// Gets or sets the type of the hardware winder. + /// + [XmlIgnore] + public HardwareWinderType HardwareWinderType + { + get { return _hardwareWinderType; } + set + { + _hardwareWinderType = value; RaisePropertyChangedAuto(); TechName = _hardwareWinderType != null ? _hardwareWinderType.Description : null; ItemGuid = value != null ? value.Guid : null; + + if (_hardwareWinderType != null) + { + HardwareWinder = WinderConfigurations.SingleOrDefault(x => x.HardwareWinderType == _hardwareWinderType); + } + } + } + + private HardwareWinder _hardwareWinder; + /// + /// Gets or sets the hardware winder. + /// + [XmlIgnore] + public HardwareWinder HardwareWinder + { + get { return _hardwareWinder; } + set { _hardwareWinder = value; RaisePropertyChangedAuto(); } + } + + /// + /// Initializes a new instance of the class. + /// + public WinderItem() : base() + { + Name = "Winder"; + Description = "Winder Controller"; + Image = ResourceHelper.GetImageFromResources("Images/winder-small.png"); + Color = Colors.White; + HardwareWinder = new HardwareWinder(); + } + + /// + /// Initializes a new instance of the class. + /// + /// Type of the winder. + public WinderItem(HardwareWinderType winderType) : this() + { + HardwareWinderType = winderType; + } + + /// + /// Clones this instance. + /// + /// + public override TechItem Clone() + { + WinderItem cloned = base.Clone() as WinderItem; + cloned.HardwareWinderType = HardwareWinderType; + return cloned; + } + } +} 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 4a8cd82a5..9c587b7c8 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 @@ -30,6 +30,7 @@ using Tango.BL.Enumerations; using Tango.BL; using Tango.MachineStudio.Common.EventLogging; using Tango.MachineStudio.Common; +using Tango.Core.Commands; namespace Tango.MachineStudio.Technician.ViewModels { @@ -164,6 +165,21 @@ namespace Tango.MachineStudio.Technician.ViewModels /// public RelayCommand OpenProjectCommand { get; set; } + /// + /// Gets or sets the synchronize hardware configuration command. + /// + public RelayCommand SyncHardwareConfigurationCommand { get; set; } + + /// + /// Gets or sets the upload hardware configuration command. + /// + public RelayCommand UploadHardwareConfigurationCommand { get; set; } + + /// + /// Gets or sets the reset hardware configuration command. + /// + public RelayCommand ResetHardwareConfigurationCommand { get; set; } + #endregion #region Constructors @@ -200,6 +216,10 @@ namespace Tango.MachineStudio.Technician.ViewModels } _diagnosticsFrameProvider.FrameReceived += DiagnosticsFrameProvider_FrameReceived; + + UploadHardwareConfigurationCommand = new RelayCommand(UploadHardwareConfiguration); + SyncHardwareConfigurationCommand = new RelayCommand(SyncHardwareConfiguration); + ResetHardwareConfigurationCommand = new RelayCommand(ResetHardwareConfiguration); } #endregion @@ -489,6 +509,18 @@ namespace Tango.MachineStudio.Technician.ViewModels var editor = CreateElement(bounds, Adapter.TechControllers.FirstOrDefault()); InitControllerItem(editor.ControllerItem); } + else if (item is PidItem) + { + CreateElement(bounds, Adapter.HardwarePidControlTypes.FirstOrDefault()); + } + else if (item is WinderItem) + { + CreateElement(bounds, Adapter.HardwareWinderTypes.FirstOrDefault()); + } + else if (item is DancerItem) + { + CreateElement(bounds, Adapter.HardwareDancerTypes.FirstOrDefault()); + } } /// @@ -588,6 +620,21 @@ namespace Tango.MachineStudio.Technician.ViewModels var editor = CreateElement(item); InitControllerItem(editor.ControllerItem); } + else if (item is PidItem) + { + (item as PidItem).HardwarePidType = Adapter.HardwarePidControlTypes.FirstOrDefault(x => x.Guid == item.ItemGuid); + CreateElement(item); + } + else if (item is WinderItem) + { + (item as WinderItem).HardwareWinderType = Adapter.HardwareWinderTypes.FirstOrDefault(x => x.Guid == item.ItemGuid); + CreateElement(item); + } + else if (item is DancerItem) + { + (item as DancerItem).HardwareDancerType = Adapter.HardwareDancerTypes.FirstOrDefault(x => x.Guid == item.ItemGuid); + CreateElement(item); + } } /// @@ -1229,5 +1276,176 @@ namespace Tango.MachineStudio.Technician.ViewModels } #endregion + + #region Hardware Configuration + + private void SyncHardwareConfiguration() + { + var elements = Elements.ToList(); + + if (MachineOperator != null && MachineOperator.CurrentHardwareConfiguration != null) + { + var config = MachineOperator.CurrentHardwareConfiguration; + + foreach (var motorConfig in config.Motors) + { + var itemConfig = MotorItem.MotorConfigurations.SingleOrDefault(x => x.HardwareMotorType.Code == motorConfig.HardwareMotorType.ToInt32()); + + if (itemConfig != null) + { + motorConfig.MapPrimitivesTo(itemConfig); + } + } + + foreach (var pidConfig in config.PidControls) + { + var itemConfig = PidItem.PidConfigurations.SingleOrDefault(x => x.HardwarePidControlType.Code == pidConfig.HardwarePidControlType.ToInt32()); + + if (itemConfig != null) + { + pidConfig.MapPrimitivesTo(itemConfig); + } + } + + foreach (var winderConfig in config.Winders) + { + var itemConfig = WinderItem.WinderConfigurations.SingleOrDefault(x => x.HardwareWinderType.Code == winderConfig.HardwareWinderType.ToInt32()); + + if (itemConfig != null) + { + winderConfig.MapPrimitivesTo(itemConfig); + } + } + + foreach (var dancerConfig in config.Dancers) + { + var itemConfig = DancerItem.DancerConfigurations.SingleOrDefault(x => x.HardwareDancerType.Code == dancerConfig.HardwareDancerType.ToInt32()); + + if (itemConfig != null) + { + dancerConfig.MapPrimitivesTo(itemConfig); + } + } + + _notification.ShowInfo("Visual elements synced to the last uploaded hardware configuration."); + } + else + { + ResetHardwareConfiguration(); + } + } + + private async void UploadHardwareConfiguration() + { + if (MachineOperator != null) + { + var hw = ApplicationManager.ConnectedMachine.Machine.Configuration.HardwareVersion.Clone(); + + foreach (var motorConfig in hw.HardwareMotors) + { + var itemConfig = MotorItem.MotorConfigurations.SingleOrDefault(x => x.HardwareMotorType.Code == motorConfig.HardwareMotorType.Code); + + if (itemConfig != null) + { + itemConfig.MapPrimitivesTo(motorConfig); + } + } + + foreach (var pidConfig in hw.HardwarePidControls) + { + var itemConfig = PidItem.PidConfigurations.SingleOrDefault(x => x.HardwarePidControlType.Code == pidConfig.HardwarePidControlType.Code); + + if (itemConfig != null) + { + itemConfig.MapPrimitivesTo(pidConfig); + } + } + + foreach (var winderConfig in hw.HardwareWinders) + { + var itemConfig = WinderItem.WinderConfigurations.SingleOrDefault(x => x.HardwareWinderType.Code == winderConfig.HardwareWinderType.Code); + + if (itemConfig != null) + { + itemConfig.MapPrimitivesTo(winderConfig); + } + } + + foreach (var DancerConfig in hw.HardwareDancers) + { + var itemConfig = DancerItem.DancerConfigurations.SingleOrDefault(x => x.HardwareDancerType.Code == DancerConfig.HardwareDancerType.Code); + + if (itemConfig != null) + { + itemConfig.MapPrimitivesTo(DancerConfig); + } + } + + using (_notification.PushTaskItem("Uploading hardware configuration...")) + { + try + { + await MachineOperator.UploadHardwareConfiguration(hw, ApplicationManager.ConnectedMachine.Machine.Configuration); + } + catch (Exception ex) + { + LogManager.Log(ex, "Error uploading hardware configuration."); + _notification.ShowError("An error occurred while trying to upload the hardware configuration." + Environment.NewLine + ex.Message); + } + } + } + } + + private void ResetHardwareConfiguration() + { + if (MachineOperator != null) + { + var hw = ApplicationManager.ConnectedMachine.Machine.Configuration.HardwareVersion; + + foreach (var motorConfig in hw.HardwareMotors) + { + var itemConfig = MotorItem.MotorConfigurations.SingleOrDefault(x => x.HardwareMotorType.Code == motorConfig.HardwareMotorType.Code); + + if (itemConfig != null) + { + motorConfig.MapPrimitivesTo(itemConfig); + } + } + + foreach (var pidConfig in hw.HardwarePidControls) + { + var itemConfig = PidItem.PidConfigurations.SingleOrDefault(x => x.HardwarePidControlType.Code == pidConfig.HardwarePidControlType.Code); + + if (itemConfig != null) + { + pidConfig.MapPrimitivesTo(itemConfig); + } + } + + foreach (var winderConfig in hw.HardwareWinders) + { + var itemConfig = WinderItem.WinderConfigurations.SingleOrDefault(x => x.HardwareWinderType.Code == winderConfig.HardwareWinderType.Code); + + if (itemConfig != null) + { + winderConfig.MapPrimitivesTo(itemConfig); + } + } + + foreach (var dancerConfig in hw.HardwareDancers) + { + var itemConfig = DancerItem.DancerConfigurations.SingleOrDefault(x => x.HardwareDancerType.Code == dancerConfig.HardwareDancerType.Code); + + if (itemConfig != null) + { + dancerConfig.MapPrimitivesTo(itemConfig); + } + } + + _notification.ShowInfo("Visual elements synced to hardware version " + hw.Name + ", " + hw.Version + "."); + } + } + + #endregion } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml index 6d4f3aefd..db97b9de2 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 @@ -16,7 +16,7 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:Tango.MachineStudio.Technician.Views" mc:Ignorable="d" - d:DesignHeight="720" d:DesignWidth="1280" d:DataContext="{d:DesignInstance Type=vm:MachineTechViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MachineTechViewVM}"> + d:DesignHeight="720" d:DesignWidth="1920" d:DataContext="{d:DesignInstance Type=vm:MachineTechViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MachineTechViewVM}"> @@ -153,6 +153,28 @@ + + + + + + + @@ -354,6 +376,15 @@ + + + + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Diagnostics/DefaultDiagnosticsFrameProvider.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Diagnostics/DefaultDiagnosticsFrameProvider.cs index 42eab20a5..d34ef4b96 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Diagnostics/DefaultDiagnosticsFrameProvider.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Diagnostics/DefaultDiagnosticsFrameProvider.cs @@ -19,11 +19,6 @@ namespace Tango.MachineStudio.Common.Diagnostics { private IStudioApplicationManager _application; - /// - /// Occurs when the machine events state provider has changed. - /// - public event EventHandler MachineEventsStateProviderChanged; - private bool _disable; /// /// Disables the frame delivery from the current connected machine and enables the manual push frame method. diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MachineSerialViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MachineSerialViewVM.cs index 219bd9e63..9f366829a 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MachineSerialViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MachineSerialViewVM.cs @@ -21,8 +21,6 @@ namespace Tango.MachineStudio.UI.ViewModels set { _selectedMachine = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); } } - public RelayCommand OKCommand { get; set; } - public MachineSerialViewVM() { OKCommand = new RelayCommand(Accept, () => SelectedMachine != null); diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/UpdateView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/UpdateView.xaml index e34cdb83b..a5c31af3d 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/UpdateView.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/UpdateView.xaml @@ -8,11 +8,11 @@ xmlns:mahApps="http://metro.mahapps.com/winfx/xaml/controls" xmlns:local="clr-namespace:Tango.MachineStudio.UI.Views" mc:Ignorable="d" - d:DesignHeight="1080" d:DesignWidth="1920" DataContext="{Binding UpdateViewVM, Source={StaticResource Locator}}" Background="White" FontSize="20"> + d:DesignHeight="1080" d:DesignWidth="1920" DataContext="{Binding UpdateViewVM, Source={StaticResource Locator}}" FontSize="20"> - + diff --git a/Software/Visual_Studio/Tango.Core/ExtensionMethods/ObjectExtensions.cs b/Software/Visual_Studio/Tango.Core/ExtensionMethods/ObjectExtensions.cs index 9d17bd198..098ce6f30 100644 --- a/Software/Visual_Studio/Tango.Core/ExtensionMethods/ObjectExtensions.cs +++ b/Software/Visual_Studio/Tango.Core/ExtensionMethods/ObjectExtensions.cs @@ -66,7 +66,7 @@ public static class ObjectExtensions { var desProp = destination.GetType().GetProperty(prop.Name, BindingFlags.Public | BindingFlags.Instance); - if (desProp != null && desProp.PropertyType.IsPrimitive) + if (desProp != null && desProp.PropertyType.IsPrimitive && desProp.SetMethod != null) { desProp.SetValue(destination, prop.GetValue(source)); } diff --git a/Software/Visual_Studio/Tango.Editors/ElementsEditor.xaml.cs b/Software/Visual_Studio/Tango.Editors/ElementsEditor.xaml.cs index abd5e5929..98a813fc0 100644 --- a/Software/Visual_Studio/Tango.Editors/ElementsEditor.xaml.cs +++ b/Software/Visual_Studio/Tango.Editors/ElementsEditor.xaml.cs @@ -9,6 +9,7 @@ using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Animation; using System.Windows.Media.Imaging; +using Tango.Core.Commands; using Tango.Editors; namespace Tango.Editors diff --git a/Software/Visual_Studio/Tango.Editors/HybridControl.cs b/Software/Visual_Studio/Tango.Editors/HybridControl.cs index 8b1da701e..0d2fe5336 100644 --- a/Software/Visual_Studio/Tango.Editors/HybridControl.cs +++ b/Software/Visual_Studio/Tango.Editors/HybridControl.cs @@ -9,6 +9,7 @@ using System.Windows.Controls; using System.Windows.Data; using System.Windows.Media; using System.Windows.Media.Imaging; +using Tango.Core.Commands; namespace Tango.Editors { diff --git a/Software/Visual_Studio/Tango.Editors/ISupportEditingOperations.cs b/Software/Visual_Studio/Tango.Editors/ISupportEditingOperations.cs index 539c1f5f9..40c746115 100644 --- a/Software/Visual_Studio/Tango.Editors/ISupportEditingOperations.cs +++ b/Software/Visual_Studio/Tango.Editors/ISupportEditingOperations.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using Tango.Core.Commands; namespace Tango.Editors { diff --git a/Software/Visual_Studio/Tango.Editors/ISupportUndoRedoOperations.cs b/Software/Visual_Studio/Tango.Editors/ISupportUndoRedoOperations.cs index 1e67b2fa5..459f15ba4 100644 --- a/Software/Visual_Studio/Tango.Editors/ISupportUndoRedoOperations.cs +++ b/Software/Visual_Studio/Tango.Editors/ISupportUndoRedoOperations.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using Tango.Core.Commands; namespace Tango.Editors { diff --git a/Software/Visual_Studio/Tango.Editors/RelayCommand.cs b/Software/Visual_Studio/Tango.Editors/RelayCommand.cs index 6042fad93..63a776238 100644 --- a/Software/Visual_Studio/Tango.Editors/RelayCommand.cs +++ b/Software/Visual_Studio/Tango.Editors/RelayCommand.cs @@ -18,6 +18,7 @@ namespace Tango.Editors readonly Predicate canExecute; readonly Action execute; private Action saveProject; + private RelayCommand syncHardwareConfigurationCommand; #endregion fields #region constructors @@ -46,6 +47,11 @@ namespace Tango.Editors this.saveProject = saveProject; } + public RelayCommand(RelayCommand syncHardwareConfigurationCommand) + { + this.syncHardwareConfigurationCommand = syncHardwareConfigurationCommand; + } + #endregion constructors #region methods diff --git a/Software/Visual_Studio/Tango.Editors/Tango.Editors.csproj b/Software/Visual_Studio/Tango.Editors/Tango.Editors.csproj index 02a18d94f..8b8e8d802 100644 --- a/Software/Visual_Studio/Tango.Editors/Tango.Editors.csproj +++ b/Software/Visual_Studio/Tango.Editors/Tango.Editors.csproj @@ -137,7 +137,7 @@ - + diff --git a/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs b/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs index 4220715fb..cad9e86d4 100644 --- a/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs +++ b/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs @@ -23,6 +23,7 @@ using Tango.PMR.Debugging; using Tango.BL.Enumerations; using Tango.BL; using Tango.PMR.Connection; +using Tango.PMR.Hardware; namespace Tango.Emulations.Emulators { @@ -214,6 +215,9 @@ namespace Tango.Emulations.Emulators case MessageType.ConnectRequest: HandleConnectRequest(MessageFactory.ParseTangoMessageFromContainer(container)); break; + case MessageType.UploadHardwareConfigurationRequest: + HandleUploadHardwareConfigurationRequest(MessageFactory.ParseTangoMessageFromContainer(container)); + break; } } @@ -650,6 +654,11 @@ namespace Tango.Emulations.Emulators } + private void HandleUploadHardwareConfigurationRequest(TangoMessage request) + { + Transporter.SendResponse(new UploadHardwareConfigurationResponse(), request.Container.Token); + } + #endregion #region Public Methods diff --git a/Software/Visual_Studio/Tango.SharedUI/ViewModel.cs b/Software/Visual_Studio/Tango.SharedUI/ViewModel.cs index 4418ca437..3b974d172 100644 --- a/Software/Visual_Studio/Tango.SharedUI/ViewModel.cs +++ b/Software/Visual_Studio/Tango.SharedUI/ViewModel.cs @@ -40,7 +40,7 @@ namespace Tango.SharedUI public ObservableCollection ValidationErrors { get { return _validationErrors; } - private set { _validationErrors = value; RaisePropertyChangedAuto(); } + protected set { _validationErrors = value; RaisePropertyChangedAuto(); } } /// diff --git a/Software/Visual_Studio/Tango.Transport/Adapters/TcpTransportAdapter.cs b/Software/Visual_Studio/Tango.Transport/Adapters/TcpTransportAdapter.cs index 4a0b47fe4..38ba29e5c 100644 --- a/Software/Visual_Studio/Tango.Transport/Adapters/TcpTransportAdapter.cs +++ b/Software/Visual_Studio/Tango.Transport/Adapters/TcpTransportAdapter.cs @@ -23,7 +23,6 @@ namespace Tango.Transport.Adapters private TcpClient _socket; private Thread _pullThread; private bool _initializedFromConstructor; - private LogManager LogManager = LogManager.Default; #region Properties diff --git a/Software/Visual_Studio/Tango.Transport/Adapters/UsbTransportAdapter.cs b/Software/Visual_Studio/Tango.Transport/Adapters/UsbTransportAdapter.cs index 06d0d5d31..75c4eee0e 100644 --- a/Software/Visual_Studio/Tango.Transport/Adapters/UsbTransportAdapter.cs +++ b/Software/Visual_Studio/Tango.Transport/Adapters/UsbTransportAdapter.cs @@ -16,7 +16,6 @@ namespace Tango.Transport.Adapters public class UsbTransportAdapter : TransportAdapterBase { private SerialPort _serialPort; //Serial port instance used to communicate over the serial port. - private LogManager LogManager = LogManager.Default; /// /// Gets or sets the baud rate. diff --git a/Software/Visual_Studio/Utilities/Tango.Stubs.Installer/Tango.Stubs.Installer.vdproj b/Software/Visual_Studio/Utilities/Tango.Stubs.Installer/Tango.Stubs.Installer.vdproj index e35dcdb3c..0a54fbcd7 100644 --- a/Software/Visual_Studio/Utilities/Tango.Stubs.Installer/Tango.Stubs.Installer.vdproj +++ b/Software/Visual_Studio/Utilities/Tango.Stubs.Installer/Tango.Stubs.Installer.vdproj @@ -249,6 +249,12 @@ } "Entry" { + "MsmKey" = "8:_C5A4AB00302044959F446E92967BBAD4" + "OwnerKey" = "8:_UNDEFINED" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { "MsmKey" = "8:_D2FFB7AB335C92855094B6988900F58C" "OwnerKey" = "8:_8F0D060313A40E3D6C4B196C5819AA1F" "MsmSig" = "8:_UNDEFINED" @@ -310,6 +316,12 @@ "Entry" { "MsmKey" = "8:_UNDEFINED" + "OwnerKey" = "8:_C5A4AB00302044959F446E92967BBAD4" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_UNDEFINED" "OwnerKey" = "8:_E6DED22BB43E475B9794561C384D2713" "MsmSig" = "8:_UNDEFINED" } @@ -447,7 +459,7 @@ "DisplayName" = "8:Debug" "IsDebugOnly" = "11:TRUE" "IsReleaseOnly" = "11:FALSE" - "OutputFilename" = "8:..\\..\\Build\\Debug\\Installers\\Tango Stubs Installer v1.1.msi" + "OutputFilename" = "8:..\\..\\Build\\Debug\\Installers\\Tango Stubs Installer v1.2.msi" "PackageFilesAs" = "3:2" "PackageFileSize" = "3:-2147483648" "CabType" = "3:1" @@ -1118,6 +1130,37 @@ "IsDependency" = "11:TRUE" "IsolateTo" = "8:" } + "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_C5A4AB00302044959F446E92967BBAD4" + { + "AssemblyRegister" = "3:1" + "AssemblyIsInGAC" = "11:FALSE" + "AssemblyAsmDisplayName" = "8:System.Security.Cryptography.Algorithms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" + "ScatterAssemblies" + { + "_C5A4AB00302044959F446E92967BBAD4" + { + "Name" = "8:System.Security.Cryptography.Algorithms.dll" + "Attributes" = "3:512" + } + } + "SourcePath" = "8:..\\..\\packages\\System.Security.Cryptography.Algorithms.4.3.1\\lib\\net46\\System.Security.Cryptography.Algorithms.dll" + "TargetName" = "8:" + "Tag" = "8:" + "Folder" = "8:_D5AAD35A4ABE407AA40E02371659B408" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:FALSE" + "IsDependency" = "11:FALSE" + "IsolateTo" = "8:" + } "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_D2FFB7AB335C92855094B6988900F58C" { "AssemblyRegister" = "3:1" @@ -1329,15 +1372,15 @@ { "Name" = "8:Microsoft Visual Studio" "ProductName" = "8:Tango Stubs GUI" - "ProductCode" = "8:{3554CC06-FF4C-4412-931B-177393459D26}" - "PackageCode" = "8:{D0A7E8A8-473F-46F8-990A-21F9BF3B3007}" + "ProductCode" = "8:{C7D785F4-5FA2-43A8-9313-24EA1F9CDE69}" + "PackageCode" = "8:{81812BC7-BE61-49B8-9983-095F63F59C57}" "UpgradeCode" = "8:{72B680FB-E47D-486A-A81E-6C035F2EBA42}" "AspNetVersion" = "8:4.0.30319.0" "RestartWWWService" = "11:FALSE" "RemovePreviousVersions" = "11:FALSE" "DetectNewerInstalledVersion" = "11:TRUE" "InstallAllUsers" = "11:FALSE" - "ProductVersion" = "8:1.1" + "ProductVersion" = "8:1.2" "Manufacturer" = "8:Twine" "ARPHELPTELEPHONE" = "8:" "ARPHELPLINK" = "8:" -- cgit v1.3.1