diff options
| author | Avi Levkovich <avi@twine-s.com> | 2017-12-28 15:16:27 +0200 |
|---|---|---|
| committer | Avi Levkovich <avi@twine-s.com> | 2017-12-28 15:16:27 +0200 |
| commit | c056f991c0168f6449fac16c3b0cb165518c5e01 (patch) | |
| tree | e5c69bb1f3e03029991efe15e930af80ff6712db /Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/CctsViewVM.cs | |
| parent | 15799210aab388996f86808e000940093306ca41 (diff) | |
| parent | 2d3f4bfd4b265888933ad8a7e21e4dd80aa1eda2 (diff) | |
| download | Tango-c056f991c0168f6449fac16c3b0cb165518c5e01.tar.gz Tango-c056f991c0168f6449fac16c3b0cb165518c5e01.zip | |
MERGE.
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/CctsViewVM.cs')
| -rw-r--r-- | Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/CctsViewVM.cs | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/CctsViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/CctsViewVM.cs new file mode 100644 index 000000000..02d7c351d --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/CctsViewVM.cs @@ -0,0 +1,75 @@ +using Microsoft.Win32; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core.Commands; +using Tango.DAL.Observables; +using Tango.MachineStudio.Common.Notifications; + +namespace Tango.MachineStudio.DB.ViewModels +{ + public class CctsViewVM : DbTableViewModel<Cct> + { + public CctsViewVM(INotificationProvider notification) : base(notification) + { + SelectForwardFileCommand = new RelayCommand(SelectForwardFile); + SelectInverseFileCommand = new RelayCommand(SelectInverseFile); + } + + public RelayCommand SelectForwardFileCommand { get; set; } + + public RelayCommand SelectInverseFileCommand { get; set; } + + private void SelectInverseFile() + { + String file = SelectFile(); + if (file != null) + { + try + { + EditEntity.InverseData = File.ReadAllBytes(file); + EditEntity.InverseFileName = Path.GetFileName(file); + } + catch (Exception ex) + { + _notification.ShowError(ex.Message); + } + } + } + + private void SelectForwardFile() + { + String file = SelectFile(); + if (file != null) + { + try + { + EditEntity.ForwardData = File.ReadAllBytes(file); + EditEntity.ForwardFileName = Path.GetFileName(file); + } + catch (Exception ex) + { + _notification.ShowError(ex.Message); + } + } + } + + private String SelectFile() + { + OpenFileDialog dlg = new OpenFileDialog(); + dlg.Filter = "Color Conversion Files|*.CCT"; + dlg.Title = "Select Color Conversion File"; + if (dlg.ShowDialog().Value) + { + return dlg.FileName; + } + else + { + return null; + } + } + } +} |
