diff options
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML')
2 files changed, 70 insertions, 2 deletions
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 e43c20c3d..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 @@ -148,7 +148,7 @@ <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 CCT.ForwardFileName}" HorizontalContentAlignment="Center"></TextBox> + <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"> |
