diff options
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML')
6 files changed, 114 insertions, 6 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Images/data-table.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Images/data-table.png Binary files differnew file mode 100644 index 000000000..0d5e5eaa6 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Images/data-table.png 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 b1c8f580d..6b113be5f 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 @@ -186,6 +186,9 @@ <ItemGroup> <Resource Include="Images\thread_128px.png" /> </ItemGroup> + <ItemGroup> + <Resource Include="Images\data-table.png" /> + </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <ProjectExtensions> <VisualStudio> 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 ebcfe72fd..7218ef5ea 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 @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel; +using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -119,7 +120,6 @@ namespace Tango.MachineStudio.RML.ViewModels set { _activeProcessParametersTableView = value; RaisePropertyChangedAuto(); } } - /// <summary> /// Gets or sets the manage RML command. /// </summary> @@ -135,6 +135,10 @@ namespace Tango.MachineStudio.RML.ViewModels /// </summary> public RelayCommand RemoveRmlCommand { get; set; } + public RelayCommand ImportForwardDataCommand { get; set; } + + public RelayCommand ExportForwardDataCommand { get; set; } + public RelayCommand AddProcessParametersTableCommand { get; set; } public RelayCommand<ProcessParametersTable> RemoveProcessParametersTableCommand { get; set; } @@ -165,6 +169,10 @@ namespace Tango.MachineStudio.RML.ViewModels RemoveLiquidFactorCommand = new RelayCommand<LiquidTypesRml>(RemoveLiquidFactor, () => IsFree); CreateCalibrationDataExcelTemplateCommand = new RelayCommand(CreateCalibrationDataExcelTemplate); SaveCommand = new RelayCommand(Save, () => IsFree); + + ImportForwardDataCommand = new RelayCommand(ImportForwardData, () => ActiveRML != null && IsFree); + + ExportForwardDataCommand = new RelayCommand(ExportForwardData, () => ActiveRML != null && ActiveRML.Cct != null && IsFree); } public override void OnApplicationReady() @@ -199,6 +207,7 @@ namespace Tango.MachineStudio.RML.ViewModels .Set(guid) .WithActiveParametersGroup() .WithLiquidFactors() + .WithCCT() .BuildAsync(); if (ActiveRML.ProcessParametersTablesGroups.ToList().Count == 0) @@ -251,6 +260,8 @@ namespace Tango.MachineStudio.RML.ViewModels View.NavigateTo(RmlNavigationView.RmlView); + InvalidateRelayCommands(); + IsFree = true; } } @@ -491,5 +502,62 @@ namespace Tango.MachineStudio.RML.ViewModels View.NavigateTo(RmlNavigationView.RmlsView); LoadRmls(); } + + #region Import / Export Color Conversion Data + + private void ImportForwardData() + { + String file = GetCCTFileOpen(); + if (file != null) + { + if (ActiveRML.Cct == null) + { + Cct cct = new Cct(); + ActiveRML.Cct = cct; + } + + ActiveRML.Cct.FileName = Path.GetFileName(file); + ActiveRML.Cct.Data = File.ReadAllBytes(file); + } + } + + private void ExportForwardData() + { + String file = GetCCTFileSave(ActiveRML.Cct.FileName); + if (file != null) + { + File.WriteAllBytes(file, ActiveRML.Cct.Data); + } + } + + private String GetCCTFileOpen() + { + OpenFileDialog dlg = new OpenFileDialog(); + dlg.Title = "Select color adjustment file"; + dlg.Filter = "Color Conversion Table|*.cct"; + if (dlg.ShowDialogCenter()) + { + return dlg.FileName; + } + + return null; + } + + private String GetCCTFileSave(String fileName) + { + SaveFileDialog dlg = new SaveFileDialog(); + dlg.Title = "Select color adjustment file"; + dlg.Filter = "Color Conversion Table|*.cct"; + dlg.FileName = fileName; + dlg.DefaultExt = ".cct"; + if (dlg.ShowDialogCenter()) + { + return dlg.FileName; + } + + return null; + } + + #endregion } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/AddLiquidFactorView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/AddLiquidFactorView.xaml index 6d9b68edb..426a56f51 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/AddLiquidFactorView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/AddLiquidFactorView.xaml @@ -27,7 +27,7 @@ <Grid> <StackPanel VerticalAlignment="Top" Margin="0 30 0 0"> <StackPanel Orientation="Horizontal"> - <materialDesign:PackIcon Kind="Plus" VerticalAlignment="Top" Width="50" Height="50" Foreground="#08B008" /> + <materialDesign:PackIcon Kind="Plus" VerticalAlignment="Top" Width="50" Height="50" Foreground="{StaticResource GreenBrush100}" /> <TextBlock Padding="0 10 0 0" TextWrapping="Wrap" Margin="10 0 0 0" VerticalAlignment="Top" FontSize="14" Text="ADD LIQUID FACTOR" Width="400"></TextBlock> </StackPanel> 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 8f2c5d187..1a13358c1 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 @@ -137,6 +137,43 @@ <DropShadowEffect Opacity="0.4" /> </Border.Effect> <Grid> + <TextBlock HorizontalAlignment="Left" Margin="20 0 0 0" FontSize="16">COLOR CONVERSION TABLE (CCT)</TextBlock> + </Grid> + </Border> + <Grid DockPanel.Dock="Top" Margin="20 10"> + <StackPanel HorizontalAlignment="Left" Margin="20 0 0 0"> + <Grid> + <StackPanel Orientation="Horizontal" Margin="0 5 0 0"> + <materialDesign:PackIcon Kind="ArrowLeftBoldHexagonOutline" VerticalAlignment="Center" Width="40" Height="40" /> + <Image Source="../Images/data-table.png" Height="80" Opacity="0.8"></Image> + <StackPanel VerticalAlignment="Center" Width="300" Margin="10 0 0 0"> + + <TextBox IsReadOnly="False" Margin="0 5 0 0" Text="{Binding ActiveRML.Cct.FileName}" HorizontalContentAlignment="Center"></TextBox> + <UniformGrid Columns="2" Margin="0 5 0 0" HorizontalAlignment="Right"> + <Button Style="{StaticResource MaterialDesignFlatButton}" Padding="0" Command="{Binding ImportForwardDataCommand}"> + <StackPanel Orientation="Horizontal" Margin="0 0 20 0"> + <materialDesign:PackIcon Kind="Upload" VerticalAlignment="Center" /> + <TextBlock Margin="5 0 0 0">IMPORT</TextBlock> + </StackPanel> + </Button> + <Button Style="{StaticResource MaterialDesignFlatButton}" Padding="0" Command="{Binding ExportForwardDataCommand}"> + <StackPanel Orientation="Horizontal"> + <materialDesign:PackIcon Kind="Download" VerticalAlignment="Center" /> + <TextBlock Margin="5 0 0 0">EXPORT</TextBlock> + </StackPanel> + </Button> + </UniformGrid> + </StackPanel> + </StackPanel> + </Grid> + </StackPanel> + </Grid> + + <Border DockPanel.Dock="Top" Background="#E9FFFFFF" Margin="20 0" Padding="5" CornerRadius="5"> + <Border.Effect> + <DropShadowEffect Opacity="0.4" /> + </Border.Effect> + <Grid> <TextBlock HorizontalAlignment="Left" Margin="20 0 0 0" FontSize="16">ACTIVE PROCESS GROUP</TextBlock> <Button ToolTip="Add new table" Style="{StaticResource MaterialDesignFlatButton}" Height="Auto" Width="30" HorizontalAlignment="Right" Padding="0" Command="{Binding AddProcessParametersTableCommand}"> <materialDesign:PackIcon Kind="Plus" Foreground="#0AC30A" Width="24" Height="24" /> @@ -159,7 +196,7 @@ </Button> <Grid Style="{StaticResource draggableDroppableGrid}" dragAndDrop:DragAndDropService.Drop="OnProcessTableDropped"> - <Border Padding="5" BorderThickness="1" Margin="20 5 0 5" BorderBrush="#101010" Background="#B9FFFFFF"> + <Border Padding="5" BorderThickness="1" Margin="20 5 0 5" BorderBrush="{StaticResource DarkGrayBrush}" Background="#B9FFFFFF"> <Grid> <DockPanel Width="300"> <TextBox materialDesign:HintAssist.Hint="Table Name" DockPanel.Dock="Top" Text="{Binding Name}"></TextBox> 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 06a28c1e4..64fbc357d 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 @@ -25,13 +25,13 @@ </Grid> <Grid DockPanel.Dock="Bottom"> <StackPanel VerticalAlignment="Center" Orientation="Horizontal" HorizontalAlignment="Left" Margin="0 0 0 0"> - <Button Margin="0 0 10 0" MinWidth="160" Height="50" Background="#FF7575" BorderBrush="#FF7575" Command="{Binding RemoveRmlCommand}"> + <Button Margin="0 0 10 0" MinWidth="160" Height="50" Background="{StaticResource RedBrush300}" BorderBrush="{StaticResource RedBrush300}" Command="{Binding RemoveRmlCommand}"> <StackPanel Orientation="Horizontal"> <materialDesign:PackIcon Kind="Delete" Width="20" Height="20" /> <TextBlock Margin="5 0 0 0" FontSize="16">DELETE</TextBlock> </StackPanel> </Button> - <Button Margin="0 0 10 0" MinWidth="160" Height="50" Background="#65C682" BorderBrush="#65C682" Command="{Binding AddRmlCommand}"> + <Button Margin="0 0 10 0" MinWidth="160" Height="50" Background="{StaticResource GreenBrush300}" BorderBrush="{StaticResource GreenBrush300}" Command="{Binding AddRmlCommand}"> <StackPanel Orientation="Horizontal"> <materialDesign:PackIcon Kind="Plus" Width="20" Height="20" /> <TextBlock Margin="5 0 0 0" FontSize="16">NEW RML</TextBlock> @@ -48,7 +48,7 @@ </StackPanel> </Grid> <Grid> - <DataGrid Margin="0 0 0 10" BorderBrush="Silver" IsReadOnly="True" BorderThickness="1" Background="#93FFFFFF" AlternatingRowBackground="#C9F6F6F6" AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False" ItemsSource="{Binding Rmls}" SelectedItem="{Binding SelectedRML}"> + <DataGrid Margin="0 0 0 10" BorderBrush="Silver" IsReadOnly="True" BorderThickness="1" Background="{StaticResource TransparentBackgroundBrush}" AlternatingRowBackground="{StaticResource Transparent200}" AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False" ItemsSource="{Binding Rmls}" SelectedItem="{Binding SelectedRML}"> <DataGrid.CellStyle> <Style TargetType="DataGridCell" BasedOn="{StaticResource {x:Type DataGridCell}}"> <Setter Property="BorderThickness" Value="0"/> |
