From a98e30ab93fd4717bbe49c0b2cb6dff4bc65a67c Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Mon, 12 Nov 2018 13:17:41 +0200 Subject: Working on PPC color catalog. --- .../Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs | 59 ++++++++++++++++++++-- 1 file changed, 55 insertions(+), 4 deletions(-) (limited to 'Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs') 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; + /// + /// Gets or sets a value indicating whether the job details area is expanded. + /// + public bool IsJobDetailsExpanded + { + get { return _isJobDetailsExpanded; } + set { _isJobDetailsExpanded = value; RaisePropertyChangedAuto(); } + } + + private List _twineCatalogItems; + /// + /// Gets or sets the twine catalog items. + /// + public List TwineCatalogItems + { + get { return _twineCatalogItems; } + set { _twineCatalogItems = value; RaisePropertyChangedAuto(); } + } + + /// + /// Gets or sets the twine catalog automatic complete provider. + /// + public IAutoCompleteProvider TwineCatalogAutoCompleteProvider { get; set; } + #endregion #region Commands @@ -218,7 +243,7 @@ namespace Tango.PPC.Jobs.ViewModels /// /// Gets or sets the twine catalog field tap command. /// - public RelayCommand TwineCatalogFieldTapCommand { get; set; } + public RelayCommand OpenTwineCatalogCommand { get; set; } /// /// Gets or sets the increase decrease samples to dye command. @@ -296,12 +321,19 @@ namespace Tango.PPC.Jobs.ViewModels FineTuneItems = new ObservableCollection(); ApprovalFineTuneItems = new ObservableCollection(); + TwineCatalogItems = new List(); CustomersAutoCompleteProvider = new AutoCompleteProvider((customer, filter) => { return customer.Name.ToLower().StartsWith(filter != null ? filter.ToLower() : String.Empty); }); + + TwineCatalogAutoCompleteProvider = new AutoCompleteProvider((color, filter) => + { + return !String.IsNullOrWhiteSpace(filter) && color.Name.ToLower().StartsWith(filter.ToLower()); + }); + //Initialize Commands AddSolidSegmentCommand = new RelayCommand(() => AddSolidSegment()); AddBrushStopCommand = new RelayCommand(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(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; } + /// + /// Opens the twine catalog for the specified brush stop. + /// + /// The stop. + private async void OpenTwineCatalog(BrushStop stop) + { + var catalogItem = await NavigationManager.NavigateForResult(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."); } } -- cgit v1.3.1