aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio
diff options
context:
space:
mode:
authorRoy Ben Shabat <roy.mail.net@gmail.com>2025-09-29 05:46:38 +0300
committerRoy Ben Shabat <roy.mail.net@gmail.com>2025-09-29 05:46:38 +0300
commit9c858b7b51be2eb5b2f515912d436224d7e6483c (patch)
tree46f854bfd37026967ef2dfa8f28a70cd8c8f7727 /Software/Visual_Studio
parent103bd3c1c825e4ecbb1c714e293a5c9d97a09c8c (diff)
downloadTango-9c858b7b51be2eb5b2f515912d436224d7e6483c.tar.gz
Tango-9c858b7b51be2eb5b2f515912d436224d7e6483c.zip
Process Parameters Visual Representation.
Filter RML by machine type on Research module.
Diffstat (limited to 'Software/Visual_Studio')
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs3
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml49
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/AddLiquidFactorViewVM.cs2
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs18
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/ProcessParametersView.xaml77
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/ProcessParametersView.xaml.cs21
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlsView.xaml9
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Converters/ProcessParameterToVisibilityConverter.cs30
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj3
-rw-r--r--Software/Visual_Studio/Tango.BL/Entities/ProcessParametersTable.cs217
-rw-r--r--Software/Visual_Studio/Tango.BL/ProcessParameters.csv70
-rw-r--r--Software/Visual_Studio/Tango.BL/Tango.BL.csproj3
-rw-r--r--Software/Visual_Studio/Tango.CSV/CsvDynamicReader.cs42
-rw-r--r--Software/Visual_Studio/Tango.SharedUI/Converters/LastItemInContainerToBooleanConverter.cs6
14 files changed, 514 insertions, 36 deletions
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 d262e154e..ab74433a6 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
@@ -1902,7 +1902,8 @@ namespace Tango.MachineStudio.Developer.ViewModels
//var processParams = _activeJobDbContext.ProcessParametersTables.ToList();
ColorSpaces = _activeJobDbContext.ColorSpaces.ToObservableCollection();
- Rmls = _activeJobDbContext.Rmls.OrderBy(i => i.Name).ToObservableCollection();
+
+ Rmls = _activeJobDbContext.Rmls.Where(x => x.MachineType == SelectedMachine.MachineType || x.MachineType == null).ToList().OrderBy(i => i.FinalName).ToObservableCollection();
WindingMethods = _activeJobDbContext.WindingMethods.ToObservableCollection();
SpoolTypes = _activeJobDbContext.SpoolTypes.ToObservableCollection();
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 a1cda2249..45c2d54cb 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
@@ -78,6 +78,7 @@
<localConverters:LiquidVolumesToLubricantLiquidVolume x:Key="LiquidVolumesToLubricantLiquidVolume" />
<commonConverters:UserRoleToVisibilityConverter x:Key="UserRoleToVisibilityConverter" />
<commonConverters:UserRoleToBooleanConverter x:Key="UserRoleToBooleanConverter" />
+ <commonConverters:ProcessParameterToVisibilityConverter x:Key="ProcessParameterToVisibilityConverter"></commonConverters:ProcessParameterToVisibilityConverter>
<ObjectDataProvider x:Key="dispenserDivisions" MethodName="GetValues" ObjectType="{x:Type sys:Enum}">
@@ -757,7 +758,7 @@
<StackPanel>
<TextBlock>MEDIA</TextBlock>
<StackPanel Orientation="Horizontal" DockPanel.Dock="Left">
- <controls:SearchComboBox Width="250" ItemsSource="{Binding Rmls}" SelectedItem="{Binding SelectedRML}" HorizontalContentAlignment="Stretch" SearchProperty="Name">
+ <controls:SearchComboBox Width="250" ItemsSource="{Binding Rmls}" SelectedItem="{Binding SelectedRML}" HorizontalContentAlignment="Stretch" SearchProperty="FinalName">
<ComboBox.ItemTemplate>
<DataTemplate>
<DockPanel>
@@ -838,7 +839,7 @@
</Viewbox>
<TextBlock Margin="5 0 0 0" FontSize="10">Use Preferred Index</TextBlock>
</StackPanel>
- <Button Command="{Binding SaveLiquidFactorsCommand}" HorizontalAlignment="Right" Style="{StaticResource MaterialDesignFlatButton}" IsEnabled="{Binding AuthenticationProvider.CurrentUser,Converter={StaticResource UserRoleToBooleanConverter},ConverterParameter='Researcher'}">
+ <Button Visibility="Collapsed" Command="{Binding SaveLiquidFactorsCommand}" HorizontalAlignment="Right" Style="{StaticResource MaterialDesignFlatButton}" IsEnabled="{Binding AuthenticationProvider.CurrentUser,Converter={StaticResource UserRoleToBooleanConverter},ConverterParameter='Researcher'}">
<StackPanel Orientation="Horizontal">
<materialDesign:PackIcon VerticalAlignment="Center" Kind="Harddisk"></materialDesign:PackIcon>
<TextBlock Margin="10 0 0 0" Foreground="{StaticResource CheckmarkFill}">SAVE FACTORS</TextBlock>
@@ -1460,7 +1461,7 @@
<Style TargetType="Border">
<Setter Property="BorderBrush" Value="{StaticResource BorderBrushGainsboro}"></Setter>
<Setter Property="BorderThickness" Value="1"></Setter>
- <Setter Property="Padding" Value="2"></Setter>
+ <Setter Property="Padding" Value="2 2 0 2"></Setter>
<Setter Property="Margin" Value="4"></Setter>
<Setter Property="CornerRadius" Value="3"></Setter>
</Style>
@@ -1474,10 +1475,46 @@
</Setter.Value>
</Setter>
</Style>
+ </WrapPanel.Resources>
+ <ItemsControl ItemsSource="{Binding ParametersGroups}">
+ <ItemsControl.ItemTemplate>
+ <DataTemplate>
+ <StackPanel>
+ <TextBlock Margin="0 10 0 0" Text="{Binding Name}" FontWeight="SemiBold" FontSize="10" Foreground="{StaticResource AccentColorBrush}"></TextBlock>
+ <ItemsControl ItemsSource="{Binding Parameters}">
+ <ItemsControl.ItemsPanel>
+ <ItemsPanelTemplate>
+ <WrapPanel IsItemsHost="True" Orientation="Horizontal" />
+ </ItemsPanelTemplate>
+ </ItemsControl.ItemsPanel>
+ <ItemsControl.ItemTemplate>
+ <DataTemplate>
+ <DockPanel>
+ <Grid Background="Transparent">
+ <Grid.Visibility>
+ <MultiBinding Converter="{StaticResource ProcessParameterToVisibilityConverter}">
+ <Binding RelativeSource="{RelativeSource AncestorType=UserControl}" Path="DataContext.SelectedRML.ForMachineType" />
+ <Binding Path="MachineTypes" />
+ </MultiBinding>
+ </Grid.Visibility>
+ <ContentControl>
+ <DockPanel>
+ <TextBlock DockPanel.Dock="Top" ToolTip="{Binding Name}" IsHitTestVisible="False" Margin="0 5 0 5" Text="{Binding Name}" FontSize="11" Foreground="{StaticResource MainWindow.Foreground}" TextWrapping="Wrap" TextAlignment="Center"></TextBlock>
+ <mahapps:NumericUpDown VerticalAlignment="Bottom" FontSize="20" Minimum="0" Margin="0 0 5 0" HideUpDownButtons="True" HorizontalContentAlignment="Center" Maximum="10000" StringFormat="{Binding StringFormat}" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="True" Value="{Binding Value,Mode=TwoWay}" Foreground="{StaticResource MainWindow.Foreground}"></mahapps:NumericUpDown>
+ </DockPanel>
+ </ContentControl>
+ </Grid>
+ </DockPanel>
+ </DataTemplate>
+ </ItemsControl.ItemTemplate>
+ </ItemsControl>
+ </StackPanel>
+ </DataTemplate>
+ </ItemsControl.ItemTemplate>
+ </ItemsControl>
- </WrapPanel.Resources>
- <editors:ParameterizedEditor ParameterizedObject="{Binding}">
+ <!--<editors:ParameterizedEditor ParameterizedObject="{Binding}">
<editors:ParameterizedEditor.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel IsItemsHost="True" Orientation="Horizontal" />
@@ -1495,7 +1532,7 @@
</Grid>
</DataTemplate>
</editors:ParameterizedEditor.DoubleTemplate>
- </editors:ParameterizedEditor>
+ </editors:ParameterizedEditor>-->
</WrapPanel>
</DockPanel>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/AddLiquidFactorViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/AddLiquidFactorViewVM.cs
index f6fca0ac2..7b6b0b692 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/AddLiquidFactorViewVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/AddLiquidFactorViewVM.cs
@@ -43,7 +43,7 @@ namespace Tango.MachineStudio.RML.ViewModels
public async override void OnShow()
{
base.OnShow();
- LiquidTypes = (await _context.LiquidTypes.ToListAsync()).ToObservableCollection();
+ LiquidTypes = (await _context.LiquidTypes.ToListAsync()).OrderBy(x => x.PreferredIndex).ToObservableCollection();
SelectedLiquidType = LiquidTypes.FirstOrDefault();
}
}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs
index 1da3723d1..2fcb87c59 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
@@ -29,6 +29,7 @@ using Google.Protobuf;
using Tango.ColorConversion;
using Tango.CSV;
using Tango.Core;
+using Tango.SharedUI.Helpers;
namespace Tango.MachineStudio.RML.ViewModels
{
@@ -282,6 +283,8 @@ namespace Tango.MachineStudio.RML.ViewModels
public RelayCommand<ProcessParametersTable> RemoveProcessParametersTableCommand { get; set; }
+ public RelayCommand<ProcessParametersTable> CopyProcessParametersTableCommand { get; set; }
+
public RelayCommand AddLiquidFactorCommand { get; set; }
public RelayCommand<LiquidTypesRml> RemoveLiquidFactorCommand { get; set; }
@@ -329,6 +332,7 @@ namespace Tango.MachineStudio.RML.ViewModels
BackToRmlsCommand = new RelayCommand(BackToRmls, () => IsFree);
AddProcessParametersTableCommand = new RelayCommand(AddProcessParametersTable, () => IsFree);
RemoveProcessParametersTableCommand = new RelayCommand<ProcessParametersTable>(RemoveProcessParametersTable, () => IsFree);
+ CopyProcessParametersTableCommand = new RelayCommand<ProcessParametersTable>(CopyProcessParametersTable, () => IsFree);
AddLiquidFactorCommand = new RelayCommand(AddLiquidFactor, () => IsFree);
RemoveLiquidFactorCommand = new RelayCommand<LiquidTypesRml>(RemoveLiquidFactor, () => IsFree);
CreateCalibrationDataExcelTemplateCommand = new RelayCommand(CreateCalibrationDataExcelTemplate);
@@ -481,6 +485,8 @@ namespace Tango.MachineStudio.RML.ViewModels
{
IsFree = false;
+ UIHelper.DoEvents();
+
if (_active_context != null)
{
_active_context.Dispose();
@@ -1045,6 +1051,18 @@ namespace Tango.MachineStudio.RML.ViewModels
}
}
+ private void CopyProcessParametersTable(ProcessParametersTable processParametersTable)
+ {
+ var nextTable = ActiveProcessParametersGroup.ProcessParametersTables.FirstOrDefault(x => x.TableIndex == processParametersTable.TableIndex + 1);
+ if (nextTable != null)
+ {
+ for (int i = 0; i < processParametersTable.VisualParameters.Count; i++)
+ {
+ nextTable.VisualParameters[i].Value = processParametersTable.VisualParameters[i].Value;
+ }
+ }
+ }
+
private void CreateCalibrationDataExcelTemplate()
{
SaveFileDialog dlg = new SaveFileDialog();
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/ProcessParametersView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/ProcessParametersView.xaml
index 03bf65522..b9e9f30c3 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/ProcessParametersView.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/ProcessParametersView.xaml
@@ -11,6 +11,7 @@
xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI"
+ xmlns:commonConverters="clr-namespace:Tango.MachineStudio.Common.Converters;assembly=Tango.MachineStudio.Common"
xmlns:dragAndDrop="clr-namespace:Tango.DragAndDrop;assembly=Tango.DragAndDrop"
xmlns:vm="clr-namespace:Tango.MachineStudio.RML.ViewModels"
xmlns:local="clr-namespace:Tango.MachineStudio.RML.Views"
@@ -19,6 +20,8 @@
<UserControl.Resources>
<converters:ColorToIntegerConverter x:Key="ColorToIntegerConverter"></converters:ColorToIntegerConverter>
+ <converters:LastItemInContainerToBooleanConverter x:Key="LastItemInContainerToBooleanConverter" />
+ <commonConverters:ProcessParameterToVisibilityConverter x:Key="ProcessParameterToVisibilityConverter"></commonConverters:ProcessParameterToVisibilityConverter>
</UserControl.Resources>
<Grid>
<Grid.RowDefinitions>
@@ -49,9 +52,27 @@
<ItemsControl.ItemTemplate>
<DataTemplate>
<DockPanel>
- <Button DockPanel.Dock="Right" Style="{StaticResource MaterialDesignFlatButton}" Padding="0" VerticalAlignment="Bottom" ToolTip="Remove table" Width="30" Margin="10 0 0 10" Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.RemoveProcessParametersTableCommand}" CommandParameter="{Binding}">
- <materialDesign:PackIcon Kind="Delete" Width="24" Height="24" Foreground="#FF7D7D" />
- </Button>
+ <StackPanel DockPanel.Dock="Right" VerticalAlignment="Bottom">
+ <Grid>
+ <Grid.Style>
+ <Style TargetType="Grid">
+ <Setter Property="Visibility" Value="Visible"></Setter>
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=ContentPresenter},Converter={StaticResource LastItemInContainerToBooleanConverter}}" Value="True">
+ <Setter Property="Visibility" Value="Collapsed"></Setter>
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </Grid.Style>
+ <Button DockPanel.Dock="Right" Style="{StaticResource MaterialDesignFlatButton}" Padding="0" VerticalAlignment="Bottom" ToolTip="Copy table" Width="30" Margin="10 0 0 10" Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.CopyProcessParametersTableCommand}" CommandParameter="{Binding}">
+ <materialDesign:PackIcon Kind="ChevronDoubleRight" Width="24" Height="24" Foreground="{StaticResource GreenBrush}" />
+ </Button>
+ </Grid>
+ <Button DockPanel.Dock="Right" Style="{StaticResource MaterialDesignFlatButton}" Padding="0" VerticalAlignment="Bottom" ToolTip="Remove table" Width="30" Margin="10 0 0 10" Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.RemoveProcessParametersTableCommand}" CommandParameter="{Binding}">
+ <materialDesign:PackIcon Kind="Delete" Width="24" Height="24" Foreground="#FF7D7D" />
+ </Button>
+ </StackPanel>
+
<Grid Style="{StaticResource draggableDroppableGrid}" dragAndDrop:DragAndDropService.Drop="OnProcessTableDropped">
<Border Padding="5" BorderThickness="1" Margin="20 5 0 5" BorderBrush="{StaticResource DarkGrayBrush}" Background="{StaticResource TransparentBackgroundBrush100}">
@@ -59,22 +80,44 @@
<DockPanel Width="300">
<TextBox materialDesign:HintAssist.Hint="Table Name" DockPanel.Dock="Top" Text="{Binding Name}"></TextBox>
- <ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto" Padding="5">
- <editors:ParameterizedEditor ParameterizedObject="{Binding}">
- <editors:ParameterizedEditor.ItemsPanel>
- <ItemsPanelTemplate>
- <StackPanel IsItemsHost="True" />
- </ItemsPanelTemplate>
- </editors:ParameterizedEditor.ItemsPanel>
- <editors:ParameterizedEditor.DoubleTemplate>
+ <ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto" Padding="5" Loaded="ScrollViewer_Loaded">
+ <ItemsControl ItemsSource="{Binding ParametersGroups}">
+ <ItemsControl.ItemTemplate>
<DataTemplate>
- <DockPanel>
- <TextBlock IsHitTestVisible="False" Margin="0 5 0 5" Text="{Binding Name}" FontSize="11"></TextBlock>
- <mahapps:NumericUpDown HorizontalAlignment="Right" Minimum="0" Margin="0 0 5 0" HideUpDownButtons="True" HorizontalContentAlignment="Right" Maximum="10000" StringFormat="{Binding StringFormat}" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="True" Value="{Binding Value,Mode=TwoWay}"></mahapps:NumericUpDown>
- </DockPanel>
+ <StackPanel>
+ <TextBlock Margin="0 10 0 0" Text="{Binding Name}" FontWeight="SemiBold" FontSize="10" Foreground="{StaticResource AccentColorBrush}"></TextBlock>
+ <ItemsControl ItemsSource="{Binding Parameters}">
+ <ItemsControl.ItemTemplate>
+ <DataTemplate>
+ <DockPanel>
+ <DockPanel.Visibility>
+ <MultiBinding Converter="{StaticResource ProcessParameterToVisibilityConverter}">
+ <Binding RelativeSource="{RelativeSource AncestorType=UserControl}" Path="DataContext.ActiveRML.ForMachineType" />
+ <Binding Path="MachineTypes" />
+ </MultiBinding>
+ </DockPanel.Visibility>
+ <TextBlock VerticalAlignment="Center" Text="{Binding Name}"></TextBlock>
+ <mahapps:NumericUpDown StringFormat="{Binding StringFormat}" InterceptArrowKeys="True" InterceptMouseWheel="True" HasDecimals="True" HorizontalAlignment="Right" Width="80" Minimum="0" Maximum="10000" Value="{Binding Value,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
+ <mahapps:NumericUpDown.Style>
+ <Style TargetType="mahapps:NumericUpDown" BasedOn="{StaticResource {x:Type mahapps:NumericUpDown}}">
+ <Setter Property="FontWeight" Value="Normal"></Setter>
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding HasDiff}" Value="True">
+ <Setter Property="FontWeight" Value="Bold"></Setter>
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </mahapps:NumericUpDown.Style>
+ </mahapps:NumericUpDown>
+ </DockPanel>
+ </DataTemplate>
+ </ItemsControl.ItemTemplate>
+ </ItemsControl>
+ </StackPanel>
</DataTemplate>
- </editors:ParameterizedEditor.DoubleTemplate>
- </editors:ParameterizedEditor>
+ </ItemsControl.ItemTemplate>
+ </ItemsControl>
+
</ScrollViewer>
</DockPanel>
</Grid>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/ProcessParametersView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/ProcessParametersView.xaml.cs
index a6d03ca0e..29da7b293 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/ProcessParametersView.xaml.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/ProcessParametersView.xaml.cs
@@ -23,6 +23,8 @@ namespace Tango.MachineStudio.RML.Views
/// </summary>
public partial class ProcessParametersView : UserControl
{
+ private HashSet<ScrollViewer> _processTablesViewers;
+
private MainViewVM _vm;
public DraggingSurface DraggingSurface
{
@@ -46,6 +48,7 @@ namespace Tango.MachineStudio.RML.Views
public ProcessParametersView()
{
InitializeComponent();
+ _processTablesViewers = new HashSet<ScrollViewer>();
DraggingSurface = draggingSurface;
Loaded += (_, __) => { _vm = DataContext as MainViewVM; };
}
@@ -55,5 +58,23 @@ namespace Tango.MachineStudio.RML.Views
ProcessParametersTable dropped = e.Droppable.DataContext as ProcessParametersTable;
_vm.OnProcessParametersTableDropped(dragged, dropped);
}
+
+ private void ScrollViewer_Loaded(object sender, RoutedEventArgs e)
+ {
+ var viewer = sender as ScrollViewer;
+ if (!_processTablesViewers.Contains(viewer))
+ {
+ viewer.ScrollChanged += Viewer_ScrollChanged;
+ _processTablesViewers.Add(viewer);
+ }
+ }
+
+ private void Viewer_ScrollChanged(object sender, ScrollChangedEventArgs e)
+ {
+ foreach (var viewer in _processTablesViewers.Where(x => x.IsLoaded && x.IsVisible && x != sender).ToList())
+ {
+ viewer.ScrollToVerticalOffset(e.VerticalOffset);
+ }
+ }
}
}
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 eee16a2df..ff341f5ed 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
@@ -6,6 +6,7 @@
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:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI"
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"
@@ -102,14 +103,14 @@
</StackPanel>
</Grid>
<Grid>
- <DataGrid Margin="0 0 0 10" BorderBrush="Silver" IsReadOnly="True" BorderThickness="1" SelectionUnit="FullRow" RowHeight="60" Background="{StaticResource TransparentBackgroundBrush}" AlternatingRowBackground="{StaticResource Transparent200}" AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False" ItemsSource="{Binding Rmls}" SelectedItem="{Binding SelectedRML}" HorizontalScrollBarVisibility="Disabled" EnableRowVirtualization="False">
- <DataGrid.CellStyle>
+ <controls:DoubleClickDataGrid Style="{StaticResource {x:Type DataGrid}}" DoubleClickCommand="{Binding ManageRmlCommand}" Margin="0 0 0 10" BorderBrush="Silver" IsReadOnly="True" BorderThickness="1" SelectionUnit="FullRow" RowHeight="60" Background="{StaticResource TransparentBackgroundBrush}" AlternatingRowBackground="{StaticResource Transparent200}" AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False" ItemsSource="{Binding Rmls}" SelectedItem="{Binding SelectedRML}" HorizontalScrollBarVisibility="Disabled" EnableRowVirtualization="False">
+ <controls:DoubleClickDataGrid.CellStyle>
<Style TargetType="DataGridCell" BasedOn="{StaticResource {x:Type DataGridCell}}">
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="VerticalContentAlignment" Value="Center"></Setter>
</Style>
- </DataGrid.CellStyle>
+ </controls:DoubleClickDataGrid.CellStyle>
<DataGrid.Columns>
<DataGridTemplateColumn Header="NAME" Width="220">
<DataGridTemplateColumn.CellTemplate>
@@ -162,7 +163,7 @@
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>-->
</DataGrid.Columns>
- </DataGrid>
+ </controls:DoubleClickDataGrid>
<Grid Background="#19000000" Visibility="{Binding LoadingRmls,Converter={StaticResource BooleanToVisibilityConverter}}">
<mahapps:ProgressRing HorizontalAlignment="Center" VerticalAlignment="Center" Width="100" Height="100"></mahapps:ProgressRing>
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Converters/ProcessParameterToVisibilityConverter.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Converters/ProcessParameterToVisibilityConverter.cs
new file mode 100644
index 000000000..4df25b3d3
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Converters/ProcessParameterToVisibilityConverter.cs
@@ -0,0 +1,30 @@
+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.BL.Enumerations;
+
+namespace Tango.MachineStudio.Common.Converters
+{
+ public class ProcessParameterToVisibilityConverter : IMultiValueConverter
+ {
+ public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
+ {
+ if (values[0] == DependencyProperty.UnsetValue) return Visibility.Visible;
+ MachineTypes? machineType = (MachineTypes?)values[0];
+ if (machineType == null) return Visibility.Visible;
+
+ List<MachineTypes> machineTypes = values[1] as List<MachineTypes>;
+ return machineTypes.Contains(machineType.Value) ? Visibility.Visible : Visibility.Collapsed;
+ }
+
+ public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj
index 62e4ad659..736858d39 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj
@@ -102,6 +102,7 @@
<DependentUpon>MachineView.xaml</DependentUpon>
</Compile>
<Compile Include="Controls\WpfGraphControl.cs" />
+ <Compile Include="Converters\ProcessParameterToVisibilityConverter.cs" />
<Compile Include="Converters\UserRoleToBooleanConverter.cs" />
<Compile Include="Converters\UserRoleToVisibilityConverter.cs" />
<Compile Include="MachineStudioTheme.cs" />
@@ -461,7 +462,7 @@
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<ProjectExtensions>
<VisualStudio>
- <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" />
+ <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" />
</VisualStudio>
</ProjectExtensions>
<PropertyGroup>
diff --git a/Software/Visual_Studio/Tango.BL/Entities/ProcessParametersTable.cs b/Software/Visual_Studio/Tango.BL/Entities/ProcessParametersTable.cs
index 1dadd61c8..83a079700 100644
--- a/Software/Visual_Studio/Tango.BL/Entities/ProcessParametersTable.cs
+++ b/Software/Visual_Studio/Tango.BL/Entities/ProcessParametersTable.cs
@@ -1,18 +1,25 @@
+using LiteDB;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
+using System.Reflection;
using System.Text;
using System.Threading.Tasks;
+using System.Xml.Serialization;
using Tango.BL.Enumerations;
+using Tango.Core;
using Tango.Core.ExtensionMethods;
+using Tango.Core.Helpers;
+using Tango.CSV;
namespace Tango.BL.Entities
{
public partial class ProcessParametersTable : ProcessParametersTableBase
{
public event EventHandler DyeingSpeedMinInkUptakeChanged;
+ private static List<ProcessParameterCsvModel> _csvModels;
[NotMapped]
[JsonIgnore]
@@ -82,12 +89,220 @@ namespace Tango.BL.Entities
return heaters.Average();
}
-
+
public PMR.Printing.ProcessParameters ToProcessParametersPMR()
{
PMR.Printing.ProcessParameters p = new PMR.Printing.ProcessParameters();
this.MapPrimitivesTo(p);
return p;
}
+
+ #region Visual Representation
+
+ public class ProcessParameterCsvModel
+ {
+ public String Name { get; set; }
+ public String Description { get; set; }
+ public List<MachineTypes> MachineTypes { get; set; }
+ public String Group { get; set; }
+ public int Index { get; set; }
+ public String StringFormat { get; set; }
+
+ public ProcessParameterCsvModel()
+ {
+ MachineTypes = new List<MachineTypes>();
+ }
+ }
+
+ public class ProcessParameter : ExtendedObject
+ {
+ private ParameterItem _parameterItem;
+ private ProcessParametersTable _table;
+
+ public String Name { get; set; }
+ public List<MachineTypes> MachineTypes { get; set; }
+ public String Group { get; set; }
+ public int Index { get; set; }
+ public String StringFormat { get; set; }
+
+ public bool HasDiff
+ {
+ get
+ {
+ if (_table == null) return false;
+ if (_table.ProcessParametersTablesGroup == null) return false;
+
+ foreach (var otherTable in _table.ProcessParametersTablesGroup.ProcessParametersTables.Where(x => x != _table).ToList())
+ {
+ var otherValue = otherTable.VisualParameters.FirstOrDefault(x => x.Name == Name);
+ if (otherValue != null)
+ {
+ if (otherValue.Value != Value) return true;
+ }
+ }
+
+ return false;
+ }
+ }
+
+ public double Value
+ {
+ get { return (double)_parameterItem.Value; }
+ set
+ {
+ _parameterItem.Value = value;
+ RaisePropertyChangedAuto();
+ RaisePropertyChanged(nameof(HasDiff));
+
+ if (_table == null) return;
+ if (_table.ProcessParametersTablesGroup == null) return;
+
+ foreach (var otherTable in _table.ProcessParametersTablesGroup.ProcessParametersTables.Where(x => x != _table).ToList())
+ {
+ var otherValue = otherTable.VisualParameters.FirstOrDefault(x => x.Name == Name);
+ if (otherValue != null)
+ {
+ otherValue.Invalidate();
+ }
+ }
+ }
+ }
+
+ public ProcessParameter(ParameterItem parameterItem, ProcessParametersTable table)
+ {
+ MachineTypes = new List<MachineTypes>();
+ _parameterItem = parameterItem;
+ _table = table;
+ }
+
+ public void Invalidate()
+ {
+ RaisePropertyChanged(nameof(HasDiff));
+ }
+ }
+
+ public class ProcessParameterGroup
+ {
+ public String Name { get; set; }
+
+ public List<ProcessParameter> Parameters { get; set; }
+
+ public ProcessParameterGroup()
+ {
+ Parameters = new List<ProcessParameter>();
+ }
+ }
+
+ [NotMapped]
+ [XmlIgnore]
+ [BsonIgnore]
+ [JsonIgnore]
+ [ParameterIgnore]
+ public List<ProcessParameterGroup> ParametersGroups
+ {
+ get
+ {
+ List<ProcessParameterGroup> groups = new List<ProcessParameterGroup>();
+
+ foreach (var g in VisualParameters.GroupBy(x => x.Group))
+ {
+ ProcessParameterGroup group = new ProcessParameterGroup();
+ group.Name = g.First().Group;
+ group.Parameters.AddRange(g);
+ groups.Add(group);
+ }
+
+ return groups;
+ }
+ }
+
+ private List<ProcessParameter> _visualParameters;
+ [NotMapped]
+ [XmlIgnore]
+ [BsonIgnore]
+ [JsonIgnore]
+ [ParameterIgnore]
+ public List<ProcessParameter> VisualParameters
+ {
+ get
+ {
+ if (_visualParameters != null)
+ {
+ return _visualParameters;
+ }
+
+ if (_csvModels == null)
+ {
+ var csv = EmbeddedResourceHelper.GetEmbeddedResourceText("Tango.BL.ProcessParameters.csv");
+ CsvDynamicReader reader = CsvDynamicReader.FromString(csv);
+
+ _csvModels = new List<ProcessParameterCsvModel>();
+
+ foreach (var row in reader.Rows)
+ {
+ ProcessParameterCsvModel csvModel = new ProcessParameterCsvModel();
+
+ csvModel.Name = row.Read("Name", "N/A");
+ csvModel.Description = row.Read("Description", "N/A");
+ csvModel.Group = row.Read("Group", "N/A");
+ csvModel.Index = row.Read("Index", 0);
+ csvModel.StringFormat = row.Read("StringFormat", "0.0");
+
+ String machineType = row.Read("MachineType", "ALL");
+
+ switch (machineType)
+ {
+ case "ALL":
+ csvModel.MachineTypes.AddRange(Enum.GetValues(typeof(MachineTypes)).Cast<MachineTypes>());
+ break;
+ case "TS-1800":
+ csvModel.MachineTypes.Add(MachineTypes.TS1800);
+ break;
+ case "X1":
+ csvModel.MachineTypes.Add(MachineTypes.X1);
+ break;
+ case "X4":
+ csvModel.MachineTypes.Add(MachineTypes.Eureka);
+ break;
+ case "X":
+ csvModel.MachineTypes.Add(MachineTypes.X1);
+ csvModel.MachineTypes.Add(MachineTypes.Eureka);
+ break;
+ }
+
+ _csvModels.Add(csvModel);
+ }
+ }
+
+ var parameters = this.Parameters.Where(x => x.Type == typeof(Double)).ToList();
+
+ _visualParameters = new List<ProcessParameter>();
+
+ foreach (var p in parameters)
+ {
+ var csvModel = _csvModels.SingleOrDefault(x => x.Name.Replace("_", "").ToLower() == p.Name.Replace(" ", "").ToLower());
+
+ if (csvModel.MachineTypes.Count > 0)
+ {
+ ProcessParameter parameter = new ProcessParameter(p, this);
+ parameter.Name = csvModel.Description;
+ parameter.MachineTypes = csvModel.MachineTypes;
+ parameter.Group = csvModel.Group;
+ parameter.Index = csvModel.Index;
+ parameter.StringFormat = csvModel.StringFormat;
+
+ _visualParameters.Add(parameter);
+ }
+ }
+
+ _visualParameters = _visualParameters.OrderBy(x => x.Index).ToList();
+
+ _visualParameters.ForEach(x => x.Invalidate());
+
+ return _visualParameters;
+ }
+ }
+
+ #endregion
}
}
diff --git a/Software/Visual_Studio/Tango.BL/ProcessParameters.csv b/Software/Visual_Studio/Tango.BL/ProcessParameters.csv
new file mode 100644
index 000000000..864d3ac9c
--- /dev/null
+++ b/Software/Visual_Studio/Tango.BL/ProcessParameters.csv
@@ -0,0 +1,70 @@
+Name,Description,MachineType,Group,Index,StringFormat
+DYEING_SPEED,Dyeing Speed [m/sec],ALL,GENERAL,1,0.0
+MIN_INK_UPTAKE,Min Ink Uptake [nl/cm],ALL,GENERAL,2,0.0
+MAX_INK_UPTAKE,Max Ink Uptake [nl/cm],ALL,GENERAL,3,0.0
+DRYER_BUFFER_LENGTH,Dryer Buffer Length [m],ALL,GENERAL,4,0.0
+E_WASTE_PREPARE_TIME,E Waste Prepare Time [sec],X,GENERAL,5,0.0
+DRYER_AIR_FLOW,Dryer Air Flow,TS-1800,AIR FLOW,7,0.0
+R_BLOWER_FLOW,Right Blower Flow,TS-1800,AIR FLOW,8,0.0
+L_BLOWER_FLOW,Left Blower Flow,TS-1800,AIR FLOW,9,0.0
+PRESSURE_BUILD_UP,Pressure Build Up,TS-1800,AIR FLOW,10,0.0
+E_TUNNEL_INCOMING_AIR_FLOW,Tunnel Incoming Air Flow [m^3/hr],X,AIR FLOW,11,0.0
+E_TUNNEL_OUTGOING_AIR_FLOW,Tunnel Outgoing Air Flow [m^3/hr],X,AIR FLOW,12,0.0
+E_DRYER_INCOMING_AIR_FLOW,Dryer Incoming Air Flow [m^3/hr],X,AIR FLOW,13,0.0
+E_DRYER_OUTGOING_AIR_FLOW,Dryer Outgoing Air Flow [m^3/hr],X,AIR FLOW,14,0.0
+DRYER_ZONE1_TEMP,Dryer Zone 1 Temp.,TS-1800,TEMPERATURE,15,0.0
+MIXER_TEMP,Mixer Temp.,TS-1800,TEMPERATURE,16,0.0
+HEAD_ZONE1_TEMP,Head Zone 1 Temp.,TS-1800,TEMPERATURE,17,0.0
+HEAD_ZONE2_TEMP,Head Zone 2 Temp.,TS-1800,TEMPERATURE,18,0.0
+HEAD_ZONE4_TEMP,Lubricant Temp.,TS-1800,TEMPERATURE,19,0.0
+R_BLOWER_TEMP,Right Blower Temp.,TS-1800,TEMPERATURE,20,0.0
+L_BLOWER_TEMP,Left Blower Temp.,TS-1800,TEMPERATURE,21,0.0
+E_MIXER_TEMP,Mixer Temp. [˚C],X,TEMPERATURE,22,0.0
+E_HEAD_ZONE1_TEMP,Head Zone 1 Temp.,NONE,TEMPERATURE,23,0.0
+E_HEAD_ZONE2_TEMP,Head Zone 2 Temp. [˚C],X,TEMPERATURE,24,0.0
+E_HEAD_ZONE3_TEMP,Head Zone 3 Temp.,NONE,TEMPERATURE,25,0.0
+E_TUNNEL_TEMP,Tunnel Temp. [˚C],X,TEMPERATURE,26,0.0
+E_DRYER_ZONE1_TEMP,Dryer Zone 1 Temp. [˚C],X,TEMPERATURE,27,0.0
+E_DRYER_ZONE2_TEMP,Dryer Zone 2 Temp. [˚C],X,TEMPERATURE,28,0.0
+E_DRYER_ZONE3_TEMP,Dryer Zone 3 Temp. [˚C],X,TEMPERATURE,29,0.0
+E_SPARE1,Dryer Average Temp. [˚C],X,TEMPERATURE,30,0.0
+E_LUBRICANT_TEMP,Lubricant Temp. [˚C],X,TEMPERATURE,31,0.0
+BTSR_FEEDING_TENSION,Btsr Feeding Tension,TS-1800,TENSION,32,0.0
+EXIT_TENSION,Dancer Tension,TS-1800,TENSION,33,0.0
+E_BTSR1_FEEDING_TENSION,Feeder BTSR 1 [gr],X,TENSION,34,0.0
+E_BTSR2_FEEDING_TENSION,Feeder BTSR 2 [gr],X4,TENSION,35,0.0
+E_BTSR3_FEEDING_TENSION,Feeder BTSR 3 [gr],X4,TENSION,36,0.0
+E_BTSR4_FEEDING_TENSION,Feeder BTSR 4 [gr],X4,TENSION,37,0.0
+E_WINDER1_TENSION,Dancer1 Tension [steps],X,TENSION,38,0.0
+E_WINDER2_TENSION,Dancer2 Tension [steps],X4,TENSION,39,0.0
+E_WINDER3_TENSION,Dancer3 Tension [steps],X4,TENSION,40,0.0
+E_WINDER4_TENSION,Dancer4 Tension [steps],X4,TENSION,41,0.0
+E_BTSR5_FEEDING_TENSION,Btsr1 Winder Tension [gr],X,TENSION,42,0.0
+E_BTSR6_FEEDING_TENSION,Btsr2 Winder Tension [gr],X4,TENSION,43,0.0
+E_BTSR7_FEEDING_TENSION,Btsr3 Winder Tension [gr],X4,TENSION,44,0.0
+E_BTSR8_FEEDING_TENSION,Btsr4 Winder Tension [gr],X4,TENSION,45,0.0
+HEAD_ZONE3_TEMP,Head Zone 3 Temp.,NONE,TEMPERATURE,46,0.0
+HEAD_ZONE5_TEMP,Head Zone 5 Temp.,NONE,TEMPERATURE,47,0.0
+HEAD_ZONE6_TEMP,Head Zone 6 Temp.,NONE,TEMPERATURE,48,0.0
+HEAD_AIR_FLOW,Head Air Flow,NONE,AIR FLOW,49,0.0
+PROCESS_PARAMETERS_TABLES_GROUP_GUID,Process Param. Tables Group,NONE,GENERAL,50,0.0
+TABLE_INDEX,Table Index,NONE,GENERAL,51,0.0
+HEAD_ZONE7_TEMP,Head Zone 7 Temp.,NONE,TEMPERATURE,52,0.0
+HEAD_ZONE8_TEMP,Head Zone 8 Temp.,NONE,TEMPERATURE,53,0.0
+HEAD_ZONE9_TEMP,Head Zone 9 Temp.,NONE,TEMPERATURE,54,0.0
+HEAD_ZONE10_TEMP,Head Zone 10 Temp.,NONE,TEMPERATURE,55,0.0
+HEAD_ZONE11_TEMP,Head Zone 11 Temp.,NONE,TEMPERATURE,56,0.0
+HEAD_ZONE12_TEMP,Head Zone 12 Temp.,NONE,TEMPERATURE,57,0.0
+BTSR_THREAD_LENGTH_OFFSET,Btsr Thread Length Offset,NONE,GENERAL,58,0.0
+E_WASTE_AIR_FLOW,E Waste Air Flow,NONE,AIR FLOW,59,0.0
+E_PUMP_TEMP,E Pump Temp.,NONE,TEMPERATURE,60,0.0
+E_PRESSURE_BUILD_UP,E Pressure Build Up,NONE,GENERAL,61,0.0
+E_SPARE2,E Spare2,NONE,GENERAL,62,0.0
+E_SPARE3,E Spare3,NONE,GENERAL,63,0.0
+E_SPARE4,E Spare4,NONE,GENERAL,64,0.0
+E_SPARE5,E Spare5,NONE,GENERAL,65,0.0
+DRYER_ZONE2_TEMP,Dryer Zone 2 Temp.,NONE,TEMPERATURE,66,0.0
+DRYER_ZONE3_TEMP,Dryer Zone 3 Temp.,NONE,TEMPERATURE,67,0.0
+FEEDER_TENSION,Feeder Tension,NONE,TENSION,68,0.0
+PULLER_TENSION,Puller Tension,NONE,TENSION,69,0.0
+WINDER_TENSION,Winder Tension,NONE,TENSION,70,0.0
diff --git a/Software/Visual_Studio/Tango.BL/Tango.BL.csproj b/Software/Visual_Studio/Tango.BL/Tango.BL.csproj
index 042105f11..04801741a 100644
--- a/Software/Visual_Studio/Tango.BL/Tango.BL.csproj
+++ b/Software/Visual_Studio/Tango.BL/Tango.BL.csproj
@@ -776,6 +776,7 @@
<None Include="packages.config">
<SubType>Designer</SubType>
</None>
+ <EmbeddedResource Include="ProcessParameters.csv" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
@@ -838,7 +839,7 @@
</Target>
<ProjectExtensions>
<VisualStudio>
- <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" />
+ <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" />
</VisualStudio>
</ProjectExtensions>
</Project> \ No newline at end of file
diff --git a/Software/Visual_Studio/Tango.CSV/CsvDynamicReader.cs b/Software/Visual_Studio/Tango.CSV/CsvDynamicReader.cs
index 33ba859eb..d43b9ba3d 100644
--- a/Software/Visual_Studio/Tango.CSV/CsvDynamicReader.cs
+++ b/Software/Visual_Studio/Tango.CSV/CsvDynamicReader.cs
@@ -20,6 +20,48 @@ namespace Tango.CSV
public char Delimiter { get; }
+ public static CsvDynamicReader FromString(String csv)
+ {
+ return new CsvDynamicReader(csv);
+ }
+
+ private CsvDynamicReader(string csvContent)
+ {
+ Delimiter = ',';
+ _colIndex = new Dictionary<string, int>(StringComparer.OrdinalIgnoreCase);
+ _rows = new List<Row>();
+
+ using (var sr = new StringReader(csvContent))
+ {
+ // Read to first non-empty line for headers
+ string headerLine;
+ do
+ {
+ headerLine = sr.ReadLine();
+ if (headerLine == null)
+ throw new InvalidDataException("CSV file has no header row.");
+ } while (string.IsNullOrWhiteSpace(headerLine));
+
+ var headers = ParseCsvLine(headerLine, Delimiter);
+ for (int i = 0; i < headers.Count; i++)
+ {
+ var clean = CleanHeader(headers[i]);
+ if (!_colIndex.ContainsKey(clean))
+ _colIndex.Add(clean, i);
+ // If duplicate header name appears, first one wins.
+ }
+
+ // Read all rows
+ string line;
+ while ((line = sr.ReadLine()) != null)
+ {
+ if (line.Length == 0) continue; // skip empty
+ var fields = ParseCsvLine(line, Delimiter).ToArray();
+ _rows.Add(new Row(this, fields));
+ }
+ }
+ }
+
public CsvDynamicReader(string path, char delimiter = ',')
{
if (path == null) throw new ArgumentNullException(nameof(path));
diff --git a/Software/Visual_Studio/Tango.SharedUI/Converters/LastItemInContainerToBooleanConverter.cs b/Software/Visual_Studio/Tango.SharedUI/Converters/LastItemInContainerToBooleanConverter.cs
index ec45fb8b1..b1c0ed904 100644
--- a/Software/Visual_Studio/Tango.SharedUI/Converters/LastItemInContainerToBooleanConverter.cs
+++ b/Software/Visual_Studio/Tango.SharedUI/Converters/LastItemInContainerToBooleanConverter.cs
@@ -14,11 +14,9 @@ namespace Tango.SharedUI.Converters
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
- DependencyObject item = (DependencyObject)value;
+ DependencyObject item = value as DependencyObject;
ItemsControl ic = ItemsControl.ItemsControlFromItemContainer(item);
-
- return ic.ItemContainerGenerator.IndexFromContainer(item)
- == ic.Items.Count - 1;
+ return ic.ItemContainerGenerator.IndexFromContainer(item) == ic.Items.Count - 1;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)