aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs
diff options
context:
space:
mode:
authorVictoria Plitt <Victoria.Plitt@twine-s.com>2019-09-18 12:07:19 +0300
committerVictoria Plitt <Victoria.Plitt@twine-s.com>2019-09-18 12:07:19 +0300
commit439029c0228ec639013502d4094361f80f836c5d (patch)
tree3e46b93913f61edb49c1b3a31e2caf9c910ce5f1 /Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs
parentb674a2e7751daa80c0d74207968bf8e3d18d7faf (diff)
downloadTango-439029c0228ec639013502d4094361f80f836c5d.tar.gz
Tango-439029c0228ec639013502d4094361f80f836c5d.zip
Dropped dependencies of ColorLab module.
Implemented ColorConversion view and view model. Refactored Machine Designer "Color Calibration" Tab.
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs')
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs49
1 files changed, 35 insertions, 14 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs
index 935cfe5ee..eaca7cd6a 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs
@@ -22,6 +22,9 @@ using Tango.BL.Builders;
using Tango.MachineStudio.MachineDesigner.Contracts;
using System.Windows.Threading;
using Tango.Core.Threading;
+using Tango.MachineStudio.RML.ViewModels;
+using Tango.Settings;
+using Tango.MachineStudio.RML.Models;
namespace Tango.MachineStudio.MachineDesigner.ViewModels
{
@@ -112,11 +115,11 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels
set { _selectedSpool = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); }
}
- private ColorLab.ViewModels.MainViewVM _colorLabVM;
- public ColorLab.ViewModels.MainViewVM ColorLabVM
+ private ColorCalibrationViewVM _colorCalibrationViewVM;
+ public ColorCalibrationViewVM ColorCalibrationViewVM
{
- get { return _colorLabVM; }
- set { _colorLabVM = value; RaisePropertyChangedAuto(); }
+ get { return _colorCalibrationViewVM; }
+ set { _colorCalibrationViewVM = value; RaisePropertyChangedAuto(); }
}
#endregion
@@ -210,7 +213,7 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels
public override async void OnApplicationReady()
{
MachinesAdapter.MachineVersions = (await MachinesAdapter.Context.MachineVersions.ToListAsync()).ToObservableCollection();
- ColorLabVM = new ColorLab.ViewModels.MainViewVM(_notification) { IsHosted = true };
+
}
#endregion
@@ -239,7 +242,7 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels
public void DropIdsPack(IdsPack idsPack1, IdsPack idsPack2)
{
ActiveMachine.Configuration.IdsPacks.Swap(idsPack1, idsPack2);
- ColorLabVM.InvalidateLiquidFactorsCalibrationData();
+ ColorCalibrationViewVM.InvalidateCalibrationDataAndColorConversion();
}
/// <summary>
@@ -334,7 +337,7 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels
{
idsPack.LiquidType = liquidType;
idsPack.LiquidTypeGuid = liquidType.Guid;
- ColorLabVM.InvalidateLiquidFactorsCalibrationData();
+ ColorCalibrationViewVM.InvalidateCalibrationDataAndColorConversion();
}
/// <summary>
@@ -360,7 +363,7 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels
{
ActiveMachineAdapter.Context.IdsPacks.Remove(SelectedIds);
SelectedIds = null;
- ColorLabVM.InvalidateLiquidFactorsCalibrationData();
+ ColorCalibrationViewVM.InvalidateCalibrationDataAndColorConversion();
}
/// <summary>
@@ -432,7 +435,12 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels
}
}
- ColorLabVM.InitHost(ActiveMachineAdapter.Context, ActiveMachine, ActiveMachineAdapter.Rmls, ActiveMachineAdapter.Rmls.FirstOrDefault());
+ ColorCalibrationViewVM = new ColorCalibrationViewVM(_notification, ActiveMachine, _activeMachineAdapter.Context)
+ {
+ Rmls = ActiveMachineAdapter.Rmls,
+ LiquidTypesRmls = ActiveMachineAdapter.Rmls.FirstOrDefault().LiquidTypesRmls,
+ SelectedRML = ActiveMachineAdapter.Rmls.FirstOrDefault(),
+ };
View.NavigateTo(MachineDesignerNavigationView.MachineDetailsView);
}
@@ -574,14 +582,17 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels
ActiveMachine.ConfigurationGuid = ActiveMachine.Configuration.Guid;
ActiveMachine.LastUpdated = DateTime.UtcNow;
ActiveMachine.ProductionDate = DateTime.UtcNow;
- await ActiveMachineAdapter.Context.SaveChangesAsync();
- await ColorLabVM.SaveChanges();
+ ColorCalibrationViewVM.Save();
+
+ await ActiveMachineAdapter.Context.SaveChangesAsync();
if (SelectedMachine != null)
{
await SelectedMachine.Reload(MachinesAdapter.Context);
}
+
+ ColorCalibrationViewVM.Invalidate();
}
}
catch (Exception ex)
@@ -669,9 +680,19 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels
{
Task.Factory.StartNew(() =>
{
- IsFree = false;
- MachinesAdapter.Machines = MachinesAdapter.Context.Machines.Where(x => x.SerialNumber.StartsWith(Filter)).Include(x => x.Organization).Include(x => x.MachineVersion).ToSynchronizedObservableCollection();
- IsFree = true;
+ try
+ {
+ IsFree = false;
+ MachinesAdapter.Machines = MachinesAdapter.Context.Machines.Where(x => x.SerialNumber.StartsWith(Filter)).Include(x => x.Organization).Include(x => x.MachineVersion).ToSynchronizedObservableCollection();
+ }
+ catch
+ {
+
+ }
+ finally
+ {
+ IsFree = true;
+ }
});
});
}