aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs')
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs70
1 files changed, 69 insertions, 1 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
}
}