aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Modules
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2018-08-28 16:35:16 +0300
committerRoy Ben-Shabat <Roy@Twine-s.com>2018-08-28 16:35:16 +0300
commitf3fc87dd10b3d55591a84ecbfb0612769f0c09b9 (patch)
tree640621ab876dd5368d91e44b07b4f2872752e5bb /Software/Visual_Studio/PPC/Modules
parent37fe17f09478a486dcd51f0edd8028724dc85c16 (diff)
downloadTango-f3fc87dd10b3d55591a84ecbfb0612769f0c09b9.tar.gz
Tango-f3fc87dd10b3d55591a84ecbfb0612769f0c09b9.zip
Working on BL Builders !
Working on making PPC work with builders..
Diffstat (limited to 'Software/Visual_Studio/PPC/Modules')
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobSummeryViewVM.cs16
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs16
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs11
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/TwineCatalogViewVM.cs4
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs6
5 files changed, 40 insertions, 13 deletions
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobSummeryViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobSummeryViewVM.cs
index d46646698..46c6d7ffd 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobSummeryViewVM.cs
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobSummeryViewVM.cs
@@ -4,6 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Tango.BL;
+using Tango.BL.Builders;
using Tango.BL.Entities;
using Tango.Core.Commands;
using Tango.PPC.Common;
@@ -74,18 +75,27 @@ namespace Tango.PPC.Jobs.ViewModels
/// <summary>
/// Starts the job.
/// </summary>
- private void StartJob()
+ private async void StartJob()
{
try
{
LogManager.Log("Start job command pressed. Starting job and navigating to job progress view...");
+
+ Job = await new JobBuilder(_context).Set(Job.Guid)
+ .WithConfiguration()
+ .WithRML()
+ .WithUser()
+ .WithSegments()
+ .WithBrushStops()
+ .BuildAsync();
+
PrintingManager.Print(Job, _context);
- NavigationManager.NavigateTo<JobsModule>(nameof(JobProgressView));
+ await NavigationManager.NavigateTo<JobsModule>(nameof(JobProgressView));
}
catch (Exception ex)
{
LogManager.Log(ex, "Could not start the current job.");
- NotificationProvider.ShowError($"Cannot start job.\n{ex.Message}.");
+ await NotificationProvider.ShowError($"Cannot start job.\n{ex.Message}.");
}
}
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs
index a87340101..cda2ba96f 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs
@@ -29,6 +29,7 @@ using System.Collections.ObjectModel;
using Tango.PPC.Common.Models;
using Tango.Logging;
using Tango.PPC.Common.Messages;
+using Tango.BL.Builders;
namespace Tango.PPC.Jobs.ViewModels
{
@@ -365,12 +366,21 @@ namespace Tango.PPC.Jobs.ViewModels
_can_navigate_back = false;
_db = ObservablesContext.CreateDefault();
- var a = _db.Jobs.ToList();
- Job = await _db.Jobs.SingleOrDefaultAsync(x => x.Guid == _job_to_load.Guid);
+
+
+
+ Job = await new JobBuilder(_db).Set(_job_to_load.Guid)
+ .WithConfiguration()
+ .WithRML()
+ .WithUser()
+ .WithSegments()
+ .WithBrushStops()
+ .BuildAsync();
+
Job.ValidateOnPropertyChanged = true;
LogManager.Log("Loading RMLS...");
- Rmls = await _db.Rmls.ToListAsync();
+ Rmls = (await new RmlsCollectionBuilder(_db).Set().WithActiveParametersGroup().WithCAT(Job.MachineGuid).WithCCT().WithLiquidFactors().BuildAsync()).ToList();
LogManager.Log("Loading Color Spaces...");
ColorSpaces = await _db.ColorSpaces.ToListAsync();
LogManager.Log("Loading Spool Types...");
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs
index 7b277ec2b..4115462dd 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs
@@ -19,6 +19,8 @@ using Tango.PPC.Common.Messages;
using Tango.PPC.Jobs.Dialogs;
using Tango.PPC.Jobs.Messages;
using Tango.PPC.Jobs.Views;
+using System.Data.Entity;
+using Tango.BL.Builders;
namespace Tango.PPC.Jobs.ViewModels
{
@@ -228,11 +230,11 @@ namespace Tango.PPC.Jobs.ViewModels
_db = ObservablesContext.CreateDefault();
- var jobs = _db.Jobs.Where(x => x.Machine.Guid == MachineProvider.Machine.Guid).ToObservableCollection();
+ var jobs = new JobsCollectionBuilder(_db).Set(x => x.MachineGuid == MachineProvider.Machine.Guid).WithSegments().WithBrushStops().Build();
InvokeUI(() =>
{
- Jobs = jobs.Where(x => x.Machine.Guid == MachineProvider.Machine.Guid).ToObservableCollection();
+ Jobs = jobs;
JobsCollectionView = CollectionViewSource.GetDefaultView(Jobs);
JobsCollectionView.SortDescriptions.Add(new SortDescription(nameof(Job.LastUpdated), ListSortDirection.Descending));
FilterJobCategory(FilterCategory);
@@ -441,6 +443,11 @@ namespace Tango.PPC.Jobs.ViewModels
LoadJobs();
}
+ public override void OnApplicationReady()
+ {
+ base.OnApplicationReady();
+ }
+
#endregion
}
}
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/TwineCatalogViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/TwineCatalogViewVM.cs
index 079080f02..cd5553b77 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/TwineCatalogViewVM.cs
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/TwineCatalogViewVM.cs
@@ -73,8 +73,8 @@ namespace Tango.PPC.Jobs.ViewModels
/// </summary>
public override void OnApplicationStarted()
{
- Catalog = CatalogLoader.LoadCatalog(BL.Enumerations.ColorSpaces.Twine, ObservablesEntitiesAdapter.Instance.Context);
- Recent = CatalogLoader.GetRecent(Catalog, SettingsManager.Default.GetOrCreate<JobsModuleSettings>().RecentTwineCatalogColors);
+ //Catalog = CatalogLoader.LoadCatalog(BL.Enumerations.ColorSpaces.Twine, ObservablesEntitiesAdapter.Instance.Context);
+ //Recent = CatalogLoader.GetRecent(Catalog, SettingsManager.Default.GetOrCreate<JobsModuleSettings>().RecentTwineCatalogColors);
}
/// <summary>
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs
index 310a09846..0d0539152 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs
@@ -71,12 +71,12 @@ namespace Tango.PPC.MachineSettings.ViewModels
NavigationManager.NavigateBack();
}
- private void Save()
+ private async void Save()
{
Machine.SupportedJobTypes = SelectedJobTypes.SynchedSource.ToList();
Machine.ShallowCopyTo(MachineProvider.Machine);
- MachineProvider.Machine.SaveAsync(ObservablesEntitiesAdapter.Instance.Context);
- NavigationManager.NavigateBack();
+ await MachineProvider.SaveMachine();
+ await NavigationManager.NavigateBack();
RaiseMessage(new MachineSettingsSavedMessage() { Machine = MachineProvider.Machine });
}