aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs
diff options
context:
space:
mode:
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.cs59
1 files changed, 55 insertions, 4 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 cda2ba96f..874beba75 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
@@ -166,6 +166,31 @@ namespace Tango.PPC.Jobs.ViewModels
}
}
+ private bool _isJobDetailsExpanded;
+ /// <summary>
+ /// Gets or sets a value indicating whether the job details area is expanded.
+ /// </summary>
+ public bool IsJobDetailsExpanded
+ {
+ get { return _isJobDetailsExpanded; }
+ set { _isJobDetailsExpanded = value; RaisePropertyChangedAuto(); }
+ }
+
+ private List<ColorCatalog> _twineCatalogItems;
+ /// <summary>
+ /// Gets or sets the twine catalog items.
+ /// </summary>
+ public List<ColorCatalog> TwineCatalogItems
+ {
+ get { return _twineCatalogItems; }
+ set { _twineCatalogItems = value; RaisePropertyChangedAuto(); }
+ }
+
+ /// <summary>
+ /// Gets or sets the twine catalog automatic complete provider.
+ /// </summary>
+ public IAutoCompleteProvider TwineCatalogAutoCompleteProvider { get; set; }
+
#endregion
#region Commands
@@ -218,7 +243,7 @@ namespace Tango.PPC.Jobs.ViewModels
/// <summary>
/// Gets or sets the twine catalog field tap command.
/// </summary>
- public RelayCommand<BrushStop> TwineCatalogFieldTapCommand { get; set; }
+ public RelayCommand<BrushStop> OpenTwineCatalogCommand { get; set; }
/// <summary>
/// Gets or sets the increase decrease samples to dye command.
@@ -296,12 +321,19 @@ namespace Tango.PPC.Jobs.ViewModels
FineTuneItems = new ObservableCollection<FineTuneItem>();
ApprovalFineTuneItems = new ObservableCollection<FineTuneItem>();
+ TwineCatalogItems = new List<ColorCatalog>();
CustomersAutoCompleteProvider = new AutoCompleteProvider<Customer>((customer, filter) =>
{
return customer.Name.ToLower().StartsWith(filter != null ? filter.ToLower() : String.Empty);
});
+
+ TwineCatalogAutoCompleteProvider = new AutoCompleteProvider<ColorCatalog>((color, filter) =>
+ {
+ return !String.IsNullOrWhiteSpace(filter) && color.Name.ToLower().StartsWith(filter.ToLower());
+ });
+
//Initialize Commands
AddSolidSegmentCommand = new RelayCommand(() => AddSolidSegment());
AddBrushStopCommand = new RelayCommand<Segment>(AddBrushStop);
@@ -344,6 +376,7 @@ namespace Tango.PPC.Jobs.ViewModels
StartFineTuningCommand = new RelayCommand(StartFineTuning, () => FineTuneItems.Any(x => x.IsSelected));
RepeatFineTuningCommand = new RelayCommand(RepeatFineTuning);
ApproveFineTuningCommand = new RelayCommand(ApproveFineTuning);
+ OpenTwineCatalogCommand = new RelayCommand<BrushStop>(OpenTwineCatalog);
}
#endregion
@@ -367,8 +400,6 @@ namespace Tango.PPC.Jobs.ViewModels
_db = ObservablesContext.CreateDefault();
-
-
Job = await new JobBuilder(_db).Set(_job_to_load.Guid)
.WithConfiguration()
.WithRML()
@@ -387,6 +418,7 @@ namespace Tango.PPC.Jobs.ViewModels
SpoolTypes = await _db.SpoolTypes.ToListAsync();
LogManager.Log("Loading Customers...");
Customers = await _db.Customers.Where(x => x.OrganizationGuid == MachineProvider.Machine.OrganizationGuid).ToListAsync();
+ TwineCatalogItems = await _db.ColorCatalogs.Where(x => x.ColorSpace.Code == (int)BL.Enumerations.ColorSpaces.Twine).OrderBy(x => x.Name).ToListAsync();
if (!_check_gamut_thread.IsAlive)
{
@@ -409,6 +441,11 @@ namespace Tango.PPC.Jobs.ViewModels
Job.JobFineTuningStatus = BL.Enumerations.FineTuningStatuses.Unspecified;
}
+ if (_job_to_load_intent == JobNavigationIntent.NewJob)
+ {
+ IsJobDetailsExpanded = true;
+ }
+
LogManager.Log($"Job editing state = '{Job.JobEditingState}'.");
if (Job.JobEditingState == BL.Enumerations.EditingStates.SampleDye && Job.JobSampleDyeStatus == BL.Enumerations.SampleDyeStatuses.PendingApproval)
@@ -690,6 +727,20 @@ namespace Tango.PPC.Jobs.ViewModels
brushStop.OutOfGamutChecked = false;
}
+ /// <summary>
+ /// Opens the twine catalog for the specified brush stop.
+ /// </summary>
+ /// <param name="stop">The stop.</param>
+ private async void OpenTwineCatalog(BrushStop stop)
+ {
+ var catalogItem = await NavigationManager.NavigateForResult<JobsModule, TwineCatalogView, CatalogItem, BrushStop>(stop, true);
+
+ if (catalogItem != null)
+ {
+ stop.ColorCatalog = TwineCatalogItems.SingleOrDefault(x => x.Guid == catalogItem.Entity.Guid);
+ }
+ }
+
#endregion
#region Job Selection Message
@@ -802,7 +853,7 @@ namespace Tango.PPC.Jobs.ViewModels
}
catch (Exception ex)
{
- LogManager.Log(ex, "Error while trying to synchronize fine tuning itmes with brush stops.");
+ LogManager.Log(ex, "Error while trying to synchronize fine tuning items with brush stops.");
}
}