diff options
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions')
7 files changed, 141 insertions, 86 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Models/ColorShadesModel.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Models/ColorShadesModel.cs index cc4351891..98d4afe07 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Models/ColorShadesModel.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Models/ColorShadesModel.cs @@ -11,16 +11,20 @@ namespace Tango.MachineStudio.ThreadExtensions.Models { public class ColorShadesDataItem { - public double ColorNumber { get; set; } + public int ColorNumber { get; set; } public double L { get; set; } public double A { get; set; } public double B { get; set; } public double C { get; set; } public double M { get; set; } public double Y { get; set; } + public double K { get; set; } + public double TI { get; set; } public double L2 { get; set; } public double A2 { get; set; } public double B2 { get; set; } + public double DelteE { get; set; } + } public void GetDataFromFile(string fileName, out List<ColorShadesDataItem> items, ref string errors) diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/ViewModels/ColorCalibrationViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/ViewModels/ColorCalibrationViewVM.cs index fc15c8caf..3f4d8a415 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/ViewModels/ColorCalibrationViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/ViewModels/ColorCalibrationViewVM.cs @@ -370,7 +370,7 @@ namespace Tango.MachineStudio.ThreadExtensions.ViewModels newtab.RmlExtensionColorCalibrationsTest = new RmlExtensionColorCalibrationsTest() { - RmlExtensionColorCalibrationGuid = RMLExtentionGUID, + RmlExtensionColorCalibrationGuid = RmlExtensionColorCalibration.Guid, Name = name }; var liquidDataCollection = new SynchronizedObservableCollection<RmlExtensionColorCalibrationsTestsLiquidData>(); diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/ViewModels/ColorShadeTabVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/ViewModels/ColorShadeTabVM.cs index df0ba521c..eaaf7dc96 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/ViewModels/ColorShadeTabVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/ViewModels/ColorShadeTabVM.cs @@ -83,13 +83,14 @@ namespace Tango.MachineStudio.ThreadExtensions.ViewModels #endregion - RelayCommand ImportColorsCommand { get; set; } + public RelayCommand ImportColorsCommand { get; set; } public ColorShadeTabVM(INotificationProvider notification, IActionLogManager actionLogManager) { _notification = notification; _actionLogManager = actionLogManager; ImportColorsCommand = new RelayCommand(ImportColors); + RemovedDataList = new List<RmlExtensionColorShadesTestsData>(); } private void ImportColors(object obj) @@ -108,11 +109,18 @@ namespace Tango.MachineStudio.ThreadExtensions.ViewModels if (false == String.IsNullOrEmpty(errors) || items == null || items.Count == 0) { _notification.ShowError("An error occurred while trying to import data form the selected excel file. Please check the file format if valid and is available to read."); - + } else { - //Settings data to object + if (RemovedDataList.Count == 0 && RmlExtensionColorShadesTest.RmlExtensionColorShadesTestsData.Count > 0) + { + RemovedDataList = new List<RmlExtensionColorShadesTestsData>(RmlExtensionColorShadesTest.RmlExtensionColorShadesTestsData.ToList()); + } + RmlExtensionColorShadesTest.RmlExtensionColorShadesTestsData.Clear(); + items.ForEach(x => RmlExtensionColorShadesTest.RmlExtensionColorShadesTestsData.Add(new RmlExtensionColorShadesTestsData() { + ColorNum = x.ColorNumber, L = x.L, A = x.A, B = x.B, C = x.C, M = x.M, Y = x.Y, K = x.K, Ti = x.TI, LRes = x.L2, ARes = x.A2, BRes = x.B2, DeltaE = x.DelteE })); + } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/ViewModels/ColorShadeViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/ViewModels/ColorShadeViewVM.cs index b1dac5ce9..f305d5139 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/ViewModels/ColorShadeViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/ViewModels/ColorShadeViewVM.cs @@ -231,14 +231,14 @@ namespace Tango.MachineStudio.ThreadExtensions.ViewModels newtab.RmlExtensionColorShadesTest = new RmlExtensionColorShadesTest() { - RmlExtensionColorShadesGuid = RMLExtentionGUID, + RmlExtensionColorShadesGuid = RmlExtensionColorShade.Guid, Name = name }; if (RmlExtensionColorShade != null) { RmlExtensionColorShade.RmlExtensionColorShadesTests.Add(newtab.RmlExtensionColorShadesTest); } - + return newtab; } #endregion @@ -372,21 +372,15 @@ namespace Tango.MachineStudio.ThreadExtensions.ViewModels foreach (var tab in ColorShadeTabs) { tab.RmlExtensionColorShadesTest.LastUpdated = lastUpdated; - //var removedPoints = tab.RemovedPoints; - //foreach (var liquidData in tab.RmlExtensionColorCalibrationsTest.RmlExtensionColorCalibrationsTestsLiquidData) - //{ - // var liquidtype = _liquids.Where(l => l.Guid == liquidData.LiquidTypeGuid).FirstOrDefault(); - // if (liquidtype != null && removedPoints.ContainsKey(liquidtype.Type)) - // { - // _active_context.RmlExtensionColorCalibrationsTestsLiquidDataPoints.RemoveRange(removedPoints[liquidtype.Type]); - // } - // liquidData.LastUpdated = lastUpdated; - //} - //tab.RemovedPoints.Clear(); + var removedPoints = tab.RemovedDataList; + if (removedPoints.Count > 0) + { + _active_context.RmlExtensionColorShadesTestsData.RemoveRange(removedPoints); + } + tab.RemovedDataList.Clear(); } await _active_context.SaveChangesAsync(); - - // LoadColorParameters(); + } catch (Exception ex) { diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/ColorShadeView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/ColorShadeView.xaml index 70df4d6bf..f8aaa5e24 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/ColorShadeView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/ColorShadeView.xaml @@ -17,6 +17,7 @@ <autoCompleteMachine:MachinesProvider x:Key="MachinesProvider" /> <converters:EnumToDescriptionConverter x:Key="EnumToDescriptionConverter" /> + <Style TargetType="DataGridCell" BasedOn="{StaticResource {x:Type DataGridCell}}"> <Setter Property="BorderThickness" Value="0"/> <Setter Property="FocusVisualStyle" Value="{x:Null}"/> @@ -45,7 +46,7 @@ <RowDefinition Height="1*"/> </Grid.RowDefinitions> <StackPanel Orientation="Horizontal" Margin="35 0 0 0"> - <ListBox Style="{x:Null}" HorizontalAlignment="Left" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" ItemContainerStyle="{StaticResource basicListBoxItem}" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollBarVisibility="Disabled" Background="Transparent" BorderThickness="0" ItemsSource="{Binding CalibrationTabs}" SelectedItem="{Binding SelectedTab}"> + <ListBox Style="{x:Null}" HorizontalAlignment="Left" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" ItemContainerStyle="{StaticResource basicListBoxItem}" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollBarVisibility="Disabled" Background="Transparent" BorderThickness="0" ItemsSource="{Binding ColorShadeTabs}" SelectedItem="{Binding SelectedTab}"> <ListBox.ItemsPanel> <ItemsPanelTemplate> <StackPanel HorizontalAlignment="Left" Orientation="Horizontal"></StackPanel> @@ -105,58 +106,91 @@ </Button> </StackPanel> - <DockPanel Grid.Row="1" Margin="5 0 5 5"> - <Border DockPanel.Dock="Top" Background="Transparent" Margin="20 0 0 0 " Padding="5" CornerRadius="5" Height="40" VerticalAlignment="Top"> - <Border.Effect> - <DropShadowEffect Opacity="0.4" /> - </Border.Effect> - <Grid> - <DockPanel> - <Button Height="Auto" DockPanel.Dock="Right" Style="{StaticResource MaterialDesignFlatButton}" Padding="0" FontSize="11" Foreground="{StaticResource DarkGrayBrush200}" HorizontalAlignment="Right" Command="{Binding CreateColorDataImportExcelTemplateCommand}" ToolTip="Create excel file template" Margin="0 0 5 0"> - <materialDesign:PackIcon Kind="FileExcel" Foreground="{StaticResource DimGrayBrush}" Width="16" Height="26" /> - </Button> - <Button DockPanel.Dock="Right" HorizontalAlignment="Left" Padding="2" Height="26" Width="140" Background="Transparent" Command="{Binding SelectedTab.ImportColorsCommand}" ToolTip="Import Cyan data " Margin="0 0 10 0" BorderBrush="{StaticResource TransparentBackgroundBrush200}" BorderThickness="1 1 0.8 2"> - <TextBlock FontSize="14" Foreground="{StaticResource MainWindow.Foreground}">IMPORT COLORS</TextBlock> - </Button> - - </DockPanel> + <Border Margin="5 0 5 5" Grid.Row="1" Background="Transparent" Padding="4" CornerRadius="5" VerticalAlignment="Top" BorderThickness="2" BorderBrush="{StaticResource borderBrush}"> + <DockPanel > + <DockPanel DockPanel.Dock="Top" Height="30"> + <Button Height="Auto" DockPanel.Dock="Right" Style="{StaticResource MaterialDesignFlatButton}" FontSize="11" Foreground="{StaticResource DarkGrayBrush200}" HorizontalAlignment="Right" Command="{Binding CreateColorDataImportExcelTemplateCommand}" ToolTip="Create excel file template" Margin="0 0 10 0"> + <materialDesign:PackIcon Kind="FileExcel" Foreground="{StaticResource DimGrayBrush}" Width="26" Height="24" /> + </Button> + <Button DockPanel.Dock="Right" HorizontalAlignment="Right" Height="Auto" Width="180" Command="{Binding SelectedTab.ImportColorsCommand}" ToolTip="Import Cyan data " Margin="0 0 10 0" > + <TextBlock FontSize="14" VerticalAlignment="Center" >IMPORT COLORS</TextBlock> + </Button> + </DockPanel> + <Grid DockPanel.Dock="Bottom" Margin="0 0 0 0"> + <DataGrid Margin="10" BorderBrush="Silver" BorderThickness="1" RowHeight="30" Background="{StaticResource TransparentBackgroundBrush}" AlternatingRowBackground="{StaticResource Transparent200}" AutoGenerateColumns="False" CanUserAddRows="True" CanUserDeleteRows="True" ItemsSource="{Binding SelectedTab.RmlExtensionColorShadesTest.RmlExtensionColorShadesTestsData}" IsReadOnly="False" + ScrollViewer.CanContentScroll="True" ScrollViewer.VerticalScrollBarVisibility="Auto" MinHeight="700"> + <DataGrid.ColumnHeaderStyle > + <Style TargetType="{x:Type DataGridColumnHeader}" BasedOn="{StaticResource {x:Type DataGridColumnHeader}}"> + <Setter Property="FontSize" Value="16"/> + <Setter Property="HorizontalAlignment" Value="Center"/> + <Setter Property="VerticalAlignment" Value="Center"/> + <Setter Property="Margin" Value="2 0 0 0"/> + <Setter Property="Padding" Value="0 5"/> + <Setter Property="FrameworkElement.HorizontalAlignment" Value="Stretch"/> + <Setter Property="HorizontalContentAlignment" Value="Center"/> + </Style> + </DataGrid.ColumnHeaderStyle> + <DataGrid.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> + <Setter Property="Padding" Value="4"></Setter> + <Setter Property="Margin" Value="0 0 0 0"></Setter> + </Style> + </DataGrid.CellStyle> + <DataGrid.Columns> + <DataGridTextColumn Header="Number" Binding="{Binding ColorNum}" Width="80" /> + <DataGridTemplateColumn Header="Shade" Width="200"> + <DataGridTemplateColumn.CellTemplate> + <DataTemplate> + <Rectangle Fill="{Binding ColorBrush}"/> + </DataTemplate> + </DataGridTemplateColumn.CellTemplate> + </DataGridTemplateColumn> + + <DataGridTextColumn Header="L" Binding="{Binding L}" Width="1*" /> + <DataGridTextColumn Header="A" Binding="{Binding A}" Width="1*"/> + <DataGridTextColumn Header="B" Binding="{Binding B}" Width="1*"/> + <DataGridTextColumn Header="C" Binding="{Binding C}" Width="1*" /> + <DataGridTextColumn Header="M" Binding="{Binding M}" Width="1*"/> + <DataGridTextColumn Header="Y" Binding="{Binding Y}" Width="1*"/> + <DataGridTextColumn Header="K" Binding="{Binding K}" Width="1*" /> + <DataGridTextColumn Header="TI" Binding="{Binding TI}" Width="1*"/> + <DataGridTextColumn Header="L" Binding="{Binding LRes}" Width="1*"> + <DataGridTextColumn.CellStyle> + <Style TargetType="DataGridCell" BasedOn="{StaticResource {x:Type DataGridCell}}"> + <Setter Property="Background" Value="LightCyan" /> + </Style> + </DataGridTextColumn.CellStyle> + </DataGridTextColumn> + <DataGridTextColumn Header="A" Binding="{Binding ARes}" Width="1*" > + <DataGridTextColumn.CellStyle> + <Style TargetType="DataGridCell" BasedOn="{StaticResource {x:Type DataGridCell}}"> + <Setter Property="Background" Value="LightCyan" /> + </Style> + </DataGridTextColumn.CellStyle> + </DataGridTextColumn> + <DataGridTextColumn Header="B" Binding="{Binding BRes}" Width="1*"> + <DataGridTextColumn.CellStyle> + <Style TargetType="DataGridCell" BasedOn="{StaticResource {x:Type DataGridCell}}"> + <Setter Property="Background" Value="LightCyan" /> + </Style> + </DataGridTextColumn.CellStyle> + </DataGridTextColumn> + <DataGridTextColumn Header="Delta E" Binding="{Binding DeltaE}" Width="1*"> + <DataGridTextColumn.CellStyle> + <Style TargetType="DataGridCell" > + <Setter Property="Background" Value="LightCyan" /> + <Setter Property="Foreground" Value="red" /> + </Style> + </DataGridTextColumn.CellStyle> + </DataGridTextColumn> + </DataGrid.Columns> + </DataGrid> </Grid> + </DockPanel> </Border> - <DataGrid Margin="0 0 0 10" BorderBrush="Silver" BorderThickness="1" RowHeight="60" Background="{StaticResource TransparentBackgroundBrush}" AlternatingRowBackground="{StaticResource Transparent200}" AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False" ItemsSource="{Binding SelectedTab.RmlExtensionColorShadesTest.RmlExtensionColorShadesTestsData}" IsReadOnly="False" > - <DataGrid.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> - <Setter Property="Padding" Value="4"></Setter> - <Setter Property="Margin" Value="0 0 0 0"></Setter> - </Style> - </DataGrid.CellStyle> - <DataGrid.Columns> - <DataGridTextColumn Header="Number" Binding="{Binding ColorNum}" Width="Auto" /> - <DataGridTemplateColumn Header="Shade"> - <DataGridTemplateColumn.CellTemplate> - <DataTemplate> - <Rectangle Fill="{Binding ColorBrush}"/> - </DataTemplate> - </DataGridTemplateColumn.CellTemplate> - </DataGridTemplateColumn> - - <DataGridTextColumn Header="L" Binding="{Binding L}" Width="Auto" /> - <DataGridTextColumn Header="A" Binding="{Binding A}" Width="140"/> - <DataGridTextColumn Header="B" Binding="{Binding B}" Width="Auto"/> - <DataGridTextColumn Header="C" Binding="{Binding C}" Width="Auto" /> - <DataGridTextColumn Header="M" Binding="{Binding M}" Width="140"/> - <DataGridTextColumn Header="Y" Binding="{Binding Y}" Width="Auto"/> - <DataGridTextColumn Header="K" Binding="{Binding K}" Width="Auto" /> - <DataGridTextColumn Header="TI" Binding="{Binding TI}" Width="140"/> - <DataGridTextColumn Header="L" Binding="{Binding LRes}" Width="Auto"/> - <DataGridTextColumn Header="A" Binding="{Binding ARes}" Width="Auto" /> - <DataGridTextColumn Header="B" Binding="{Binding BRes}" Width="140"/> - <DataGridTextColumn Header="Delta E" Binding="{Binding DeltaE}" Width="Auto"/> - </DataGrid.Columns> - </DataGrid> - </DockPanel> </Grid> </Grid> </UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/MachineTestResultsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/MachineTestResultsView.xaml index b46cb4cf9..820c68715 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/MachineTestResultsView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/MachineTestResultsView.xaml @@ -61,6 +61,9 @@ <TabItem Header="COLOR CALIBRATION" Margin="20 0 0 0" mahapps:ControlsHelper.HeaderFontSize="20"> <local:ColorCalibrationView/> </TabItem> + <TabItem Header="COLOR SHADE" Margin="20 0 0 0" mahapps:ControlsHelper.HeaderFontSize="20"> + <local:ColorShadeView/> + </TabItem> </TabControl> </Grid> </DockPanel> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/TestResultsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/TestResultsView.xaml index 50a2537e1..b8a4b7f28 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/TestResultsView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/TestResultsView.xaml @@ -265,20 +265,16 @@ </ItemsControl> <Grid Grid.Column="0" MinWidth="600" HorizontalAlignment="Left" > - <DockPanel > - - <Grid DockPanel.Dock="Bottom" Margin="20 10 20 40"> - <TextBlock FontSize="21">Conclusion:</TextBlock> - <TextBox Margin="120 0 10 0" HorizontalAlignment="Stretch" Height="46" Text="{Binding SelectedTab.TestResult.Conclusions}" Style="{StaticResource Rounded_Corners_TextBox_Multiline}"></TextBox> - </Grid> - - <Grid DockPanel.Dock="Bottom" Margin="20 10 20 0"> - <TextBlock FontSize="21">Comments:</TextBlock> - <TextBox Margin="120 0 10 0" Style="{StaticResource Rounded_Corners_TextBox_Multiline}" HorizontalAlignment="Stretch" Height="46" Text="{Binding SelectedTab.TestResult.Comment}"></TextBox> - - </Grid> - - <Border Padding="10 10 20 10" DockPanel.Dock="Top" BorderBrush="Transparent" BorderThickness="1" > + <Grid.RowDefinitions> + <RowDefinition Height="1*"/> + <RowDefinition Height="Auto"/> + </Grid.RowDefinitions> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="1*"/> + <ColumnDefinition Width="1*"/> + </Grid.ColumnDefinitions> + + <Border Padding="10 10 20 10" Grid.ColumnSpan="2" BorderBrush="Transparent" BorderThickness="1" > <ScrollViewer VerticalScrollBarVisibility="Auto" > <Grid HorizontalAlignment="Left"> @@ -631,7 +627,23 @@ </ScrollViewer> </Border> - </DockPanel> + <Grid Grid.Row="1" Grid.Column="1" Margin="0 0 20 40"> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="120"/> + <ColumnDefinition Width="1*"/> + </Grid.ColumnDefinitions> + <Grid.RowDefinitions> + <RowDefinition Height="1*"/> + <RowDefinition Height="1*" /> + </Grid.RowDefinitions> + + <TextBlock FontSize="21" HorizontalAlignment="Left" Margin="0 10 0 0">Conclusion:</TextBlock> + <TextBox Grid.Column="1" Margin="20 0 20 0" HorizontalAlignment="Stretch" Height="46" Text="{Binding SelectedTab.TestResult.Conclusions}" Style="{StaticResource Rounded_Corners_TextBox_Multiline}"></TextBox> + + <TextBlock Grid.Row="1" FontSize="21" Margin="0 30 0 0" HorizontalAlignment="Left">Comments:</TextBlock> + <TextBox Grid.Column="1" Grid.Row="1" Margin="20 20 20 0" Style="{StaticResource Rounded_Corners_TextBox_Multiline}" HorizontalAlignment="Stretch" Height="46" Text="{Binding SelectedTab.TestResult.Comment}"></TextBox> + + </Grid> </Grid> </Grid> </Grid> |
