diff options
| author | Avi Levkovich <avi@twine-s.com> | 2019-07-11 17:44:07 +0300 |
|---|---|---|
| committer | Avi Levkovich <avi@twine-s.com> | 2019-07-11 17:44:07 +0300 |
| commit | 733c4d66ec7488c65b353810d23649656e9fdbb9 (patch) | |
| tree | b36a0de7a40f47861ccc53447111751ae98caa2f /Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML | |
| parent | bfe29c83abb8550ca922819da2bed4431580eaba (diff) | |
| parent | 3fc4e625860d6c847be251641b533ee280dc4693 (diff) | |
| download | Tango-733c4d66ec7488c65b353810d23649656e9fdbb9.tar.gz Tango-733c4d66ec7488c65b353810d23649656e9fdbb9.zip | |
Merge branch 'master' of https://twinetfs.visualstudio.com/_git/Tango
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML')
4 files changed, 109 insertions, 1 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/RmlView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlView.xaml index 8f2c5d187..962e59291 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" /> |
