aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2018-07-05 19:44:36 +0300
committerRoy Ben-Shabat <Roy@Twine-s.com>2018-07-05 19:44:36 +0300
commit25b7d63b202f85fa5af57f4d59c984e9afaf30c5 (patch)
treeaf7315cf001aa37099c63f1971cf07f74ee46dbc /Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs
parent466b54210bc5066e6e29107d6c8f996f360b1426 (diff)
downloadTango-25b7d63b202f85fa5af57f4d59c984e9afaf30c5.tar.gz
Tango-25b7d63b202f85fa5af57f4d59c984e9afaf30c5.zip
Using LINQ to SQL Async methods in JobView.
Diffstat (limited to 'Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs')
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs37
1 files changed, 13 insertions, 24 deletions
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 bb8e31723..a22e1fdf4 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
@@ -407,33 +407,22 @@ namespace Tango.PPC.Jobs.ViewModels
/// <param name="message">The message.</param>
private async void HandleJobSelectedMessage(JobSelectedMessage message)
{
- await Task.Factory.StartNew(() =>
+ if (_db != null)
{
- if (_db != null)
- {
- _db.Dispose();
- }
-
- _db = ObservablesContext.CreateDefault();
- Job = _db.Jobs.SingleOrDefault(x => x.Guid == message.Job.Guid);
- var machine = Job.Machine;
-
- while (machine == null)
- {
- Thread.Sleep(10);
- UIHelper.DoEvents();
- }
+ _db.Dispose();
+ }
- Rmls = _db.Rmls.ToList();
- ColorSpaces = _db.ColorSpaces.ToList();
- SpoolTypes = _db.SpoolTypes.ToList();
- Customers = _db.Customers.Where(x => x.OrganizationGuid == machine.OrganizationGuid).ToList();
+ _db = ObservablesContext.CreateDefault();
+ Job = await _db.Jobs.SingleOrDefaultAsync(x => x.Guid == message.Job.Guid);
+ Rmls = await _db.Rmls.ToListAsync();
+ ColorSpaces = await _db.ColorSpaces.ToListAsync();
+ SpoolTypes = await _db.SpoolTypes.ToListAsync();
+ Customers = await _db.Customers.Where(x => x.OrganizationGuid == ApplicationManager.Machine.OrganizationGuid).ToListAsync();
- if (!_check_gamut_thread.IsAlive)
- {
- _check_gamut_thread.Start();
- }
- });
+ if (!_check_gamut_thread.IsAlive)
+ {
+ _check_gamut_thread.Start();
+ }
SegmentsCollectionView = CollectionViewSource.GetDefaultView(Job.Segments);
SegmentsCollectionView.SortDescriptions.Add(new SortDescription(nameof(Segment.SegmentIndex), ListSortDirection.Ascending));