aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Modules
diff options
context:
space:
mode:
authorShlomo Hecht <shlomo@twine-s.com>2018-10-11 10:26:41 +0300
committerShlomo Hecht <shlomo@twine-s.com>2018-10-11 10:26:41 +0300
commit37293ed1bf4ca876d9b90a20cfd3e4ead8f4bbf9 (patch)
treedb6a793c1b43215cc9ddbb092b9d33f6781c9e5e /Software/Visual_Studio/MachineStudio/Modules
parentb1c89925cd6e6da9666c7897f056634bf964dcb3 (diff)
parent469ba6f2c0fdeeb942578084c3c6c1d76d040c2d (diff)
downloadTango-37293ed1bf4ca876d9b90a20cfd3e4ead8f4bbf9.tar.gz
Tango-37293ed1bf4ca876d9b90a20cfd3e4ead8f4bbf9.zip
Merge branch 'master' of https://twinetfs.visualstudio.com/Tango/_git/Tango
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules')
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Tango.MachineStudio.ColorLab.csproj2
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/CalibrationDataPointVM.cs15
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/CalibrationDataVM.cs30
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/CalibrationDataViewVM.cs75
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/MainViewVM.cs21
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Views/CalibrationDataView.xaml10
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Tango.MachineStudio.DB.csproj2
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Tango.MachineStudio.DataCapture.csproj2
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj2
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs2
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml2
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Tango.MachineStudio.HardwareDesigner.csproj2
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Tango.MachineStudio.Logging.csproj2
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Tango.MachineStudio.Logging_5q2jsctg_wpftmp.csproj2
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ViewModels/ApplicationLogsViewVM.cs59
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Views/ApplicationLogsView.xaml28
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Tango.MachineStudio.MachineDesigner.csproj2
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/App.config8
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/RMLModule.cs2
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Tango.MachineStudio.RML.csproj2
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs127
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlView.xaml35
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlView.xaml.cs5
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlsView.xaml44
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/Tango.MachineStudio.Stubs.csproj2
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/Tango.MachineStudio.Synchronization.csproj2
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Converters/DecimalPlacesToStringFormatConverter.cs28
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Converters/ValveStateComparerToBooleanConverter.cs34
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MultiGraphElementEditor.xaml11
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/SingleGraphElementEditor.xaml11
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/ValveElementEditor.xaml191
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/ValveElementEditor.xaml.cs103
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/valve.pngbin0 -> 850 bytes
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/BreakSensorTemplate.xaml2
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/HeaterTemplate.xaml2
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/MultiGraphTemplate.xaml11
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/SingleGraphTemplate.xaml11
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/ValveTemplate.xaml43
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/ValveTemplate.xaml.cs28
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Tango.MachineStudio.Technician.csproj31
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechGraphController.cs29
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MultiGraphItem.cs84
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/SingleGraphItem.cs97
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/TechItem.cs3
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/ValveItem.cs117
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs200
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml20
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Tango.MachineStudio.UsersAndRoles.csproj2
48 files changed, 1315 insertions, 228 deletions
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 b4ab87be6..6c94271a2 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
@@ -8,7 +8,7 @@
<OutputType>library</OutputType>
<RootNamespace>Tango.MachineStudio.ColorLab</RootNamespace>
<AssemblyName>Tango.MachineStudio.ColorLab</AssemblyName>
- <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
+ <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
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 33110d50e..7d3dfdd0e 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
@@ -4,6 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Tango.Core;
+using Tango.PMR.ColorLab;
using Tango.SharedUI;
namespace Tango.MachineStudio.ColorLab.ViewModels
@@ -45,5 +46,19 @@ namespace Tango.MachineStudio.ColorLab.ViewModels
X = x;
Y = y;
}
+
+ public CalibrationDataPointVM(CalibrationPoint calibrationPoint) : this(calibrationPoint.X, calibrationPoint.Y)
+ {
+
+ }
+
+ public CalibrationPoint ToPMR()
+ {
+ return new CalibrationPoint()
+ {
+ X = X,
+ Y = Y,
+ };
+ }
}
}
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 8fe8ec4ac..2d332bec2 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
@@ -20,23 +20,6 @@ namespace Tango.MachineStudio.ColorLab.ViewModels
set { _liquidType = value; RaisePropertyChangedAuto(); }
}
-
- private String _name;
-
- public String Name
- {
- get { return _name; }
- set { _name = value; RaisePropertyChangedAuto(); }
- }
-
- private int _color;
-
- public int Color
- {
- get { return _color; }
- set { _color = value; RaisePropertyChangedAuto(); }
- }
-
private IdsPack _idsPack;
public IdsPack IdsPack
@@ -81,9 +64,20 @@ namespace Tango.MachineStudio.ColorLab.ViewModels
}
}
- public CalibrationDataVM()
+ private CalibrationDataVM()
{
CalibrationPoints = new ObservableCollection<CalibrationDataPointVM>();
}
+
+ public CalibrationDataVM(IdsPack pack) : this()
+ {
+ IdsPack = pack;
+ LiquidType = pack.LiquidType;
+ }
+
+ public CalibrationDataVM(LiquidType liquidType) : this()
+ {
+ LiquidType = liquidType;
+ }
}
}
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
index c9c83dde0..106013b51 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/CalibrationDataViewVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/CalibrationDataViewVM.cs
@@ -1,16 +1,22 @@
-using System;
+using Microsoft.Win32;
+using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using Tango.BL.Calibration;
+using Tango.Core.Commands;
using Tango.MachineStudio.Common;
+using Tango.MachineStudio.Common.Notifications;
using Tango.SharedUI;
namespace Tango.MachineStudio.ColorLab.ViewModels
{
public class CalibrationDataViewVM : ViewModel
{
+ private INotificationProvider _notification;
+
private ObservableCollection<CalibrationDataVM> _liquidsCalibrationData;
/// <summary>
/// Gets or sets the liquids calibration data.
@@ -22,20 +28,83 @@ namespace Tango.MachineStudio.ColorLab.ViewModels
}
/// <summary>
+ /// Gets or sets the import excel command.
+ /// </summary>
+ public RelayCommand<CalibrationDataVM> ImportExcelCommand { get; set; }
+
+ /// <summary>
+ /// Gets or sets the export excel command.
+ /// </summary>
+ public RelayCommand<CalibrationDataVM> ExportExcelCommand { get; set; }
+
+ /// <summary>
/// Initializes a new instance of the <see cref="CalibrationDataViewVM"/> class.
/// </summary>
- public CalibrationDataViewVM()
+ public CalibrationDataViewVM(INotificationProvider notificationProvider)
{
+ _notification = notificationProvider;
+
LiquidsCalibrationData = new ObservableCollection<CalibrationDataVM>();
+
+ ImportExcelCommand = new RelayCommand<CalibrationDataVM>(ImportExcel);
+ ExportExcelCommand = new RelayCommand<CalibrationDataVM>(ExportExcel);
}
/// <summary>
/// Initializes a new instance of the <see cref="CalibrationDataViewVM"/> class.
/// </summary>
/// <param name="liquidsCalibrationData">The liquids calibration data.</param>
- public CalibrationDataViewVM(ObservableCollection<CalibrationDataVM> liquidsCalibrationData)
+ public CalibrationDataViewVM(INotificationProvider notificationProvider, ObservableCollection<CalibrationDataVM> liquidsCalibrationData) : this(notificationProvider)
{
LiquidsCalibrationData = liquidsCalibrationData;
}
+
+ private void ImportExcel(CalibrationDataVM vm)
+ {
+ OpenFileDialog dlg = new OpenFileDialog();
+
+ try
+ {
+ dlg.Title = $"Import excel calibration file for {vm.LiquidType.Name}";
+ dlg.Filter = "Excel Files|*.xlsx";
+ if (dlg.ShowDialog().Value)
+ {
+ vm.CalibrationPoints.Clear();
+ var points = CalibrationHelper.ImportCalibrationDataFromExcel(dlg.FileName);
+
+ foreach (var p in points)
+ {
+ vm.CalibrationPoints.Add(new CalibrationDataPointVM(p));
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ LogManager.Log(ex, "Error importing excel file " + dlg.FileName);
+ _notification.ShowError("An error occurred while trying to import the selected excel file. Please check the file format if valid and is available to read.");
+ }
+ }
+
+ private void ExportExcel(CalibrationDataVM vm)
+ {
+ SaveFileDialog dlg = new SaveFileDialog();
+ try
+ {
+ dlg.Title = $"Export excel calibration file for {vm.LiquidType.Name}";
+ dlg.Filter = "Excel Files|*.xlsx";
+ dlg.DefaultExt = ".xlsx";
+ dlg.FileName = $"CData_{vm.LiquidType.Name}_v{vm.LiquidType.Version}.xlsx";
+ if (dlg.ShowDialog().Value)
+ {
+ var points = vm.CalibrationPoints.Select(x => x.ToPMR()).ToList();
+ CalibrationHelper.ExportCalibrationDataToExcel(points, dlg.FileName);
+ }
+ }
+ catch (Exception ex)
+ {
+ LogManager.Log(ex, "Error exporting excel file " + dlg.FileName);
+ _notification.ShowError("An error occurred while trying to export the calibration data.");
+ }
+ }
}
}
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 d0fa80a20..33090a640 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
@@ -329,10 +329,10 @@ namespace Tango.MachineStudio.ColorLab.ViewModels
//calData.LiquidType = (PMR.ColorLab.LiquidType)vm.IdsPack.LiquidType.Code;
//calData.CalibrationPoints.AddRange(vm.CalibrationPoints.Select(x => new CalibrationPoint() { X = x.X, Y = x.Y }));
- inputLiquid.CalibrationData = Cat.CreateDemoCalibrationData((PMR.ColorLab.LiquidType)vm.IdsPack.LiquidType.Code);
+ inputLiquid.CalibrationData = Cat.CreateDemoCalibrationData((PMR.ColorLab.LiquidType)vm.LiquidType.Code);
- inputLiquid.LiquidType = (PMR.ColorLab.LiquidType)vm.IdsPack.LiquidType.Code;
- inputLiquid.MaxNanoliterPerCentimeter = LiquidTypesRmls.SingleOrDefault(x => x.LiquidType.Code == vm.IdsPack.LiquidType.Code).MaxNlPerCm;
+ inputLiquid.LiquidType = (PMR.ColorLab.LiquidType)vm.LiquidType.Code;
+ inputLiquid.MaxNanoliterPerCentimeter = LiquidTypesRmls.SingleOrDefault(x => x.LiquidType.Code == vm.LiquidType.Code).MaxNlPerCm;
input.InputCoordinates.InputLiquids.Add(inputLiquid);
}
@@ -525,10 +525,10 @@ namespace Tango.MachineStudio.ColorLab.ViewModels
//calData.LiquidType = (PMR.ColorLab.LiquidType)vm.IdsPack.LiquidType.Code;
//calData.CalibrationPoints.AddRange(vm.CalibrationPoints.Select(x => new CalibrationPoint() { X = x.X, Y = x.Y }));
- inputLiquid.CalibrationData = Cat.CreateDemoCalibrationData((PMR.ColorLab.LiquidType)vm.IdsPack.LiquidType.Code);
+ inputLiquid.CalibrationData = Cat.CreateDemoCalibrationData((PMR.ColorLab.LiquidType)vm.LiquidType.Code);
- inputLiquid.LiquidType = (PMR.ColorLab.LiquidType)vm.IdsPack.LiquidType.Code;
- inputLiquid.MaxNanoliterPerCentimeter = LiquidTypesRmls.SingleOrDefault(x => x.LiquidType.Code == vm.IdsPack.LiquidType.Code).MaxNlPerCm;
+ inputLiquid.LiquidType = (PMR.ColorLab.LiquidType)vm.LiquidType.Code;
+ inputLiquid.MaxNanoliterPerCentimeter = LiquidTypesRmls.SingleOrDefault(x => x.LiquidType.Code == vm.LiquidType.Code).MaxNlPerCm;
inputLiquid.Volume = LiquidVolumes.SingleOrDefault(x => x.IdsPack == vm.IdsPack).Volume;
input.InputCoordinates.InputLiquids.Add(inputLiquid);
@@ -573,22 +573,19 @@ namespace Tango.MachineStudio.ColorLab.ViewModels
//RmlProcessParametersTableGroup = SelectedRML.ProcessParametersTablesGroups.ToList().SingleOrDefault(x => x.Active);
LiquidsCalibrationData = new ObservableCollection<CalibrationDataVM>();
- CalibrationDataViewVM = new CalibrationDataViewVM(LiquidsCalibrationData);
+ CalibrationDataViewVM = new CalibrationDataViewVM(_notification, LiquidsCalibrationData);
LiquidsCalibrationData.EnableCrossThreadOperations();
foreach (var idsPack in SelectedMachine.Configuration.NoneEmptyIdsPacks.OrderBy(x => x.PackIndex))
{
- CalibrationDataVM vm = new CalibrationDataVM();
- vm.Name = idsPack.LiquidType.Name;
- vm.Color = idsPack.LiquidType.Color;
- vm.IdsPack = idsPack;
+ CalibrationDataVM vm = new CalibrationDataVM(idsPack);
var cat = idsPack.LiquidType.Cats.FirstOrDefault(x => x.Machine == SelectedMachine && x.Rml == SelectedRML);
if (cat != null)
{
var calData = cat.GetCalibrationData();
- vm.CalibrationPoints = calData.CalibrationPoints.Select(x => new CalibrationDataPointVM(x.X, x.Y)).ToObservableCollection();
+ vm.CalibrationPoints = calData.CalibrationPoints.Select(x => new CalibrationDataPointVM(x)).ToObservableCollection();
}
InvokeUINow(() =>
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
index 28279bd50..3c9723b30 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Views/CalibrationDataView.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Views/CalibrationDataView.xaml
@@ -28,23 +28,23 @@
<ItemsControl.ItemTemplate>
<DataTemplate>
- <DockPanel Width="220">
+ <DockPanel Width="240">
<StackPanel DockPanel.Dock="Top">
<StackPanel DockPanel.Dock="Right" VerticalAlignment="Bottom" HorizontalAlignment="Right" Orientation="Horizontal" Margin="0 0 5 0">
- <Button Style="{StaticResource MaterialDesignFlatButton}" Padding="0" ToolTip="Import from excel" Width="30">
+ <Button Style="{StaticResource MaterialDesignFlatButton}" Padding="0" ToolTip="Import from excel" Width="30" Command="{Binding RelativeSource={RelativeSource AncestorType=local:CalibrationDataView},Path=DataContext.ImportExcelCommand}" CommandParameter="{Binding}">
<materialDesign:PackIcon Kind="Download" Foreground="Black" />
</Button>
- <Button Style="{StaticResource MaterialDesignFlatButton}" Padding="0" ToolTip="Export to excel" Width="30">
+ <Button Style="{StaticResource MaterialDesignFlatButton}" Padding="0" ToolTip="Export to excel" Width="30" Command="{Binding RelativeSource={RelativeSource AncestorType=local:CalibrationDataView},Path=DataContext.ExportExcelCommand}" CommandParameter="{Binding}">
<materialDesign:PackIcon Kind="Upload" Foreground="Black" />
</Button>
</StackPanel>
<Border Padding="2" Margin="5" CornerRadius="3">
<Border.Background>
- <SolidColorBrush Opacity="0.4" Color="{Binding Color,Converter={StaticResource ColorToIntegerConverter}}"></SolidColorBrush>
+ <SolidColorBrush Opacity="0.4" Color="{Binding LiquidType.Color,Converter={StaticResource ColorToIntegerConverter}}"></SolidColorBrush>
</Border.Background>
- <TextBlock Text="{Binding Name}" HorizontalAlignment="Center" Foreground="Black"></TextBlock>
+ <TextBlock Text="{Binding LiquidType.Name}" HorizontalAlignment="Center" Foreground="Black"></TextBlock>
</Border>
</StackPanel>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Tango.MachineStudio.DB.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Tango.MachineStudio.DB.csproj
index 259f2f652..e719464f8 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Tango.MachineStudio.DB.csproj
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Tango.MachineStudio.DB.csproj
@@ -8,7 +8,7 @@
<OutputType>library</OutputType>
<RootNamespace>Tango.MachineStudio.DB</RootNamespace>
<AssemblyName>Tango.MachineStudio.DB</AssemblyName>
- <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
+ <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Tango.MachineStudio.DataCapture.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Tango.MachineStudio.DataCapture.csproj
index 15df43f6e..7c1ffc843 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Tango.MachineStudio.DataCapture.csproj
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Tango.MachineStudio.DataCapture.csproj
@@ -8,7 +8,7 @@
<OutputType>library</OutputType>
<RootNamespace>Tango.MachineStudio.DataCapture</RootNamespace>
<AssemblyName>Tango.MachineStudio.DataCapture</AssemblyName>
- <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
+ <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj
index cbaec81eb..dca470eed 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj
@@ -8,7 +8,7 @@
<OutputType>library</OutputType>
<RootNamespace>Tango.MachineStudio.Developer</RootNamespace>
<AssemblyName>Tango.MachineStudio.Developer</AssemblyName>
- <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
+ <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
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 6c3e31325..1b9720335 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
@@ -782,7 +782,7 @@ namespace Tango.MachineStudio.Developer.ViewModels
{
while (true)
{
- if (!_disable_gamut_check && IsJobVisible && ActiveJob != null && ActiveJob.Segments != null)
+ if (!_disable_gamut_check && IsJobVisible && IsVisible && ActiveJob != null && ActiveJob.Segments != null)
{
try
{
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 3f1f3b486..b9c2b816f 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
@@ -963,7 +963,7 @@
<Run FontFamily="{StaticResource digital-7}" Text="{Binding OffsetPercent,StringFormat={}{0:F1}%}"></Run>
<Run Foreground="Gray" Text="{Binding OffsetMeters,Mode=OneWay,StringFormat={} ( {0:F1}m )}"></Run>
</TextBlock>
- <Slider ValueChanged="Offset_Slider_ValueChanged" Style="{StaticResource GradientOffsetSlider}" SmallChange="0.1" IsSnapToTickEnabled="True" TickFrequency="0.1" Margin="0 20 0 0" HorizontalAlignment="Center" Width="500" Value="{Binding OffsetPercent}" IsEnabled="{Binding IsMiddle}">
+ <Slider ValueChanged="Offset_Slider_ValueChanged" Style="{StaticResource GradientOffsetSlider}" SmallChange="0.1" IsSnapToTickEnabled="True" TickFrequency="0.1" Margin="0 20 0 0" HorizontalAlignment="Center" Width="300" Value="{Binding OffsetPercent}" IsEnabled="{Binding IsMiddle}">
<Slider.Foreground>
<SolidColorBrush Color="{Binding Color}"></SolidColorBrush>
</Slider.Foreground>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Tango.MachineStudio.HardwareDesigner.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Tango.MachineStudio.HardwareDesigner.csproj
index efa7a669c..6f65b40c0 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Tango.MachineStudio.HardwareDesigner.csproj
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Tango.MachineStudio.HardwareDesigner.csproj
@@ -8,7 +8,7 @@
<OutputType>library</OutputType>
<RootNamespace>Tango.MachineStudio.HardwareDesigner</RootNamespace>
<AssemblyName>Tango.MachineStudio.HardwareDesigner</AssemblyName>
- <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
+ <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Tango.MachineStudio.Logging.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Tango.MachineStudio.Logging.csproj
index f14bfade4..b81ba731d 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Tango.MachineStudio.Logging.csproj
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Tango.MachineStudio.Logging.csproj
@@ -8,7 +8,7 @@
<OutputType>library</OutputType>
<RootNamespace>Tango.MachineStudio.Logging</RootNamespace>
<AssemblyName>Tango.MachineStudio.Logging</AssemblyName>
- <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
+ <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Tango.MachineStudio.Logging_5q2jsctg_wpftmp.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Tango.MachineStudio.Logging_5q2jsctg_wpftmp.csproj
index 1c2b96de8..f6fa01ae7 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Tango.MachineStudio.Logging_5q2jsctg_wpftmp.csproj
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Tango.MachineStudio.Logging_5q2jsctg_wpftmp.csproj
@@ -8,7 +8,7 @@
<OutputType>library</OutputType>
<RootNamespace>Tango.MachineStudio.Logging</RootNamespace>
<AssemblyName>Tango.MachineStudio.Logging</AssemblyName>
- <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
+ <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ViewModels/ApplicationLogsViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ViewModels/ApplicationLogsViewVM.cs
index b0bc613bd..3e0e3ab84 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ViewModels/ApplicationLogsViewVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ViewModels/ApplicationLogsViewVM.cs
@@ -13,6 +13,7 @@ using Tango.MachineStudio.Logging.Navigation;
using Tango.MachineStudio.Logging.Parsing;
using Tango.MachineStudio.Logging.Views;
using Tango.SharedUI;
+using Tango.SharedUI.Components;
namespace Tango.MachineStudio.Logging.ViewModels
{
@@ -41,6 +42,8 @@ namespace Tango.MachineStudio.Logging.ViewModels
set { _logsViewSource = value; RaisePropertyChangedAuto(); }
}
+ public SelectedObjectCollection<LogCategory> SelectedLogCategories { get; set; }
+
private String _filter;
public String Filter
{
@@ -118,22 +121,7 @@ namespace Tango.MachineStudio.Logging.ViewModels
{
_realTimePaused = value;
RaisePropertyChangedAuto();
-
- if (!_realTimePaused)
- {
- LogsViewSource.Filter = null;
- _realTimeLogs.InsertRange(0, _pausedLogs);
- _pausedLogs.Clear();
- }
- else
- {
- LogsViewSource.Filter = (x) =>
- {
- if (String.IsNullOrWhiteSpace(Filter)) return true;
- LogItemBase log = x as LogItemBase;
- return log.Message.ToLower().Contains(Filter.ToLower());
- };
- }
+ ApplyLogsFilter();
}
}
@@ -149,6 +137,27 @@ namespace Tango.MachineStudio.Logging.ViewModels
NavigateToHomeCommand = new RelayCommand(() => navigation.NavigateTo(LoggingNavigationView.HomeView));
+ SelectedLogCategories = new SelectedObjectCollection<LogCategory>(new ObservableCollection<LogCategory>()
+ {
+ LogCategory.Info,
+ LogCategory.Warning,
+ LogCategory.Error,
+ LogCategory.Critical,
+ LogCategory.Debug,
+ }, new ObservableCollection<LogCategory>()
+ {
+ LogCategory.Info,
+ LogCategory.Warning,
+ LogCategory.Error,
+ LogCategory.Critical,
+ LogCategory.Debug,
+ });
+
+ SelectedLogCategories.SynchedSource.CollectionChanged += (_, __) =>
+ {
+ ApplyLogsFilter();
+ };
+
_parser = new ApplicationLogFileParser();
_logFiles = _parser.GetLogFiles();
@@ -177,6 +186,24 @@ namespace Tango.MachineStudio.Logging.ViewModels
_is_debug = LogManager.Categories.Contains(LogCategory.Debug);
}
+ private void ApplyLogsFilter()
+ {
+ if ((_realTimePaused && _isRealTime) || !_isRealTime)
+ {
+ LogsViewSource.Filter = (x) =>
+ {
+ LogItemBase log = x as LogItemBase;
+ return (SelectedLogCategories.SynchedSource.Contains(log.Category) && (String.IsNullOrWhiteSpace(Filter) || log.Message.ToLower().Contains(Filter.ToLower())));
+ };
+ }
+ else
+ {
+ LogsViewSource.Filter = null;
+ _realTimeLogs.InsertRange(0, _pausedLogs);
+ _pausedLogs.Clear();
+ }
+ }
+
private void LogManager_NewLog(object sender, LogItemBase log)
{
if (log.Category == LogCategory.Debug && !DisplayDebug) return;
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Views/ApplicationLogsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Views/ApplicationLogsView.xaml
index eeb7204d1..b67b14612 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Views/ApplicationLogsView.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Views/ApplicationLogsView.xaml
@@ -78,7 +78,7 @@
</StackPanel>
</Border>
- <Button Style="{StaticResource MaterialDesignFlatButton}" Command="{Binding ToggleRealTimePaused}" Padding="0" Height="50" Width="50" Foreground="#202020" ToolTip="Pause/Resume Real-Time">
+ <Button Style="{StaticResource MaterialDesignFlatButton}" IsEnabled="{Binding IsRealTime}" Command="{Binding ToggleRealTimePaused}" Padding="0" Height="50" Width="50" Foreground="#202020" ToolTip="Pause/Resume Real-Time">
<materialDesign:PackIcon Width="50" Height="50">
<materialDesign:PackIcon.Style>
<Style TargetType="materialDesign:PackIcon">
@@ -93,14 +93,34 @@
</materialDesign:PackIcon>
</Button>
- <Button Margin="20 0 0 0" Background="#FF7777" BorderBrush="#FF7777" ToolTip="Clear real-time logs" Command="{Binding ClearRealTimeLogsCommand}">
+ <Button Margin="20 0 0 0" Background="#FF7777" BorderBrush="#FF7777" IsEnabled="{Binding IsRealTime}" ToolTip="Clear real-time logs" Command="{Binding ClearRealTimeLogsCommand}">
<StackPanel Orientation="Horizontal">
<materialDesign:PackIcon Width="24" Height="24" Kind="DeleteSweep" />
<TextBlock VerticalAlignment="Center" Margin="10 0 0 0">CLEAR</TextBlock>
</StackPanel>
</Button>
- <CheckBox VerticalAlignment="Center" Margin="20 0 0 0" IsChecked="{Binding DisplayDebug}" ToolTip="Hide/Display debug logs (applies only when debug logs are enabled in the settings file)">Process Debug Logs</CheckBox>
+ <Border BorderThickness="1" BorderBrush="#3B3B3B" VerticalAlignment="Center" Padding="10 7" CornerRadius="5" Margin="30 0 0 0">
+ <StackPanel>
+ <ItemsControl VerticalAlignment="Center" ItemsSource="{Binding SelectedLogCategories}">
+ <ItemsControl.ItemsPanel>
+ <ItemsPanelTemplate>
+ <StackPanel Orientation="Horizontal" />
+ </ItemsPanelTemplate>
+ </ItemsControl.ItemsPanel>
+ <ItemsControl.ItemTemplate>
+ <DataTemplate>
+ <StackPanel Orientation="Horizontal" Margin="10 0 0 0">
+ <CheckBox IsChecked="{Binding IsSelected}" VerticalAlignment="Center"></CheckBox>
+ <TextBlock Text="{Binding Data}" Margin="5 0 0 0" VerticalAlignment="Center"></TextBlock>
+ </StackPanel>
+ </DataTemplate>
+ </ItemsControl.ItemTemplate>
+ </ItemsControl>
+ </StackPanel>
+ </Border>
+
+ <CheckBox VerticalAlignment="Center" Margin="20 0 0 0" IsChecked="{Binding DisplayDebug}" IsEnabled="{Binding IsRealTime}" ToolTip="Hide/Display debug logs (applies only when debug logs are enabled in the settings file)">Process Debug Logs</CheckBox>
</StackPanel>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0 0 30 0">
@@ -203,7 +223,7 @@
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn Header="DATE TIME" Binding="{Binding TimeStamp,StringFormat='MM/dd/yyyy HH:mm:ss.ff'}" />
- <DataGridTextColumn Header="FILE" Binding="{Binding RelativeCallerFile}" />
+ <DataGridTextColumn Header="FILE" Binding="{Binding RelativeCallerFile}" />
<DataGridTextColumn Header="METHOD" Binding="{Binding CallerMethodName}" />
<DataGridTextColumn Header="LINE" Binding="{Binding CallerLineNumber}" />
<DataGridTemplateColumn Header="MESSAGE" Width="1*">
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Tango.MachineStudio.MachineDesigner.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Tango.MachineStudio.MachineDesigner.csproj
index a578d0e54..3fa7c60cf 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Tango.MachineStudio.MachineDesigner.csproj
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Tango.MachineStudio.MachineDesigner.csproj
@@ -8,7 +8,7 @@
<OutputType>library</OutputType>
<RootNamespace>Tango.MachineStudio.MachineDesigner</RootNamespace>
<AssemblyName>Tango.MachineStudio.MachineDesigner</AssemblyName>
- <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
+ <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/App.config b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/App.config
index bd3d48f6d..24aec371a 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/App.config
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/App.config
@@ -41,6 +41,14 @@
<assemblyIdentity name="System.Diagnostics.StackTrace" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
</dependentAssembly>
+ <dependentAssembly>
+ <assemblyIdentity name="System.IO.Compression" publicKeyToken="b77a5c561934e089" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-4.1.2.0" newVersion="4.1.2.0" />
+ </dependentAssembly>
+ <dependentAssembly>
+ <assemblyIdentity name="System.IO.FileSystem.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
+ </dependentAssembly>
</assemblyBinding>
</runtime>
</configuration> \ 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
index fdd8cb124..7d5882907 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/RMLModule.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/RMLModule.cs
@@ -51,7 +51,7 @@ namespace Tango.MachineStudio.ColorLab
{
get
{
- return Permissions.RunColorLabModule;
+ return Permissions.RunRMLModule;
}
}
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 b9d77e95a..64501b4fc 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
@@ -8,7 +8,7 @@
<OutputType>library</OutputType>
<RootNamespace>Tango.MachineStudio.RML</RootNamespace>
<AssemblyName>Tango.MachineStudio.RML</AssemblyName>
- <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
+ <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
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 be46e2148..70073ad62 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,4 +1,5 @@
-using System;
+using Microsoft.Win32;
+using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
@@ -8,6 +9,7 @@ using System.Threading.Tasks;
using System.Windows.Data;
using Tango.BL;
using Tango.BL.Builders;
+using Tango.BL.Calibration;
using Tango.BL.Entities;
using Tango.Core.Commands;
using Tango.MachineStudio.ColorLab.ViewModels;
@@ -15,6 +17,7 @@ using Tango.MachineStudio.Common;
using Tango.MachineStudio.Common.Notifications;
using Tango.MachineStudio.RML.Contracts;
using Tango.MachineStudio.RML.Views;
+using Tango.PMR.ColorLab;
namespace Tango.MachineStudio.RML.ViewModels
{
@@ -154,18 +157,21 @@ namespace Tango.MachineStudio.RML.ViewModels
/// </summary>
public RelayCommand BackToRmlsCommand { get; set; }
+ public RelayCommand SaveCommand { 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);
- RemoveProcessParametersTableCommand = new RelayCommand<ProcessParametersTable>(RemoveProcessParametersTable);
- AddLiquidFactorCommand = new RelayCommand(AddLiquidFactor);
- RemoveLiquidFactorCommand = new RelayCommand<LiquidTypesRml>(RemoveLiquidFactor);
+ BackToRmlsCommand = new RelayCommand(BackToRmls, () => IsFree);
+ AddProcessParametersTableCommand = new RelayCommand(AddProcessParametersTable, () => IsFree);
+ RemoveProcessParametersTableCommand = new RelayCommand<ProcessParametersTable>(RemoveProcessParametersTable, () => IsFree);
+ AddLiquidFactorCommand = new RelayCommand(AddLiquidFactor, () => IsFree);
+ RemoveLiquidFactorCommand = new RelayCommand<LiquidTypesRml>(RemoveLiquidFactor, () => IsFree);
CreateCalibrationDataExcelTemplateCommand = new RelayCommand(CreateCalibrationDataExcelTemplate);
+ SaveCommand = new RelayCommand(Save, () => IsFree);
}
public override void OnApplicationReady()
@@ -175,13 +181,10 @@ namespace Tango.MachineStudio.RML.ViewModels
private async void LoadRmls()
{
- using (_rmls_context = ObservablesContext.CreateDefault())
- {
- await Task.Factory.StartNew(() =>
- {
- Rmls = _rmls_context.Rmls.ToList().ToObservableCollection();
- });
- }
+ if (_rmls_context != null) _rmls_context.Dispose();
+
+ _rmls_context = ObservablesContext.CreateDefault();
+ Rmls = await new RmlsCollectionBuilder(_rmls_context).Set().WithLiquidFactors().WithMediaProperties().BuildAsync();
}
private async void LoadActiveRML(String guid)
@@ -210,15 +213,12 @@ namespace Tango.MachineStudio.RML.ViewModels
ActiveProcessParametersTableView = CollectionViewSource.GetDefaultView(ActiveProcessParametersGroup.ProcessParametersTables);
ActiveProcessParametersTableView.SortDescriptions.Add(new SortDescription(nameof(ProcessParametersTable.TableIndex), ListSortDirection.Ascending));
- CalibrationDataViewVM = new CalibrationDataViewVM();
+ CalibrationDataViewVM = new CalibrationDataViewVM(_notification);
LiquidTypesRmls = ActiveRML.LiquidTypesRmls;
foreach (var liquidTypeRml in LiquidTypesRmls)
{
- CalibrationDataVM catVM = new CalibrationDataVM();
- catVM.Name = liquidTypeRml.LiquidType.Name;
- catVM.Color = liquidTypeRml.LiquidType.Color;
- catVM.LiquidType = liquidTypeRml.LiquidType;
+ CalibrationDataVM catVM = new CalibrationDataVM(liquidTypeRml.LiquidType);
if (liquidTypeRml.DefaultCatData != null)
{
@@ -267,6 +267,8 @@ namespace Tango.MachineStudio.RML.ViewModels
_active_context.Dispose();
}
+ _active_context = ObservablesContext.CreateDefault();
+
LoadRmlProperties();
Rml rml = new Rml();
@@ -280,6 +282,19 @@ namespace Tango.MachineStudio.RML.ViewModels
rml.LinearMassDensityUnit = LinearMassDensityUnits.FirstOrDefault();
rml.FiberShape = FiberShapes.FirstOrDefault();
rml.FiberSynth = FiberSynths.FirstOrDefault();
+
+ ProcessParametersTablesGroup group = new ProcessParametersTablesGroup();
+ group.Name = "Active Group";
+ group.Active = true;
+ group.ProcessParametersTables.Add(new ProcessParametersTable()
+ {
+ Name = "Process Table 1",
+ });
+
+ group.Rml = rml;
+
+ _active_context.ProcessParametersTablesGroups.Add(group);
+ _active_context.ProcessParametersTables.Add(group.ProcessParametersTables[0]);
_active_context.Rmls.Add(rml);
await _active_context.SaveChangesAsync();
LoadActiveRML(rml.Guid);
@@ -289,9 +304,28 @@ namespace Tango.MachineStudio.RML.ViewModels
}
}
- private void RemoveSelectedRml()
+ private async void RemoveSelectedRml()
{
+ if (_notification.ShowQuestion("Removing the selected RML will result in the loss of all related process parameters and default calibration data. Are you sure you want to delete the selected RML?"))
+ {
+ IsFree = false;
+ using (_notification.PushTaskItem("Removing RML..."))
+ {
+ try
+ {
+ await SelectedRML.DeleteCascadeAsync(_rmls_context);
+ LoadRmls();
+ }
+ catch (Exception ex)
+ {
+ LogManager.Log(ex, $"Error removing selected RML {SelectedRML.Name}.");
+ _notification.ShowError($"An error occurred while trying to remove the selected RML.\n{ex.Message}");
+ }
+ }
+
+ IsFree = true;
+ }
}
private void AddProcessParametersTable()
@@ -359,9 +393,7 @@ namespace Tango.MachineStudio.RML.ViewModels
_active_context.LiquidTypesRmls.Add(liquidFactor);
- CalibrationDataVM catVM = new CalibrationDataVM();
- catVM.Name = liquidFactor.LiquidType.Name;
- catVM.Color = liquidFactor.LiquidType.Color;
+ CalibrationDataVM catVM = new CalibrationDataVM(liquidFactor.LiquidType);
CalibrationDataViewVM.LiquidsCalibrationData.Add(catVM);
@@ -384,7 +416,56 @@ namespace Tango.MachineStudio.RML.ViewModels
private void CreateCalibrationDataExcelTemplate()
{
-
+ SaveFileDialog dlg = new SaveFileDialog();
+ try
+ {
+ dlg.Title = $"Create excel template file";
+ dlg.Filter = "Excel Files|*.xlsx";
+ dlg.DefaultExt = ".xlsx";
+ dlg.FileName = "Calibration File Template";
+ if (dlg.ShowDialog().Value)
+ {
+ CalibrationHelper.CreateCalibrationDataExcelTemplate(dlg.FileName);
+ }
+ }
+ catch (Exception ex)
+ {
+ LogManager.Log(ex, "Error generating excel calibration template file " + dlg.FileName);
+ _notification.ShowError("An error occurred while trying to generate the calibration file.");
+ }
+ }
+
+ private async void Save()
+ {
+ IsFree = false;
+
+ try
+ {
+ using (_notification.PushTaskItem("Saving RML..."))
+ {
+ foreach (var calDataVM in CalibrationDataViewVM.LiquidsCalibrationData)
+ {
+ var liquidTypeRml = LiquidTypesRmls.SingleOrDefault(x => x.LiquidType == calDataVM.LiquidType);
+ CalibrationData calData = new CalibrationData();
+ calData.LiquidType = (PMR.ColorLab.LiquidType)liquidTypeRml.LiquidType.Code;
+ calData.CalibrationPoints.AddRange(calDataVM.CalibrationPoints.Select(x => new CalibrationPoint() { X = x.X, Y = x.Y }));
+ liquidTypeRml.PutCalibrationData(calData);
+ }
+
+ ActiveRML.LastUpdated = DateTime.UtcNow;
+
+ await _active_context.SaveChangesAsync();
+ }
+ }
+ catch (Exception ex)
+ {
+ LogManager.Log(ex, $"Error saving RML {ActiveRML.Name}");
+ _notification.ShowError($"An error occurred while trying to save the current RML.\n{ex.Message}");
+ }
+
+ LoadActiveRML(ActiveRML.Guid);
+
+ IsFree = true;
}
private void BackToRmls()
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 aa6f39d9e..d72b6c7d3 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
@@ -31,6 +31,13 @@
</Button>
<TextBlock Text="{Binding ActiveRML.Name}" VerticalAlignment="Center" Margin="10 0 0 0" FontSize="34"></TextBlock>
</StackPanel>
+
+ <Button HorizontalAlignment="Right" Width="170" Height="45" Margin="0 0 20 0" VerticalAlignment="Center" Command="{Binding SaveCommand}">
+ <StackPanel Orientation="Horizontal">
+ <materialDesign:PackIcon Kind="ContentSaveAll" Width="24" Height="24" />
+ <TextBlock VerticalAlignment="Center" Margin="10 0 0 0">SAVE</TextBlock>
+ </StackPanel>
+ </Button>
</Grid>
<Grid DockPanel.Dock="Bottom">
@@ -196,7 +203,7 @@
</ItemsControl>
</StackPanel>
- <dragAndDrop:DraggingSurface x:Name="draggingSurface" />
+ <dragAndDrop:DraggingSurface x:Name="draggingSurface" ClipToBounds="True" />
</Grid>
</DockPanel>
</Grid>
@@ -206,7 +213,6 @@
<DockPanel>
- <ScrollViewer VerticalScrollBarVisibility="Disabled" HorizontalScrollBarVisibility="Auto">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="120"/>
@@ -226,7 +232,9 @@
</Button>
</Grid>
</Border>
- <ItemsControl ItemsSource="{Binding LiquidTypesRmls}" Margin="0 10 0 0">
+
+ <ScrollViewer x:Name="liquidsFactorsScrollViewer" VerticalScrollBarVisibility="Disabled" HorizontalScrollBarVisibility="Hidden" Margin="15 0 20 0">
+ <ItemsControl Width="{Binding ElementName=calibrationDataView,Path=ActualWidth}" ItemsSource="{Binding LiquidTypesRmls}" Margin="0 10 0 0">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<UniformGrid IsItemsHost="True" Rows="1"></UniformGrid>
@@ -259,7 +267,8 @@
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
- </DockPanel>
+ </ScrollViewer>
+ </DockPanel>
</Grid>
<Grid Grid.Row="2">
@@ -270,18 +279,22 @@
<DropShadowEffect Opacity="0.4" />
</Border.Effect>
<Grid>
- <TextBlock HorizontalAlignment="Left" Margin="20 0 0 0" FontSize="16">CALIBRATION DATA</TextBlock>
- <Button ToolTip="Create excel file template" HorizontalAlignment="Right" Style="{StaticResource MaterialDesignFlatButton}" Height="Auto" VerticalAlignment="Bottom" Width="30" Padding="0" Command="{Binding CreateCalibrationDataExcelTemplateCommand}">
- <materialDesign:PackIcon Kind="FileExcel" Foreground="DimGray" Width="16" Height="20" />
- </Button>
+ <TextBlock HorizontalAlignment="Left" Margin="20 0 0 0" FontSize="16">CALIBRATION DATA</TextBlock>
+ <Button ToolTip="Create excel file template" FontSize="11" Foreground="#202020" HorizontalAlignment="Right" Style="{StaticResource MaterialDesignFlatButton}" Height="Auto" VerticalAlignment="Bottom" Padding="0" Command="{Binding CreateCalibrationDataExcelTemplateCommand}" Margin="0 0 5 0">
+ <StackPanel Orientation="Horizontal">
+ <materialDesign:PackIcon Kind="FileExcel" Foreground="DimGray" Width="16" Height="26" />
+ <TextBlock VerticalAlignment="Center" Margin="5 0 0 0">Create Empty Excel Template</TextBlock>
+ </StackPanel>
+ </Button>
</Grid>
</Border>
- <colorLabViews:CalibrationDataView Margin="0 10 0 0" DataContext="{Binding CalibrationDataViewVM}" />
- </DockPanel>
+ <ScrollViewer x:Name="calibrationDataScrollViewer" ScrollChanged="calibrationDataScrollViewer_ScrollChanged" VerticalScrollBarVisibility="Disabled" HorizontalScrollBarVisibility="Auto" Margin="15 0 20 0">
+ <colorLabViews:CalibrationDataView x:Name="calibrationDataView" Margin="0 10 0 0" DataContext="{Binding CalibrationDataViewVM}" />
+ </ScrollViewer>
+ </DockPanel>
</Grid>
</Grid>
- </ScrollViewer>
</DockPanel>
</Grid>
</Grid>
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 c1bc9ad4a..2a5d317c6 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
@@ -47,5 +47,10 @@ namespace Tango.MachineStudio.RML.Views
ProcessParametersTable dropped = e.Droppable.DataContext as ProcessParametersTable;
_vm.OnProcessParametersTableDropped(dragged, dropped);
}
+
+ private void calibrationDataScrollViewer_ScrollChanged(object sender, ScrollChangedEventArgs e)
+ {
+ liquidsFactorsScrollViewer.ScrollToHorizontalOffset(e.HorizontalOffset);
+ }
}
}
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 b597c1dd2..06a28c1e4 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
@@ -4,7 +4,9 @@
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:vm="clr-namespace:Tango.MachineStudio.RML.ViewModels"
+ xmlns:shapes="clr-namespace:Tango.SharedUI.Shapes;assembly=Tango.SharedUI"
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"
@@ -13,6 +15,7 @@
<UserControl.Resources>
<converters:DateTimeUTCToShortDateTimeConverter x:Key="DateTimeUTCToShortDateTimeConverter" />
+ <converters:ColorToIntegerConverter x:Key="ColorToIntegerConverter"></converters:ColorToIntegerConverter>
</UserControl.Resources>
<Grid>
@@ -38,8 +41,8 @@
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
<Button Margin="50 0 0 0" MinWidth="200" Height="60" Command="{Binding ManageRmlCommand}">
<StackPanel Orientation="Horizontal">
- <TextBlock FontSize="18" VerticalAlignment="Center">MANAGE</TextBlock>
- <materialDesign:PackIcon Margin="5 0 0 0" Kind="ChevronRight" Width="30" Height="30" />
+ <materialDesign:PackIcon Kind="Pencil" Width="24" Height="24" />
+ <TextBlock Margin="10 0 0 0" FontSize="18">EDIT</TextBlock>
</StackPanel>
</Button>
</StackPanel>
@@ -54,9 +57,40 @@
</Style>
</DataGrid.CellStyle>
<DataGrid.Columns>
- <DataGridTextColumn Header="NAME" Binding="{Binding Name}" Width="1*" />
- <DataGridTextColumn Header="LAST UPDATED" Binding="{Binding LastUpdated,Converter={StaticResource DateTimeUTCToShortDateTimeConverter}}" Width="1*" />
- <DataGridTextColumn Header="MANUFACTURER" Binding="{Binding Manufacturer}" Width="1*" />
+ <DataGridTextColumn Header="NAME" Binding="{Binding Name}" Width="Auto" />
+ <DataGridTextColumn Header="MANUFACTURER" Binding="{Binding Manufacturer}" Width="Auto" />
+ <DataGridTextColumn Header="MATERIAL" Binding="{Binding MediaMaterial.Name}" Width="Auto" />
+ <DataGridTextColumn Header="PURPOSE" Binding="{Binding MediaPurpose.Name}" Width="Auto" />
+ <DataGridTextColumn Header="LAST UPDATED" Binding="{Binding LastUpdated,Converter={StaticResource DateTimeUTCToShortDateTimeConverter}}" Width="Auto" />
+ <DataGridTemplateColumn Header="LIQUID FACTORS" Width="1*">
+ <DataGridTemplateColumn.CellTemplate>
+ <DataTemplate>
+ <ItemsControl ItemsSource="{Binding LiquidTypesRmls}" Margin="0 10 0 0">
+ <ItemsControl.ItemsPanel>
+ <ItemsPanelTemplate>
+ <StackPanel HorizontalAlignment="Left" Orientation="Horizontal" IsItemsHost="True"></StackPanel>
+ </ItemsPanelTemplate>
+ </ItemsControl.ItemsPanel>
+ <ItemsControl.ItemTemplate>
+ <DataTemplate DataType="{x:Type observables:LiquidTypesRml}">
+ <Grid Width="47" Height="40" Margin="10 -10 0 0">
+ <shapes:Hexagon StrokeThickness="1" Stroke="Gray">
+ <shapes:Hexagon.Fill>
+ <LinearGradientBrush Opacity="0.7" >
+ <GradientStop Color="{Binding LiquidType.Color,Converter={StaticResource ColorToIntegerConverter}}"/>
+ <GradientStop Color="White" Offset="1"/>
+ </LinearGradientBrush>
+ </shapes:Hexagon.Fill>
+ </shapes:Hexagon>
+
+ <TextBlock FontSize="8" Width="40" TextTrimming="CharacterEllipsis" TextAlignment="Center" HorizontalAlignment="Center" VerticalAlignment="Center" Background="Transparent" Foreground="Black" Text="{Binding LiquidType.Name}" FontStyle="Italic"></TextBlock>
+ </Grid>
+ </DataTemplate>
+ </ItemsControl.ItemTemplate>
+ </ItemsControl>
+ </DataTemplate>
+ </DataGridTemplateColumn.CellTemplate>
+ </DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
</Grid>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/Tango.MachineStudio.Stubs.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/Tango.MachineStudio.Stubs.csproj
index 402e1642d..ea332221e 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/Tango.MachineStudio.Stubs.csproj
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/Tango.MachineStudio.Stubs.csproj
@@ -8,7 +8,7 @@
<OutputType>library</OutputType>
<RootNamespace>Tango.MachineStudio.Stubs</RootNamespace>
<AssemblyName>Tango.MachineStudio.Stubs</AssemblyName>
- <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
+ <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/Tango.MachineStudio.Synchronization.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/Tango.MachineStudio.Synchronization.csproj
index e4b1edce4..e76e9b81f 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/Tango.MachineStudio.Synchronization.csproj
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/Tango.MachineStudio.Synchronization.csproj
@@ -8,7 +8,7 @@
<OutputType>library</OutputType>
<RootNamespace>Tango.MachineStudio.Synchronization</RootNamespace>
<AssemblyName>Tango.MachineStudio.Synchronization</AssemblyName>
- <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
+ <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Converters/DecimalPlacesToStringFormatConverter.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Converters/DecimalPlacesToStringFormatConverter.cs
new file mode 100644
index 000000000..a0f6863e6
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Converters/DecimalPlacesToStringFormatConverter.cs
@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Data;
+
+namespace Tango.MachineStudio.Technician.Converters
+{
+ public class DecimalPlacesToStringFormatConverter : IValueConverter
+ {
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ if (value != null)
+ {
+ return $"F{int.Parse(value.ToString())}";
+ }
+
+ return value;
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Converters/ValveStateComparerToBooleanConverter.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Converters/ValveStateComparerToBooleanConverter.cs
new file mode 100644
index 000000000..a05afe42e
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Converters/ValveStateComparerToBooleanConverter.cs
@@ -0,0 +1,34 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Data;
+using Tango.PMR.Diagnostics;
+
+namespace Tango.MachineStudio.Technician.Converters
+{
+ public class ValveStateComparerToBooleanConverter : IMultiValueConverter
+ {
+ public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
+ {
+ if (values.Length == 2 && values[0] != DependencyProperty.UnsetValue && values[1] != DependencyProperty.UnsetValue)
+ {
+ ValveStateCode v1 = (ValveStateCode)values[0];
+ ValveStateCode v2 = (ValveStateCode)Enum.Parse(typeof(ValveStateCode), values[1].ToString().Replace(" ", ""), true);
+ return v1 == v2;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MultiGraphElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MultiGraphElementEditor.xaml
index dcba1e77b..22fd8eaa8 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MultiGraphElementEditor.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MultiGraphElementEditor.xaml
@@ -3,6 +3,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:localConverters="clr-namespace:Tango.MachineStudio.Technician.Converters"
xmlns:controls="clr-namespace:Tango.MachineStudio.Common.Controls;assembly=Tango.MachineStudio.Common"
xmlns:converters="clr-namespace:Tango.Editors.Converters;assembly=Tango.Editors"
xmlns:sharedConverters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI"
@@ -14,6 +15,7 @@
<UserControl.Resources>
<converters:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter"></converters:BoolToVisibilityConverter>
<sharedConverters:BooleanInverseConverter x:Key="BooleanInverseConverter" />
+ <localConverters:DecimalPlacesToStringFormatConverter x:Key="DecimalPlacesToStringFormatConverter"/>
<!--Theme-->
<SolidColorBrush x:Key="BorderBrush" Color="Transparent"></SolidColorBrush>
@@ -30,14 +32,7 @@
<!--Content-->
<Grid>
<!--<Viewbox Stretch="Fill">-->
- <controls:RealTimeGraphMultiControl x:Name="InnerGraph" UseAutoRange="{Binding UseAutoRange}" IsHitTestVisible="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable,Converter={StaticResource BooleanInverseConverter}}" x:FieldModifier="public" EnableToolBar="False" SensorName="{Binding TechMonitor.Description}" SensorUnits="{Binding TechMonitor.Units}">
- <controls:RealTimeGraphMultiControl.Style>
- <Style TargetType="controls:RealTimeGraphMultiControl">
- <Setter Property="Minimum" Value="{Binding Min,Mode=TwoWay}"></Setter>
- <Setter Property="Maximum" Value="{Binding Max,Mode=TwoWay}"></Setter>
- </Style>
- </controls:RealTimeGraphMultiControl.Style>
- </controls:RealTimeGraphMultiControl>
+ <controls:RealTimeGraphControl x:Name="InnerGraph" IsHitTestVisible="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable,Converter={StaticResource BooleanInverseConverter}}" x:FieldModifier="public" DisplayName="{Binding TechMonitor.Description}" DisplayUnits="{Binding TechMonitor.Units}" StringFormat="{Binding DecimalPlaces,Converter={StaticResource DecimalPlacesToStringFormatConverter}}" />
<!--</Viewbox>-->
</Grid>
<!--Content-->
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/SingleGraphElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/SingleGraphElementEditor.xaml
index a9eb9e9f4..ca2481de6 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/SingleGraphElementEditor.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/SingleGraphElementEditor.xaml
@@ -5,6 +5,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:controls="clr-namespace:Tango.MachineStudio.Common.Controls;assembly=Tango.MachineStudio.Common"
xmlns:converters="clr-namespace:Tango.Editors.Converters;assembly=Tango.Editors"
+ xmlns:localConverters="clr-namespace:Tango.MachineStudio.Technician.Converters"
xmlns:sharedConverters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI"
xmlns:items="clr-namespace:Tango.MachineStudio.Technician.TechItems"
xmlns:local="clr-namespace:Tango.Editors;assembly=Tango.Editors"
@@ -14,6 +15,7 @@
<UserControl.Resources>
<converters:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter"></converters:BoolToVisibilityConverter>
<sharedConverters:BooleanInverseConverter x:Key="BooleanInverseConverter" />
+ <localConverters:DecimalPlacesToStringFormatConverter x:Key="DecimalPlacesToStringFormatConverter"/>
<!--Theme-->
<SolidColorBrush x:Key="BorderBrush" Color="Transparent"></SolidColorBrush>
@@ -30,13 +32,8 @@
<!--Content-->
<Grid>
<!--<Viewbox Stretch="Fill">-->
- <controls:RealTimeGraphControl x:Name="InnerGraph" UseAutoRange="{Binding UseAutoRange}" IsHitTestVisible="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable,Converter={StaticResource BooleanInverseConverter}}" x:FieldModifier="public" EnableToolBar="False" SensorName="{Binding TechMonitor.Description}" Color="{Binding Color,Mode=OneWay}" SensorUnits="{Binding TechMonitor.Units}">
- <controls:RealTimeGraphControl.Style>
- <Style TargetType="controls:RealTimeGraphControl">
- <Setter Property="Minimum" Value="{Binding Min,Mode=TwoWay}"></Setter>
- <Setter Property="Maximum" Value="{Binding Max,Mode=TwoWay}"></Setter>
- </Style>
- </controls:RealTimeGraphControl.Style>
+ <controls:RealTimeGraphControl x:Name="InnerGraph" IsHitTestVisible="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable,Converter={StaticResource BooleanInverseConverter}}" x:FieldModifier="public" DisplayName="{Binding TechMonitor.Description}" DisplayUnits="{Binding TechMonitor.Units}" StringFormat="{Binding DecimalPlaces,Converter={StaticResource DecimalPlacesToStringFormatConverter}}">
+
</controls:RealTimeGraphControl>
<!--</Viewbox>-->
</Grid>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/ValveElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/ValveElementEditor.xaml
new file mode 100644
index 000000000..aed779d4b
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/ValveElementEditor.xaml
@@ -0,0 +1,191 @@
+<local:ElementEditor x:Class="Tango.MachineStudio.Technician.Editors.ValveElementEditor"
+ 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:localConverters="clr-namespace:Tango.MachineStudio.Technician.Converters"
+ 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:ValveItem, IsDesignTimeCreatable=False}" Height="101.188" Width="352.459">
+
+ <UserControl.Resources>
+ <converters:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter"></converters:BoolToVisibilityConverter>
+ <sharedConverters:BooleanInverseConverter x:Key="BooleanInverseConverter" />
+ <localConverters:ValveStateComparerToBooleanConverter x:Key="ValveStateComparerToBooleanConverter" />
+
+ <!--Theme-->
+ <SolidColorBrush x:Key="BorderBrush" Color="Transparent"></SolidColorBrush>
+ <SolidColorBrush x:Key="CornersBrush" Color="Red"></SolidColorBrush>
+ </UserControl.Resources>
+
+ <UserControl.RenderTransform>
+ <RotateTransform Angle="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=Angle}"></RotateTransform>
+ </UserControl.RenderTransform>
+
+ <Grid>
+
+
+ <!--Content-->
+ <Grid>
+
+ <Viewbox Stretch="Uniform">
+ <Border Width="352" Height="101" Background="#151515" CornerRadius="5" BorderThickness="1" BorderBrush="#434343" Padding="5">
+ <Grid>
+ <Grid Grid.Row="1">
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="27*"/>
+ <ColumnDefinition Width="30*"/>
+ <ColumnDefinition Width="27*"/>
+ </Grid.ColumnDefinitions>
+
+ <Button Margin="8" Cursor="Hand" Command="{Binding SetCommand}" CommandParameter="{Binding TechValve.State1}">
+ <Button.Style>
+ <Style TargetType="Button">
+ <Setter Property="Background" Value="#404040"></Setter>
+ <Setter Property="IsEnabled" Value="True"></Setter>
+ </Style>
+ </Button.Style>
+ <Button.Template>
+ <ControlTemplate TargetType="Button">
+ <Border Background="{TemplateBinding Background}" CornerRadius="5">
+ <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Gainsboro" FontSize="16" FontWeight="SemiBold" Text="{Binding TechValve.State1}"></TextBlock>
+ </Border>
+ <ControlTemplate.Triggers>
+ <Trigger Property="IsPressed" Value="True">
+ <Setter Property="Opacity" Value="0.7"></Setter>
+ </Trigger>
+ <DataTrigger>
+ <DataTrigger.Binding>
+ <MultiBinding Converter="{StaticResource ValveStateComparerToBooleanConverter}">
+ <Binding Path="State" />
+ <Binding Path="TechValve.State1" />
+ </MultiBinding>
+ </DataTrigger.Binding>
+ <DataTrigger.Value>
+ True
+ </DataTrigger.Value>
+
+ <DataTrigger.Setters>
+ <Setter Property="Background" Value="#4AAB2F"></Setter>
+ <Setter Property="IsEnabled" Value="False"></Setter>
+ </DataTrigger.Setters>
+ </DataTrigger>
+ </ControlTemplate.Triggers>
+ </ControlTemplate>
+ </Button.Template>
+ </Button>
+
+ <Border Background="#202020" Margin="8" CornerRadius="3" Padding="5" Grid.Column="1">
+ <StackPanel>
+ <TextBlock FontFamily="digital-7" Text="Valve Controller" FontSize="13" Foreground="#E94A4A" HorizontalAlignment="Center"></TextBlock>
+ <Image Source="../Images/valve.png" RenderOptions.BitmapScalingMode="Fant" Margin="10" Stretch="Uniform" Height="36" />
+ </StackPanel>
+ </Border>
+
+ <Button Margin="8" Cursor="Hand" Grid.Column="2" Command="{Binding SetCommand}" CommandParameter="{Binding TechValve.State2}">
+ <Button.Style>
+ <Style TargetType="Button">
+ <Setter Property="Background" Value="#404040"></Setter>
+ <Setter Property="IsEnabled" Value="True"></Setter>
+ </Style>
+ </Button.Style>
+ <Button.Template>
+ <ControlTemplate TargetType="Button">
+ <Border Background="{TemplateBinding Background}" CornerRadius="5">
+ <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Gainsboro" FontSize="16" FontWeight="SemiBold" Text="{Binding TechValve.State2}"></TextBlock>
+ </Border>
+ <ControlTemplate.Triggers>
+ <Trigger Property="IsPressed" Value="True">
+ <Setter Property="Opacity" Value="0.7"></Setter>
+ </Trigger>
+ <DataTrigger>
+ <DataTrigger.Binding>
+ <MultiBinding Converter="{StaticResource ValveStateComparerToBooleanConverter}">
+ <Binding Path="State" />
+ <Binding Path="TechValve.State2" />
+ </MultiBinding>
+ </DataTrigger.Binding>
+ <DataTrigger.Value>
+ True
+ </DataTrigger.Value>
+
+ <DataTrigger.Setters>
+ <Setter Property="Background" Value="#4AAB2F"></Setter>
+ <Setter Property="IsEnabled" Value="False"></Setter>
+ </DataTrigger.Setters>
+ </DataTrigger>
+ </ControlTemplate.Triggers>
+ </ControlTemplate>
+ </Button.Template>
+ </Button>
+ </Grid>
+ </Grid>
+ </Border>
+ </Viewbox>
+
+ <Border Margin="0 0 0 -23" VerticalAlignment="Bottom">
+ <TextBlock Text="{Binding TechValve.Description}" FontSize="14" Foreground="DimGray" HorizontalAlignment="Center"></TextBlock>
+ </Border>
+ </Grid>
+ <!--Content-->
+
+
+ <Border BorderThickness="1" BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=BorderBrush,TargetNullValue={StaticResource BorderBrush},FallbackValue={StaticResource BorderBrush}}">
+ <Border.Style>
+ <Style TargetType="Border">
+ <Setter Property="Visibility" Value="Collapsed"></Setter>
+ <Style.Triggers>
+ <MultiDataTrigger>
+ <MultiDataTrigger.Conditions>
+ <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=(local:ElementsEditor.IsSelected)}" Value="True" />
+ <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable}" Value="True" />
+ </MultiDataTrigger.Conditions>
+
+ <Setter Property="Visibility" Value="Visible"></Setter>
+ </MultiDataTrigger>
+ </Style.Triggers>
+ </Style>
+ </Border.Style>
+ <Grid>
+ <ContentPresenter Content="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=InnerContent}"></ContentPresenter>
+
+ <Thumb Opacity="0" DragDelta="MoveDrag" DragStarted="DragStarted" DragCompleted="OnDragEnded"></Thumb>
+ <Thumb HorizontalAlignment="Left" Cursor="SizeWE" Opacity="0" DragDelta="DragLeft" DragStarted="DragStarted" DragCompleted="OnDragEnded"></Thumb>
+ <Thumb HorizontalAlignment="Right" Cursor="SizeWE" Opacity="0" DragDelta="DragRight" DragStarted="DragStarted" DragCompleted="OnDragEnded"></Thumb>
+ <Thumb VerticalAlignment="Top" Cursor="SizeNS" Opacity="0" DragDelta="DragTop" DragStarted="DragStarted" DragCompleted="OnDragEnded"></Thumb>
+ <Thumb VerticalAlignment="Bottom" Cursor="SizeNS" Opacity="0" DragDelta="DragBottom" DragStarted="DragStarted" DragCompleted="OnDragEnded"></Thumb>
+
+ <Grid ClipToBounds="False" HorizontalAlignment="Center" VerticalAlignment="Top" Margin="0 -20 0 0" Width="10" Height="10">
+ <Ellipse Stroke="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=CornersBrush,TargetNullValue={StaticResource CornersBrush},FallbackValue={StaticResource CornersBrush}}" StrokeThickness="2"></Ellipse>
+ <Rectangle HorizontalAlignment="Center" VerticalAlignment="Stretch" Margin="0 10 0 -8" StrokeThickness="1" Stroke="Red"></Rectangle>
+ <Thumb Opacity="0" DragDelta="DragAngle" DragStarted="DragStarted" Cursor="Arrow" DragCompleted="OnDragEnded"></Thumb>
+ </Grid>
+
+ <Grid Width="10" Height="10" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="-8 -8 0 0">
+ <Border BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=CornersBrush,TargetNullValue={StaticResource CornersBrush},FallbackValue={StaticResource CornersBrush}}" BorderThickness="2 2 0 0"></Border>
+ <Thumb Opacity="0" DragDelta="DragTopLeft" DragStarted="DragStarted" Cursor="SizeNWSE" DragCompleted="OnDragEnded"></Thumb>
+ </Grid>
+
+ <Grid Width="10" Height="10" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0 -8 -8 0">
+ <Border BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=CornersBrush,TargetNullValue={StaticResource CornersBrush},FallbackValue={StaticResource CornersBrush}}" BorderThickness="0 2 2 0"></Border>
+ <Thumb Opacity="0" DragDelta="DragTopRight" DragStarted="DragStarted" Cursor="SizeNESW" DragCompleted="OnDragEnded"></Thumb>
+ </Grid>
+
+ <Grid Width="10" Height="10" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="0 0 -8 -8">
+ <Border BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=CornersBrush,TargetNullValue={StaticResource CornersBrush},FallbackValue={StaticResource CornersBrush}}" BorderThickness="0 0 2 2"></Border>
+ <Thumb Opacity="0" DragDelta="DragBottomRight" DragStarted="DragStarted" Cursor="SizeNWSE" DragCompleted="OnDragEnded"></Thumb>
+ </Grid>
+
+ <Grid Width="10" Height="10" HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="-8 0 0 -8">
+ <Border BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=CornersBrush,TargetNullValue={StaticResource CornersBrush},FallbackValue={StaticResource CornersBrush}}" BorderThickness="2 0 0 2"></Border>
+ <Thumb Opacity="0" DragDelta="DragBottomLeft" DragStarted="DragStarted" Cursor="SizeNESW" DragCompleted="OnDragEnded"></Thumb>
+ </Grid>
+ </Grid>
+ </Border>
+ </Grid>
+</local:ElementEditor>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/ValveElementEditor.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/ValveElementEditor.xaml.cs
new file mode 100644
index 000000000..8f364ce01
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/ValveElementEditor.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 ValveElementEditor : ElementEditor
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="ValveElementEditor"/> class.
+ /// </summary>
+ public ValveElementEditor()
+ : base()
+ {
+ InitializeComponent();
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="ValveElementEditor"/> class.
+ /// </summary>
+ /// <param name="frameworkElement">The framework element.</param>
+ public ValveElementEditor(ValveItem valveItem)
+ : this()
+ {
+ ValveItem = valveItem;
+ DataContext = ValveItem;
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="ValveElementEditor"/> class.
+ /// </summary>
+ /// <param name="frameworkElement">The framework element.</param>
+ /// <param name="bounds">The bounds.</param>
+ public ValveElementEditor(ValveItem valveItem, Rect bounds)
+ : this(valveItem)
+ {
+ Left = bounds.Left;
+ Top = bounds.Top;
+ Width = bounds.Width;
+ Height = bounds.Height;
+ }
+
+ private ValveItem _valveItem;
+
+ public ValveItem ValveItem
+ {
+ get { return _valveItem; }
+ set { _valveItem = value; RaisePropertyChanged(nameof(ValveItem)); }
+ }
+
+
+ /// <summary>
+ /// Clones this instance.
+ /// </summary>
+ /// <returns></returns>
+ public override IElementEditor Clone()
+ {
+ try
+ {
+ var clonedItem = ValveItem.Clone() as ValveItem;
+ ValveElementEditor cloned = new ValveElementEditor(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);
+ }
+ }
+
+ /// <summary>
+ /// Gets the hosted element.
+ /// </summary>
+ [ParameterIgnore]
+ public override Object HostedElement
+ {
+ get { return ValveItem; }
+ }
+ }
+}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/valve.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/valve.png
new file mode 100644
index 000000000..5c08d0fc5
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/valve.png
Binary files differ
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/BreakSensorTemplate.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/BreakSensorTemplate.xaml
index 7914c5a52..3e0ab9061 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/BreakSensorTemplate.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/BreakSensorTemplate.xaml
@@ -24,7 +24,7 @@
<Grid>
<StackPanel>
- <GroupBox Header="SPEED SENSOR">
+ <GroupBox Header="BREAK SENSOR">
<StackPanel>
<TextBlock FontSize="10">Selected Break Sensor</TextBlock>
<ComboBox Margin="0 5 0 0" ItemsSource="{Binding Adapter.HardwareBreakSensorTypes}" SelectedItem="{Binding HardwareBreakSensorType,Mode=TwoWay}" DisplayMemberPath="Description" />
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/HeaterTemplate.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/HeaterTemplate.xaml
index 416428a0e..846500042 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/HeaterTemplate.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/HeaterTemplate.xaml
@@ -24,7 +24,7 @@
<Grid>
<StackPanel>
- <GroupBox Header="BLOWER">
+ <GroupBox Header="HEATER">
<StackPanel>
<TextBlock FontSize="10">Selected Heater</TextBlock>
<ComboBox Margin="0 5 0 0" ItemsSource="{Binding Adapter.TechHeaters}" SelectedItem="{Binding TechHeater,Mode=TwoWay}" DisplayMemberPath="Description" />
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/MultiGraphTemplate.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/MultiGraphTemplate.xaml
index 2f5e677c4..8a3c7c25f 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/MultiGraphTemplate.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/MultiGraphTemplate.xaml
@@ -16,6 +16,7 @@
<UserControl.Resources>
<converters:MonitorsToMultiChannleMonitorsConverter x:Key="MonitorsToMultiChannleMonitorsConverter" />
<sharedConverters:BooleanInverseConverter x:Key="BooleanInverseConverter" />
+ <converters:SecondsToTimeSpanConverter x:Key="SecondsToTimeSpanConverter" />
<Style TargetType="{x:Type TabItem}" BasedOn="{StaticResource {x:Type TabItem}}">
<Setter Property="mahapps:ControlsHelper.HeaderFontSize" Value="14" />
@@ -34,6 +35,16 @@
<GroupBox Header="GRAPH" Margin="0 10 0 0">
<StackPanel>
+ <StackPanel Margin="0 10 0 0">
+ <TextBlock HorizontalAlignment="Center" FontWeight="SemiBold" Foreground="Gray">
+ <Run>FIFO CAPACITY:</Run>
+ <Run Text="{Binding Duration,Converter={StaticResource SecondsToTimeSpanConverter},Mode=OneWay,StringFormat='hh\\:mm\\:ss'}"></Run>
+ </TextBlock>
+ <Slider Margin="0 5 0 0" Minimum="1" Maximum="3600" TickFrequency="1" IsSnapToTickEnabled="True" Value="{Binding Duration}"></Slider>
+
+ <TextBlock FontSize="10" Margin="0 20 0 0">Decimal Places</TextBlock>
+ <mahapps:NumericUpDown Background="Transparent" Margin="0 5 0 0" HasDecimals="False" Minimum="0" Maximum="4" Value="{Binding DecimalPlaces}" HorizontalContentAlignment="Center" Foreground="Gray" />
+ </StackPanel>
<StackPanel Margin="0 10" IsEnabled="{Binding UseAutoRange,Converter={StaticResource BooleanInverseConverter}}">
<UniformGrid Columns="2" Margin="0 5 0 0" IsEnabled="{Binding UseMinMax}">
<StackPanel Margin="0 0 5 0">
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/SingleGraphTemplate.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/SingleGraphTemplate.xaml
index 4acbd2fc1..a9d341b01 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/SingleGraphTemplate.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/SingleGraphTemplate.xaml
@@ -16,6 +16,7 @@
<UserControl.Resources>
<converters:MonitorsToSingleChannleMonitorsConverter x:Key="MonitorsToSingleChannleMonitorsConverter" />
<sharedConverters:BooleanInverseConverter x:Key="BooleanInverseConverter" />
+ <converters:SecondsToTimeSpanConverter x:Key="SecondsToTimeSpanConverter" />
<Style TargetType="{x:Type TabItem}" BasedOn="{StaticResource {x:Type TabItem}}">
<Setter Property="mahapps:ControlsHelper.HeaderFontSize" Value="14" />
@@ -34,6 +35,16 @@
<GroupBox Header="GRAPH" Margin="0 10 0 0">
<StackPanel>
+ <StackPanel Margin="0 10 0 0">
+ <TextBlock HorizontalAlignment="Center" FontWeight="SemiBold" Foreground="Gray">
+ <Run>FIFO CAPACITY:</Run>
+ <Run Text="{Binding Duration,Converter={StaticResource SecondsToTimeSpanConverter},Mode=OneWay,StringFormat='hh\\:mm\\:ss'}"></Run>
+ </TextBlock>
+ <Slider Margin="0 5 0 0" Minimum="1" Maximum="3600" TickFrequency="1" IsSnapToTickEnabled="True" Value="{Binding Duration}"></Slider>
+
+ <TextBlock FontSize="10" Margin="0 20 0 0">Decimal Places</TextBlock>
+ <mahapps:NumericUpDown Background="Transparent" Margin="0 5 0 0" HasDecimals="False" Minimum="0" Maximum="4" Value="{Binding DecimalPlaces}" HorizontalContentAlignment="Center" Foreground="Gray" />
+ </StackPanel>
<StackPanel Margin="0 10" IsEnabled="{Binding UseAutoRange,Converter={StaticResource BooleanInverseConverter}}">
<UniformGrid Columns="2" Margin="0 5 0 0" IsEnabled="{Binding UseMinMax}">
<StackPanel Margin="0 0 5 0">
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/ValveTemplate.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/ValveTemplate.xaml
new file mode 100644
index 000000000..9c0a063e7
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/ValveTemplate.xaml
@@ -0,0 +1,43 @@
+<UserControl x:Class="Tango.MachineStudio.Technician.PropertiesTemplates.ValveTemplate"
+ 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:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:converters="clr-namespace:Tango.MachineStudio.Technician.Converters"
+ xmlns:sharedConverters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI"
+ xmlns:items="clr-namespace:Tango.MachineStudio.Technician.TechItems"
+ xmlns:editors="clr-namespace:Tango.SharedUI.Editors;assembly=Tango.SharedUI"
+ xmlns:mahApps="http://metro.mahapps.com/winfx/xaml/controls"
+ xmlns:colorPicker="clr-namespace:Tango;assembly=Tango.ColorPicker"
+ xmlns:local="clr-namespace:Tango.MachineStudio.Technician.PropertiesTemplates"
+ mc:Ignorable="d"
+ d:DesignHeight="500" d:DesignWidth="200" d:DataContext="{d:DesignInstance Type=items:ValveItem, IsDesignTimeCreatable=False}">
+
+ <UserControl.Resources>
+ <sharedConverters:DoubleToIntConverter x:Key="DoubleToIntConverter" />
+
+ <Style TargetType="{x:Type TabItem}" BasedOn="{StaticResource {x:Type TabItem}}">
+ <Setter Property="mahApps:ControlsHelper.HeaderFontSize" Value="14" />
+ <Setter Property="Margin" Value="2" />
+ </Style>
+ </UserControl.Resources>
+
+ <Grid>
+ <StackPanel>
+ <GroupBox Header="VALVE">
+ <StackPanel>
+ <TextBlock FontSize="10">Selected Valve</TextBlock>
+ <ComboBox Margin="0 5 0 0" ItemsSource="{Binding Adapter.TechValves}" SelectedItem="{Binding TechValve,Mode=TwoWay}" DisplayMemberPath="Description" />
+ </StackPanel>
+ </GroupBox>
+
+ <GroupBox Header="COLOR" Margin="0 10 0 0">
+ <StackPanel>
+ <Viewbox Margin="0 5 0 0">
+ <colorPicker:ColorCanvas SelectedColor="{Binding Color,Mode=TwoWay}" Background="Transparent" />
+ </Viewbox>
+ </StackPanel>
+ </GroupBox>
+ </StackPanel>
+ </Grid>
+</UserControl>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/ValveTemplate.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/ValveTemplate.xaml.cs
new file mode 100644
index 000000000..9366464e7
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/ValveTemplate.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
+{
+ /// <summary>
+ /// Interaction logic for MonitorTemplate.xaml
+ /// </summary>
+ public partial class ValveTemplate : UserControl
+ {
+ public ValveTemplate()
+ {
+ 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 d937ca15b..aca44f07f 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
@@ -8,7 +8,7 @@
<OutputType>library</OutputType>
<RootNamespace>Tango.MachineStudio.Technician</RootNamespace>
<AssemblyName>Tango.MachineStudio.Technician</AssemblyName>
- <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
+ <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
@@ -103,6 +103,7 @@
<Compile Include="..\..\..\Versioning\GlobalVersionInfo.cs">
<Link>GlobalVersionInfo.cs</Link>
</Compile>
+ <Compile Include="Converters\DecimalPlacesToStringFormatConverter.cs" />
<Compile Include="Converters\MonitorsToMultiChannleMonitorsConverter.cs" />
<Compile Include="Converters\MonitorsToSingleChannleMonitorsConverter.cs" />
<Compile Include="Converters\SecondsToGraphPointsConverter.cs" />
@@ -110,6 +111,10 @@
<Compile Include="Converters\TechIosToDigitalInsConverter.cs" />
<Compile Include="Converters\TechIosToDigitalOutsConverter.cs" />
<Compile Include="Converters\TransitionLinkConverter.cs" />
+ <Compile Include="Converters\ValveStateComparerToBooleanConverter.cs" />
+ <Compile Include="Editors\ValveElementEditor.xaml.cs">
+ <DependentUpon>ValveElementEditor.xaml</DependentUpon>
+ </Compile>
<Compile Include="Editors\MonitorRecorderElementEditor.xaml.cs">
<DependentUpon>MonitorRecorderElementEditor.xaml</DependentUpon>
</Compile>
@@ -191,6 +196,9 @@
<Compile Include="PropertiesTemplates\HeaterTemplate.xaml.cs">
<DependentUpon>HeaterTemplate.xaml</DependentUpon>
</Compile>
+ <Compile Include="PropertiesTemplates\ValveTemplate.xaml.cs">
+ <DependentUpon>ValveTemplate.xaml</DependentUpon>
+ </Compile>
<Compile Include="PropertiesTemplates\TextTemplate.xaml.cs">
<DependentUpon>TextTemplate.xaml</DependentUpon>
</Compile>
@@ -251,6 +259,7 @@
<Compile Include="PropertiesTemplates\SingleGraphTemplate.xaml.cs">
<DependentUpon>SingleGraphTemplate.xaml</DependentUpon>
</Compile>
+ <Compile Include="TechGraphController.cs" />
<Compile Include="TechItems\BlowerItem.cs" />
<Compile Include="TechItems\BreakSensorItem.cs" />
<Compile Include="TechItems\ControllerItem.cs" />
@@ -266,6 +275,7 @@
<Compile Include="TechItems\ProcessParametersItem.cs" />
<Compile Include="TechItems\SpeedSensorItem.cs" />
<Compile Include="TechItems\TextItem.cs" />
+ <Compile Include="TechItems\ValveItem.cs" />
<Compile Include="TechItems\WinderItem.cs" />
<Compile Include="TechItems\PidItem.cs" />
<Compile Include="TechItems\MotorItem.cs" />
@@ -284,6 +294,10 @@
<Compile Include="Views\MachineTechView.xaml.cs">
<DependentUpon>MachineTechView.xaml</DependentUpon>
</Compile>
+ <Page Include="Editors\ValveElementEditor.xaml">
+ <Generator>MSBuild:Compile</Generator>
+ <SubType>Designer</SubType>
+ </Page>
<Page Include="Editors\MonitorRecorderElementEditor.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
@@ -380,6 +394,10 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
+ <Page Include="PropertiesTemplates\ValveTemplate.xaml">
+ <Generator>MSBuild:Compile</Generator>
+ <SubType>Designer</SubType>
+ </Page>
<Page Include="PropertiesTemplates\TextTemplate.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
@@ -500,6 +518,14 @@
<Project>{b9ae25d6-be35-492f-9079-21a7f3e6f7cc}</Project>
<Name>RealTimeGraphEx</Name>
</ProjectReference>
+ <ProjectReference Include="..\..\..\SideChains\RealTimeGraphX.WPF\RealTimeGraphX.WPF.csproj">
+ <Project>{99d233c5-fee7-418e-9c25-d4584cb52e28}</Project>
+ <Name>RealTimeGraphX.WPF</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\..\..\SideChains\RealTimeGraphX\RealTimeGraphX.csproj">
+ <Project>{6d55a3b8-46d3-493a-a143-aebd2b98d683}</Project>
+ <Name>RealTimeGraphX</Name>
+ </ProjectReference>
<ProjectReference Include="..\..\..\Tango.BL\Tango.BL.csproj">
<Project>{f441feee-322a-4943-b566-110e12fd3b72}</Project>
<Name>Tango.BL</Name>
@@ -685,6 +711,9 @@
<ItemGroup>
<Resource Include="Images\csv.png" />
</ItemGroup>
+ <ItemGroup>
+ <Resource Include="Images\valve.png" />
+ </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<ProjectExtensions>
<VisualStudio>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechGraphController.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechGraphController.cs
new file mode 100644
index 000000000..28c75f79f
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechGraphController.cs
@@ -0,0 +1,29 @@
+using RealTimeGraphX;
+using RealTimeGraphX.DataPoints;
+using RealTimeGraphX.Renderers;
+using RealTimeGraphX.WPF.DataSeries;
+using RealTimeGraphX.WPF.Painters;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.MachineStudio.Technician
+{
+ public class TechGraphController : GraphControllerBase<WpfDataSeries, TimeSpanDataPoint, DoubleDataPoint>
+ {
+ public TechGraphController(int refreshRate = 50)
+ {
+ var renderer = new GraphScrollingRenderer<WpfDataSeries, TimeSpanDataPoint, DoubleDataPoint>()
+ {
+ RefreshRate = TimeSpan.FromMilliseconds(refreshRate)
+ };
+
+ var painter = new WpfScrollingGraphPainter();
+
+ ConnectOutput(renderer);
+ renderer.ConnectOutput(painter);
+ }
+ }
+}
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 a935ee5a6..377738d09 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
@@ -1,4 +1,5 @@
-using System;
+using RealTimeGraphX.DataPoints;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -41,24 +42,38 @@ namespace Tango.MachineStudio.Technician.TechItems
_techMonitor = value;
RaisePropertyChangedAuto();
- if (_techMonitor != old && Editor != null)
- {
- Editor.InnerGraph.InnerGraph.MaxPoints = GraphsHelper.GetMaxPoints(TechMonitor.PointsPerFrame);
- Editor.InnerGraph.InvalidateGraph();
- }
-
ItemGuid = value != null ? value.Guid : null;
TechName = _techMonitor != null ? _techMonitor.Description : null;
}
}
+ private MultiGraphElementEditor _editor;
/// <summary>
/// Gets or sets the item editor.
/// </summary>
[XmlIgnore]
- public MultiGraphElementEditor Editor { get; set; }
+ public MultiGraphElementEditor Editor
+ {
+ get { return _editor; }
+ set
+ {
+ _editor = value;
+ SetEditorSettings();
+ }
+ }
+ private int _duration;
+ public int Duration
+ {
+ get { return _duration; }
+ set
+ {
+ _duration = value;
+ RaisePropertyChangedAuto();
+ SetEditorSettings();
+ }
+ }
private double _min;
/// <summary>
/// Gets or sets the minimum graph value.
@@ -66,7 +81,11 @@ namespace Tango.MachineStudio.Technician.TechItems
public double Min
{
get { return _min; }
- set { _min = value; RaisePropertyChangedAuto(); }
+ set
+ {
+ _min = value; RaisePropertyChangedAuto();
+ SetEditorSettings();
+ }
}
private double _max;
@@ -76,7 +95,11 @@ namespace Tango.MachineStudio.Technician.TechItems
public double Max
{
get { return _max; }
- set { _max = value; RaisePropertyChangedAuto(); }
+ set
+ {
+ _max = value; RaisePropertyChangedAuto();
+ SetEditorSettings();
+ }
}
private bool _useAutoRange;
@@ -86,7 +109,21 @@ namespace Tango.MachineStudio.Technician.TechItems
public bool UseAutoRange
{
get { return _useAutoRange; }
- set { _useAutoRange = value; RaisePropertyChangedAuto(); }
+ set
+ {
+ _useAutoRange = value; RaisePropertyChangedAuto();
+ SetEditorSettings();
+ }
+ }
+
+ private int _decimalPlaces;
+ /// <summary>
+ /// Gets or sets the decimal places of y-axis.
+ /// </summary>
+ public int DecimalPlaces
+ {
+ get { return _decimalPlaces; }
+ set { _decimalPlaces = value; RaisePropertyChangedAuto(); }
}
private bool _isPaused;
@@ -100,11 +137,7 @@ namespace Tango.MachineStudio.Technician.TechItems
set
{
_isPaused = value; RaisePropertyChangedAuto();
-
- if (Editor != null)
- {
- Editor.InnerGraph.Controller.IsPaused = _isPaused;
- }
+ SetEditorSettings();
}
}
@@ -144,6 +177,9 @@ namespace Tango.MachineStudio.Technician.TechItems
/// </summary>
public MultiGraphItem() : base()
{
+ _useAutoRange = true;
+ DecimalPlaces = 1;
+ _duration = 10;
_timer = new DispatcherTimer();
_timer.Tick += _timer_Tick;
_timer.Interval = TimeSpan.FromSeconds(1);
@@ -173,6 +209,20 @@ namespace Tango.MachineStudio.Technician.TechItems
});
}
+ private void SetEditorSettings()
+ {
+ if (Editor != null)
+ {
+ var controller = Editor.InnerGraph.Controller;
+
+ controller.Range.MaximumX = new TimeSpanDataPoint(TimeSpan.FromSeconds(_duration));
+ controller.Range.MinimumY = new DoubleDataPoint(_min);
+ controller.Range.MaximumY = new DoubleDataPoint(_max);
+ controller.Range.AutoY = _useAutoRange;
+ controller.IsPaused = _isPaused;
+ }
+ }
+
private void OnTechMonitorChanged()
{
if (TechMonitor != null)
@@ -233,6 +283,8 @@ namespace Tango.MachineStudio.Technician.TechItems
cloned.Min = Min;
cloned.Max = Max;
cloned.UseAutoRange = UseAutoRange;
+ cloned.Duration = Duration;
+ cloned.DecimalPlaces = DecimalPlaces;
return cloned;
}
}
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 87d971233..808dadb68 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
@@ -1,6 +1,8 @@
-using System;
+using RealTimeGraphX.DataPoints;
+using System;
using System.Collections.Generic;
using System.Linq;
+using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Media;
@@ -42,12 +44,6 @@ namespace Tango.MachineStudio.Technician.TechItems
_techMonitor = value;
RaisePropertyChangedAuto();
- if (_techMonitor != old && Editor != null)
- {
- Editor.InnerGraph.InnerGraph.MaxPoints = GraphsHelper.GetMaxPoints(TechMonitor.PointsPerFrame);
- Editor.InnerGraph.InvalidateGraph();
- }
-
ItemGuid = value != null ? value.Guid : null;
TechName = _techMonitor != null ? _techMonitor.Description : null;
@@ -55,11 +51,32 @@ namespace Tango.MachineStudio.Technician.TechItems
}
}
+ private SingleGraphElementEditor _editor;
/// <summary>
/// Gets or sets the item editor.
/// </summary>
[XmlIgnore]
- public SingleGraphElementEditor Editor { get; set; }
+ public SingleGraphElementEditor Editor
+ {
+ get { return _editor; }
+ set
+ {
+ _editor = value;
+ SetEditorSettings();
+ }
+ }
+
+ private int _duration;
+ public int Duration
+ {
+ get { return _duration; }
+ set
+ {
+ _duration = value;
+ RaisePropertyChangedAuto();
+ SetEditorSettings();
+ }
+ }
private double _min;
/// <summary>
@@ -68,7 +85,11 @@ namespace Tango.MachineStudio.Technician.TechItems
public double Min
{
get { return _min; }
- set { _min = value; RaisePropertyChangedAuto(); }
+ set
+ {
+ _min = value; RaisePropertyChangedAuto();
+ SetEditorSettings();
+ }
}
private double _max;
@@ -78,7 +99,11 @@ namespace Tango.MachineStudio.Technician.TechItems
public double Max
{
get { return _max; }
- set { _max = value; RaisePropertyChangedAuto(); }
+ set
+ {
+ _max = value; RaisePropertyChangedAuto();
+ SetEditorSettings();
+ }
}
private bool _useAutoRange;
@@ -88,7 +113,21 @@ namespace Tango.MachineStudio.Technician.TechItems
public bool UseAutoRange
{
get { return _useAutoRange; }
- set { _useAutoRange = value; RaisePropertyChangedAuto(); }
+ set
+ {
+ _useAutoRange = value; RaisePropertyChangedAuto();
+ SetEditorSettings();
+ }
+ }
+
+ private int _decimalPlaces;
+ /// <summary>
+ /// Gets or sets the decimal places of y-axis.
+ /// </summary>
+ public int DecimalPlaces
+ {
+ get { return _decimalPlaces; }
+ set { _decimalPlaces = value; RaisePropertyChangedAuto(); }
}
private bool _isPaused;
@@ -102,11 +141,7 @@ namespace Tango.MachineStudio.Technician.TechItems
set
{
_isPaused = value; RaisePropertyChangedAuto();
-
- if (Editor != null)
- {
- Editor.InnerGraph.Controller.IsPaused = _isPaused;
- }
+ SetEditorSettings();
}
}
@@ -146,6 +181,9 @@ namespace Tango.MachineStudio.Technician.TechItems
/// </summary>
public SingleGraphItem() : base()
{
+ _useAutoRange = true;
+ DecimalPlaces = 1;
+ _duration = 10;
_timer = new DispatcherTimer();
_timer.Tick += _timer_Tick;
_timer.Interval = TimeSpan.FromSeconds(1);
@@ -175,6 +213,21 @@ namespace Tango.MachineStudio.Technician.TechItems
});
}
+ private void SetEditorSettings()
+ {
+ if (Editor != null)
+ {
+ var controller = Editor.InnerGraph.Controller;
+
+ controller.Range.MaximumX = new TimeSpanDataPoint(TimeSpan.FromSeconds(_duration));
+ controller.Range.MinimumY = new DoubleDataPoint(_min);
+ controller.Range.MaximumY = new DoubleDataPoint(_max);
+ controller.Range.AutoY = _useAutoRange;
+ controller.IsPaused = _isPaused;
+ controller.DataSeriesCollection[0].Stroke = Color;
+ }
+ }
+
private void _timer_Tick(object sender, EventArgs e)
{
RecordingTime = DateTime.Now - _recording_start_time;
@@ -235,7 +288,19 @@ namespace Tango.MachineStudio.Technician.TechItems
cloned.Min = Min;
cloned.Max = Max;
cloned.UseAutoRange = UseAutoRange;
+ cloned.Duration = Duration;
+ cloned.DecimalPlaces = DecimalPlaces;
return cloned;
}
+
+ protected override void RaisePropertyChanged(string propName)
+ {
+ base.RaisePropertyChanged(propName);
+
+ if (propName == nameof(Color))
+ {
+ SetEditorSettings();
+ }
+ }
}
}
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 6fa00ae0a..f59107ca2 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
@@ -41,6 +41,7 @@ namespace Tango.MachineStudio.Technician.TechItems
[XmlInclude(typeof(TextItem))]
[XmlInclude(typeof(HeaterItem))]
[XmlInclude(typeof(MonitorRecorderItem))]
+ [XmlInclude(typeof(ValveItem))]
public abstract class TechItem : ExtendedObject
{
/// <summary>
@@ -181,7 +182,7 @@ namespace Tango.MachineStudio.Technician.TechItems
set
{
_color = value;
- RaisePropertyChangedAuto();
+ RaisePropertyChanged(nameof(Color));
_colorNumber = ColorHelper.ColorToInteger(value);
}
}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/ValveItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/ValveItem.cs
new file mode 100644
index 000000000..e2f01565a
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/ValveItem.cs
@@ -0,0 +1,117 @@
+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.BL.Entities;
+using Tango.Core.Commands;
+using Tango.PMR.Diagnostics;
+using Tango.SharedUI.Helpers;
+
+namespace Tango.MachineStudio.Technician.TechItems
+{
+ [TechItem(10)]
+ public class ValveItem : TechItem
+ {
+ /// <summary>
+ /// Occurs when the user has changed the current value.
+ /// </summary>
+ public event EventHandler<ValveStateCode> StateChanged;
+
+ /// <summary>
+ /// Gets or sets the set command.
+ /// </summary>
+ [XmlIgnore]
+ public RelayCommand<String> SetCommand { get; set; }
+
+ private TechValve _techValve;
+ /// <summary>
+ /// Gets or sets the db tech item.
+ /// </summary>
+ [XmlIgnore]
+ public TechValve TechValve
+ {
+ get { return _techValve; }
+ set
+ {
+ _techValve = value; RaisePropertyChangedAuto(); TechName = _techValve != null ? _techValve.Description : null; ItemGuid = value != null ? value.Guid : null;
+
+ if (_techValve != null)
+ {
+ State = (ValveStateCode)Enum.Parse(typeof(ValveStateCode), _techValve.State1.Replace(" ", ""), true);
+ }
+ }
+ }
+
+ private ValveStateCode _state;
+ /// <summary>
+ /// Gets or sets a value indicating whether this <see cref="ValveItem"/> is on.
+ /// </summary>
+ [XmlIgnore]
+ public ValveStateCode State
+ {
+ get { return _state; }
+ set { _state = value; RaisePropertyChangedAuto(); }
+ }
+
+ private ValveStateCode _effectiveState;
+ /// <summary>
+ /// Gets or sets the effective value received from the embedded device.
+ /// </summary>
+ [XmlIgnore]
+ public ValveStateCode EffectiveState
+ {
+ get { return _effectiveState; }
+ set
+ {
+ if (_effectiveState != value)
+ {
+ _effectiveState = value;
+ RaisePropertyChangedAuto();
+ _state = value;
+ RaisePropertyChanged(nameof(State));
+ }
+ }
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="ValveItem"/> class.
+ /// </summary>
+ public ValveItem() : base()
+ {
+ Name = "Valve Controller";
+ Description = "Valve Controller";
+ Image = ResourceHelper.GetImageFromResources("Images/valve.png");
+ Color = Colors.White;
+
+ SetCommand = new RelayCommand<string>((x) =>
+ {
+ State = (ValveStateCode)Enum.Parse(typeof(ValveStateCode), x.Replace(" ", ""), true);
+ StateChanged?.Invoke(this, State);
+ });
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="ValveItem"/> class.
+ /// </summary>
+ /// <param name="techValve">The db tech item.</param>
+ public ValveItem(TechValve techValve) : this()
+ {
+ TechValve = techValve;
+ }
+
+ /// <summary>
+ /// Clones this instance.
+ /// </summary>
+ /// <returns></returns>
+ public override TechItem Clone()
+ {
+ ValveItem cloned = base.Clone() as ValveItem;
+ cloned.TechValve = TechValve;
+ cloned.State = State;
+ 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 2ca5aa43b..59cd6fe19 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
@@ -35,6 +35,9 @@ using Tango.MachineStudio.Technician.Helpers;
using Tango.MachineStudio.Technician.Models;
using Tango.Logging;
using Microsoft.WindowsAPICodePack.Dialogs;
+using RealTimeGraphX;
+using RealTimeGraphX.WPF.DataSeries;
+using RealTimeGraphX.DataPoints;
namespace Tango.MachineStudio.Technician.ViewModels
{
@@ -47,8 +50,8 @@ namespace Tango.MachineStudio.Technician.ViewModels
{
private List<PropertyInfo> _diagnoticsMonitorsDataProperties;
private IDiagnosticsFrameProvider _diagnosticsFrameProvider;
- private Dictionary<SingleGraphItem, GraphController> _singleControllers;
- private Dictionary<MultiGraphItem, GraphMultiController> _multiControllers;
+ private Dictionary<SingleGraphItem, TechGraphController> _singleControllers;
+ private Dictionary<MultiGraphItem, TechGraphController> _multiControllers;
private static object _elementsLock = new object();
private String _lastTechProjectFile;
private INotificationProvider _notification;
@@ -62,6 +65,8 @@ namespace Tango.MachineStudio.Technician.ViewModels
private List<SingleTechRecordingData> _single_monitors_recordings;
private List<MultiTechRecordingData> _multi_monitors_recordings;
+ private DateTime _start_time = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 0, 0, 0);
+ private DateTime _last_time = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 0, 0, 0);
#region Properties
@@ -290,8 +295,8 @@ namespace Tango.MachineStudio.Technician.ViewModels
_notification = notificationProvider;
_eventLogger = eventLogger;
- _singleControllers = new Dictionary<SingleGraphItem, GraphController>();
- _multiControllers = new Dictionary<MultiGraphItem, GraphMultiController>();
+ _singleControllers = new Dictionary<SingleGraphItem, TechGraphController>();
+ _multiControllers = new Dictionary<MultiGraphItem, TechGraphController>();
AvailableTechItems = TechItem.GetAvailableTechItems().ToObservableCollection();
SelectedTechItem = AvailableTechItems.FirstOrDefault();
_diagnoticsMonitorsDataProperties = typeof(DiagnosticsMonitors).GetProperties(BindingFlags.Public | BindingFlags.Instance).ToList();
@@ -376,6 +381,10 @@ namespace Tango.MachineStudio.Technician.ViewModels
/// <param name="data">The data.</param>
private void PopulateDiagnosticsData(StartDiagnosticsResponse data)
{
+ TimeSpan delta_base = DateTime.Now - _start_time;
+ double delta_mili = (DateTime.Now - _last_time).TotalMilliseconds;
+ _last_time = DateTime.Now;
+
if (DateTime.Now > _lastDiagnosticsResponseUpdate.AddMilliseconds(MIN_DIAGNOSTICS_UPDATE_MILI))
{
CurrentDiagnosticsResponse = data;
@@ -451,20 +460,21 @@ namespace Tango.MachineStudio.Technician.ViewModels
if (prop != null)
{
- GraphController controller = null;
+ TechGraphController controller = null;
if (_singleControllers.TryGetValue(graphItem, out controller))
{
var points = GetDataArray(graphItem.TechMonitor, prop.GetValue(data.Monitors));
- int maxPoints = (int)(_diagnosticsFrameProvider.FrameRate * GraphsDurationSeconds * points.Count);
+ List<TimeSpanDataPoint> times = new List<TimeSpanDataPoint>();
+ var dPoints = points.Select(x => new DoubleDataPoint(x)).ToList();
- InvokeUI(() =>
+ for (int i = 0; i < points.Count; i++)
{
- graphItem.Editor.InnerGraph.InnerGraph.MaxPoints = maxPoints;
- });
+ times.Add(delta_base.Add(TimeSpan.FromMilliseconds((delta_mili / points.Count) * i)));
+ }
- controller.PushData(points);
+ controller.PushData(times, dPoints);
var _graph_recording = _single_graphs_recordings.SingleOrDefault(x => x.Tag == graphItem);
if (_graph_recording != null)
@@ -482,7 +492,7 @@ namespace Tango.MachineStudio.Technician.ViewModels
if (prop != null)
{
- GraphMultiController controller = null;
+ TechGraphController controller = null;
if (_multiControllers.TryGetValue(graphItem, out controller))
{
@@ -490,15 +500,23 @@ namespace Tango.MachineStudio.Technician.ViewModels
if (points.Count > 0)
{
- int maxPoints = (int)(_diagnosticsFrameProvider.FrameRate * GraphsDurationSeconds * points[0].Count);
+ List<TimeSpanDataPoint> times = new List<TimeSpanDataPoint>();
+ var dPoints = points.Select(x => new List<DoubleDataPoint>(x.Select(y => new DoubleDataPoint(y)))).ToList();
- InvokeUI(() =>
+ for (int i = 0; i < points[0].Count; i++)
{
- graphItem.Editor.InnerGraph.InnerGraph.MaxPoints = maxPoints;
- });
- }
+ times.Add(delta_base.Add(TimeSpan.FromMilliseconds((delta_mili / points[0].Count) * i)));
+ }
- controller.PushData(points);
+ List<List<TimeSpanDataPoint>> timesMat = new List<List<TimeSpanDataPoint>>();
+
+ for (int i = 0; i < controller.DataSeriesCollection.Count; i++)
+ {
+ timesMat.Add(times);
+ }
+
+ controller.PushData(timesMat, dPoints);
+ }
var _graph_recording = _multi_graph_recordings.SingleOrDefault(x => x.Tag == graphItem);
if (_graph_recording != null)
@@ -541,6 +559,17 @@ namespace Tango.MachineStudio.Technician.ViewModels
heaterItem.HeaterState = heaterState;
}
}
+ else if (item.GetType() == typeof(ValveItem))
+ {
+ ValveItem valveItem = item as ValveItem;
+
+ var valveState = data.ValvesStates.SingleOrDefault(x => x.ValveType == (ValveType)valveItem.TechValve.Code);
+
+ if (valveState != null)
+ {
+ valveItem.EffectiveState = valveState.State;
+ }
+ }
else if (item.GetType() == typeof(BlowerItem))
{
BlowerItem blowerItem = item as BlowerItem;
@@ -624,15 +653,15 @@ namespace Tango.MachineStudio.Technician.ViewModels
/// </summary>
protected virtual void OnDisableRenderingChanged()
{
- foreach (var controller in _singleControllers)
- {
- controller.Value.ChangeRenderMode(!DisableRendering);
- }
+ //foreach (var controller in _singleControllers)
+ //{
+ // controller.Value.ChangeRenderMode(!DisableRendering);
+ //}
- foreach (var controller in _multiControllers)
- {
- controller.Value.ChangeRenderMode(!DisableRendering);
- }
+ //foreach (var controller in _multiControllers)
+ //{
+ // controller.Value.ChangeRenderMode(!DisableRendering);
+ //}
}
#endregion
@@ -668,6 +697,11 @@ namespace Tango.MachineStudio.Technician.ViewModels
var editor = CreateElement<HeaterElementEditor, HeaterItem, TechHeater>(bounds, Adapter.TechHeaters.FirstOrDefault());
InitTechHeater(editor.HeaterItem);
}
+ else if (item is ValveItem)
+ {
+ var editor = CreateElement<ValveElementEditor, ValveItem, TechValve>(bounds, Adapter.TechValves.FirstOrDefault());
+ InitTechValveItem(editor.ValveItem);
+ }
else if (item is SingleGraphItem)
{
var editor = CreateElement<SingleGraphElementEditor, SingleGraphItem, TechMonitor>(bounds, Adapter.TechMonitors.Where(x => !x.MultiChannel).FirstOrDefault());
@@ -804,6 +838,11 @@ namespace Tango.MachineStudio.Technician.ViewModels
(item as HeaterItem).TechHeater = Adapter.TechHeaters.FirstOrDefault(x => x.Guid == item.ItemGuid);
CreateElement<HeaterElementEditor>(item);
}
+ else if (item is ValveItem)
+ {
+ (item as ValveItem).TechValve = Adapter.TechValves.FirstOrDefault(x => x.Guid == item.ItemGuid);
+ CreateElement<ValveElementEditor>(item);
+ }
else if (item is MeterItem)
{
(item as MeterItem).TechMonitor = Adapter.TechMonitors.Where(x => !x.MultiChannel).FirstOrDefault(x => x.Guid == item.ItemGuid);
@@ -956,36 +995,38 @@ namespace Tango.MachineStudio.Technician.ViewModels
{
var graphItem = element.HostedElement as SingleGraphItem;
var editor = element as SingleGraphElementEditor;
- graphItem.Editor = editor;
- editor.InnerGraph.InnerGraph.MaxPoints = GraphsHelper.GetMaxPoints(graphItem.TechMonitor.PointsPerFrame);
- GraphController controller = new GraphController();
+ TechGraphController controller = new TechGraphController();
+ controller.AddDataSeries(new WpfDataSeries()
+ {
+ Stroke = Colors.DodgerBlue,
+ });
editor.InnerGraph.Controller = controller;
+ graphItem.Editor = editor;
+
_singleControllers.Add(graphItem, controller);
}
else if (element is MultiGraphElementEditor)
{
var graphItem = element.HostedElement as MultiGraphItem;
var editor = element as MultiGraphElementEditor;
- editor.InnerGraph.InnerGraph.MaxPoints = GraphsHelper.GetMaxPoints(graphItem.TechMonitor.PointsPerFrame);
- graphItem.Editor = editor;
-
- GraphMultiController controller = new GraphMultiController();
+ TechGraphController controller = new TechGraphController(500);
for (int i = 0; i < graphItem.TechMonitor.ChannelCount; i++)
{
- controller.AddSeries(new RealTimeGraphEx.DataSeries.DataYSeries()
+ controller.AddDataSeries(new WpfDataSeries()
{
- UseFillAndStroke = true,
+ Stroke = ColorHelper.GetRandomColor(),
Name = graphItem.TechMonitor.Name.First() + (i + 1).ToString(),
- Stroke = new SolidColorBrush(ColorHelper.GetRandomColor()),
});
}
editor.InnerGraph.Controller = controller;
+ graphItem.Editor = editor;
+
_multiControllers.Add(graphItem, controller);
}
else if (element is MotorElementEditor)
@@ -998,26 +1039,51 @@ namespace Tango.MachineStudio.Technician.ViewModels
var dispenser = element.HostedElement as DispenserItem;
InitDispenserItem(dispenser);
}
- else if (element is DigitalOutItem)
+ else if (element is DigitalOutElementEditor)
{
var ioItem = element.HostedElement as DigitalOutItem;
InitDigitalOutItem(ioItem);
}
- else if (element is ThreadMotionItem)
+ else if (element is ThreadMotionElementEditor)
{
var threadMotionItem = element.HostedElement as ThreadMotionItem;
InitThreadMotionItem(threadMotionItem);
}
- else if (element is MotorGroupItem)
+ else if (element is MotorGroupElementEditor)
{
var motorGroupItem = element.HostedElement as MotorGroupItem;
InitMotorGroupItem(motorGroupItem);
}
- else if (element is ControllerItem)
+ else if (element is ControllerElementEditor)
{
var controllerItem = element.HostedElement as ControllerItem;
InitControllerItem(controllerItem);
}
+ else if (element is MonitorRecorderElementEditor)
+ {
+ var item = element.HostedElement as MonitorRecorderItem;
+ InitMonitorRecorderItem(item);
+ }
+ else if (element is ValveElementEditor)
+ {
+ var item = element.HostedElement as ValveItem;
+ InitTechValveItem(item);
+ }
+ else if (element is BlowerElementEditor)
+ {
+ var item = element.HostedElement as BlowerItem;
+ InitBlowerItem(item);
+ }
+ else if (element is HeaterElementEditor)
+ {
+ var item = element.HostedElement as HeaterItem;
+ InitTechHeater(item);
+ }
+ else if (element is ProcessParametersElementEditor)
+ {
+ var item = element.HostedElement as ProcessParametersItem;
+ InitProcessParameterItem(item);
+ }
}
}
@@ -1025,6 +1091,10 @@ namespace Tango.MachineStudio.Technician.ViewModels
#region Init Tech Items
+ /// <summary>
+ /// Initializes the monitor recorder item.
+ /// </summary>
+ /// <param name="item">The item.</param>
private void InitMonitorRecorderItem(MonitorRecorderItem item)
{
item.RecordingStarted += () =>
@@ -1070,6 +1140,27 @@ namespace Tango.MachineStudio.Technician.ViewModels
}
/// <summary>
+ /// Initializes the tech valve.
+ /// </summary>
+ /// <param name="item">The valve item.</param>
+ private void InitTechValveItem(ValveItem item)
+ {
+ item.StateChanged += async (x, state) =>
+ {
+ try
+ {
+ CheckMachineOperator();
+ await MachineOperator.SetValveState((ValveType)item.TechValve.Code, state);
+ }
+ catch (Exception ex)
+ {
+ LogManager.Log(ex, String.Format("Error executing technician set valve state command on '{0}'.", item.TechName));
+ _eventLogger.Log(ex, String.Format("Error executing technician set valve state command on '{0}'.", item.TechName));
+ }
+ };
+ }
+
+ /// <summary>
/// Initializes the blower item.
/// </summary>
/// <param name="item">The blower item.</param>
@@ -1300,12 +1391,21 @@ namespace Tango.MachineStudio.Technician.ViewModels
/// <param name="editor">The editor.</param>
private void InitSingleGraphitem(SingleGraphItem item, SingleGraphElementEditor editor)
{
- editor.InnerGraph.InnerGraph.MaxPoints = GraphsHelper.GetMaxPoints(item.TechMonitor.PointsPerFrame);
- item.Editor = editor;
+ TechGraphController controller = new TechGraphController();
+ controller.Range.AutoY = true;
+ controller.Range.MinimumY = item.TechMonitor.Min;
+ controller.Range.MaximumY = item.TechMonitor.Max;
+ controller.Range.MaximumX = TimeSpan.FromSeconds(10);
+
+ controller.AddDataSeries(new WpfDataSeries()
+ {
+ Stroke = Colors.DodgerBlue,
+ });
- GraphController controller = new GraphController();
editor.InnerGraph.Controller = controller;
+ item.Editor = editor;
+
_singleControllers.Add(item, controller);
item.RecordingStarted += () =>
@@ -1350,23 +1450,25 @@ namespace Tango.MachineStudio.Technician.ViewModels
/// <param name="editor">The editor.</param>
private void InitMultiGraphItem(MultiGraphItem item, MultiGraphElementEditor editor)
{
- editor.InnerGraph.InnerGraph.MaxPoints = GraphsHelper.GetMaxPoints(item.TechMonitor.PointsPerFrame);
- item.Editor = editor;
-
- GraphMultiController controller = new GraphMultiController();
+ TechGraphController controller = new TechGraphController(500);
+ controller.Range.AutoY = true;
+ controller.Range.MinimumY = item.TechMonitor.Min;
+ controller.Range.MaximumY = item.TechMonitor.Max;
+ controller.Range.MaximumX = TimeSpan.FromSeconds(10);
for (int i = 0; i < item.TechMonitor.ChannelCount; i++)
{
- controller.AddSeries(new RealTimeGraphEx.DataSeries.DataYSeries()
+ controller.AddDataSeries(new WpfDataSeries()
{
- UseFillAndStroke = true,
+ Stroke = ColorHelper.GetRandomColor(),
Name = item.TechMonitor.Name.First() + (i + 1).ToString(),
- Stroke = new SolidColorBrush(ColorHelper.GetRandomColor()),
});
}
editor.InnerGraph.Controller = controller;
+ item.Editor = editor;
+
_multiControllers.Add(item, controller);
item.RecordingStarted += () =>
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 ac207fc55..3d129a252 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
@@ -280,21 +280,6 @@
</StackPanel>
<Grid Grid.Row="1">
-
- <StackPanel HorizontalAlignment="Right" VerticalAlignment="Top" Width="275" Margin="0 15 30 0">
- <TextBlock HorizontalAlignment="Center" FontWeight="SemiBold" Foreground="Gray">
- <Run>GRAPHS FIFO CAPACITY:</Run>
- <Run Text="{Binding TempGraphsDurationSeconds,Converter={StaticResource SecondsToTimeSpanConverter},Mode=OneWay,StringFormat='hh\\:mm\\:ss'}"></Run>
- </TextBlock>
- <Slider Margin="0 5 0 0" Minimum="1" Maximum="3600" Value="{Binding TempGraphsDurationSeconds}">
- <i:Interaction.Triggers>
- <i:EventTrigger EventName="PreviewMouseUp">
- <i:InvokeCommandAction Command="{Binding UpdateGraphsDurationCommand}"></i:InvokeCommandAction>
- </i:EventTrigger>
- </i:Interaction.Triggers>
- </Slider>
- </StackPanel>
-
<StackPanel HorizontalAlignment="Left" Orientation="Horizontal" Margin="20 0 0 0">
<ListBox ItemContainerStyle="{StaticResource basicListBoxItem}" ItemsSource="{Binding AvailableTechItems}" SelectedItem="{Binding SelectedTechItem,Mode=TwoWay}" HorizontalContentAlignment="Stretch" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollBarVisibility="Disabled">
<ListBox.ItemsPanel>
@@ -304,7 +289,7 @@
</ListBox.ItemsPanel>
<ListBox.ItemTemplate>
<DataTemplate DataType="{x:Type techItems:TechItem}">
- <Border Cursor="Hand" ToolTip="{Binding Description}" RenderTransformOrigin="0.5,0.5" Width="55" Height="55" Padding="10" Margin="5" BorderThickness="1" CornerRadius="100">
+ <Border Cursor="Hand" ToolTip="{Binding Description}" RenderTransformOrigin="0.5,0.5" Width="52" Height="52" Padding="10" Margin="5" BorderThickness="1" CornerRadius="100">
<Border.Style>
<Style TargetType="Border">
<Setter Property="RenderTransform">
@@ -490,6 +475,9 @@
<DataTemplate DataType="{x:Type sys:Nullable}">
</DataTemplate>
+ <DataTemplate DataType="{x:Type items:ValveItem}">
+ <templates:ValveTemplate/>
+ </DataTemplate>
<DataTemplate DataType="{x:Type items:MonitorRecorderItem}">
<templates:MonitorRecorderTemplate/>
</DataTemplate>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Tango.MachineStudio.UsersAndRoles.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Tango.MachineStudio.UsersAndRoles.csproj
index 539f10574..5c0ff937c 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Tango.MachineStudio.UsersAndRoles.csproj
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Tango.MachineStudio.UsersAndRoles.csproj
@@ -8,7 +8,7 @@
<OutputType>library</OutputType>
<RootNamespace>Tango.MachineStudio.UsersAndRoles</RootNamespace>
<AssemblyName>Tango.MachineStudio.UsersAndRoles</AssemblyName>
- <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
+ <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>