From 51afc4f6a17383e91a72c2ce060e82604d43c3a8 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Mon, 20 Aug 2018 19:43:15 +0300 Subject: Working on new Machine Studio DB. --- .../Modules/Tango.MachineStudio.Developer/Views/JobView.xaml | 2 -- 1 file changed, 2 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml') diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml index 1b96b27ce..368f615a0 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml @@ -11,11 +11,9 @@ xmlns:hive="clr-namespace:Tango.Hive;assembly=Tango.Hive" xmlns:automation="clr-namespace:Tango.MachineStudio.Common.Automation;assembly=Tango.MachineStudio.Common" xmlns:sys="clr-namespace:System;assembly=mscorlib" - xmlns:techViews="clr-namespace:Tango.MachineStudio.Technician.Views;assembly=Tango.MachineStudio.Technician" xmlns:colorPicker="clr-namespace:Tango;assembly=Tango.ColorPicker" xmlns:dispensing="clr-namespace:Tango.BL.Dispensing;assembly=Tango.BL" xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" - xmlns:db="clr-namespace:Tango.MachineStudio.DB.Views.DBViews;assembly=Tango.MachineStudio.DB" xmlns:commonControls="clr-namespace:Tango.MachineStudio.Common.Controls;assembly=Tango.MachineStudio.Common" xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" xmlns:designer="clr-namespace:Tango.MachineStudio.MachineDesigner.Views;assembly=Tango.MachineStudio.MachineDesigner" -- cgit v1.3.1 From 439ee2d80eab039c2dee00f697d2d814ec67247e Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Wed, 22 Aug 2018 18:33:29 +0300 Subject: Added IsFree to base ViewModel. Implemented IsFree on HardwareVersions & ColorLab modules. --- .../ViewModels/MainViewVM.cs | 40 ++++++++++++++--- .../Views/MainView.xaml | 6 +-- .../Views/JobView.xaml | 4 +- .../ViewModels/MainViewVM.cs | 36 ++++++++++++--- .../Views/MainView.xaml | 6 +-- .../Tango.MachineStudio.Common/StudioViewModel.cs | 17 ------- .../ViewModels/UpdateViewVM.cs | 3 ++ Software/Visual_Studio/Tango.SharedUI/ViewModel.cs | 52 +++++++++------------- 8 files changed, 99 insertions(+), 65 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml') diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/MainViewVM.cs index 3764e00de..5c513af9e 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/MainViewVM.cs @@ -239,6 +239,12 @@ namespace Tango.MachineStudio.ColorLab.ViewModels #endregion + #region Constructors + + /// + /// Initializes a new instance of the class. + /// + /// The notification. public MainViewVM(INotificationProvider notification) : base() { _notification = notification; @@ -248,20 +254,28 @@ namespace Tango.MachineStudio.ColorLab.ViewModels SourceColor = new RgbVM(); SourceColor.ColorChanged += SourceColor_ColorChanged; - ImportForwardDataCommand = new RelayCommand(ImportForwardData, () => SelectedRML != null); - ImportInverseDataCommand = new RelayCommand(ImportInverseData, () => SelectedRML != null); + ImportForwardDataCommand = new RelayCommand(ImportForwardData, () => SelectedRML != null && IsFree); + ImportInverseDataCommand = new RelayCommand(ImportInverseData, () => SelectedRML != null && IsFree); - ExportForwardDataCommand = new RelayCommand(ExportForwardData, () => SelectedRML != null && CCT != null && CCT.ForwardFileName != null); - ExportInverseDataCommand = new RelayCommand(ExportInverseData, () => SelectedRML != null && CCT != null && CCT.InverseFileName != null); + ExportForwardDataCommand = new RelayCommand(ExportForwardData, () => SelectedRML != null && CCT != null && CCT.ForwardFileName != null && IsFree); + ExportInverseDataCommand = new RelayCommand(ExportInverseData, () => SelectedRML != null && CCT != null && CCT.InverseFileName != null && IsFree); - SaveCommand = new RelayCommand(Save, () => SelectedRML != null); + SaveCommand = new RelayCommand(Save, () => SelectedRML != null && IsFree); } + #endregion + + #region Event Handlers + private void SourceColor_ColorChanged(object sender, Color e) { GetHiveSuggestions(); } + #endregion + + #region Application Ready + public override void OnApplicationReady() { base.OnApplicationReady(); @@ -277,6 +291,8 @@ namespace Tango.MachineStudio.ColorLab.ViewModels }); } + #endregion + #region ColorLab private void GetHiveSuggestions() @@ -427,6 +443,8 @@ namespace Tango.MachineStudio.ColorLab.ViewModels { if (SelectedMachine != null) { + IsFree = false; + _dbContext.GetConfiguration(x => x.Guid == SelectedMachine.ConfigurationGuid); LiquidVolumes = SelectedMachine.Configuration.NoneEmptyIdsPacks.OrderBy(x => x.PackIndex).Select(x => new LiquidVolumeVM() @@ -445,6 +463,8 @@ namespace Tango.MachineStudio.ColorLab.ViewModels SelectedMachine.Modified -= SelectedMachine_Modified; SelectedMachine.Modified += SelectedMachine_Modified; + + IsFree = true; } } @@ -534,6 +554,8 @@ namespace Tango.MachineStudio.ColorLab.ViewModels { if (SelectedRML != null && SelectedMachine != null) { + IsFree = false; + await Task.Factory.StartNew(() => { using (_notification.PushTaskItem("Loading RML data...")) @@ -581,6 +603,8 @@ namespace Tango.MachineStudio.ColorLab.ViewModels } } }); + + IsFree = true; } } @@ -594,6 +618,8 @@ namespace Tango.MachineStudio.ColorLab.ViewModels { try { + IsFree = false; + if (_isNewCCT) { _dbContext.Ccts.Add(CCT); @@ -631,6 +657,10 @@ namespace Tango.MachineStudio.ColorLab.ViewModels { _notification.ShowError(LogManager.Log(ex, "An error occurred while trying to save to data base.").Message + Environment.NewLine + ex.Message); } + finally + { + IsFree = true; + } } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Views/MainView.xaml index d8ef015be..78eaf04e8 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Views/MainView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Views/MainView.xaml @@ -35,7 +35,7 @@ - +