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. --- .../NavigationObjects/JobNavigationObject.cs | 1 + .../Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs | 59 +- .../Tango.PPC.Jobs/ViewModels/JobsViewVM.cs | 7 +- .../ViewModels/TwineCatalogViewVM.cs | 7 +- .../PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml | 980 +++++++++++---------- .../Modules/Tango.PPC.Jobs/Views/JobView.xaml.cs | 50 +- 6 files changed, 617 insertions(+), 487 deletions(-) (limited to 'Software/Visual_Studio/PPC') diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/NavigationObjects/JobNavigationObject.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/NavigationObjects/JobNavigationObject.cs index 87acfcb17..0f5e39872 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/NavigationObjects/JobNavigationObject.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/NavigationObjects/JobNavigationObject.cs @@ -29,6 +29,7 @@ namespace Tango.PPC.Jobs.NavigationObjects public enum JobNavigationIntent { Default, + NewJob, SampleDye, FineTuning, } 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."); } } 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 4115462dd..c4bd1f5b8 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 @@ -21,6 +21,7 @@ using Tango.PPC.Jobs.Messages; using Tango.PPC.Jobs.Views; using System.Data.Entity; using Tango.BL.Builders; +using Tango.PPC.Jobs.NavigationObjects; namespace Tango.PPC.Jobs.ViewModels { @@ -322,7 +323,11 @@ namespace Tango.PPC.Jobs.ViewModels RaiseMessage(new JobSelectedMessage() { Job = job, Context = _db }); await Task.Delay(200); - await NavigationManager.NavigateTo(nameof(JobView)); + await NavigationManager.NavigateWithObject(new JobNavigationObject() + { + Job = job, + Intent = JobNavigationIntent.NewJob + }); } catch (Exception ex) { 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 cd5553b77..6ed4afcd8 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,11 @@ namespace Tango.PPC.Jobs.ViewModels /// public override void OnApplicationStarted() { - //Catalog = CatalogLoader.LoadCatalog(BL.Enumerations.ColorSpaces.Twine, ObservablesEntitiesAdapter.Instance.Context); - //Recent = CatalogLoader.GetRecent(Catalog, SettingsManager.Default.GetOrCreate().RecentTwineCatalogColors); + InvokeUI(() => + { + Catalog = CatalogLoader.LoadCatalog(BL.Enumerations.ColorSpaces.Twine, ObservablesStaticCollections.Instance.Context); + Recent = CatalogLoader.GetRecent(Catalog, SettingsManager.Default.GetOrCreate().RecentTwineCatalogColors); + }); } /// diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml index eaa17f55d..a85da8f18 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml @@ -55,7 +55,23 @@ - + + + + + + + + + + + + + + + + + @@ -347,230 +363,233 @@ - - - - - - - - - Job Details - - - - + + + + + + + + + + Job Details + + + + - - + + - Job name: - + Job name: + - Customer: - + Customer: + - Thread type: - + Thread type: + - Comment: - + Comment: + - - + + - - - - - - - - + + + + + + + + - + - + - + - + - + - + - + - - - - - - - - - - - Color & Length - + + + + + + - - - - - - - - + + + Color & Length + - - - - - - + + + + + + + + + + + + + + + + - - - - + + + + - - - - - + + + + + + + + + + + + + + + + + + + SOLID SEGMENT + + + + + + + + + + + + + GRADIENT SEGMENT + + - - + + + Include white gap between segments + + + + - + - - - - - SOLID SEGMENT - - - - - - - - - - - - - GRADIENT SEGMENT - - - + + + + - - - Include white gap between segments - - - - + - + + + Output + - - + + + - - + + + + + + + + + - - Output + + Job Summary - - - - - - - - - - - - - - - - - - Job Summary - - - - - - + + + + - + - - + + - - - - - + + + + + (+%) - - + + - - + + - + - + - % + % - - - + + + + - - + - - Additional Tools - + + Additional Tools + - - - - - - Sample Dye - - + + + + + Sample Dye + + - - - - - - - - - - START - - - - + + + + + + + + + + + + START + + + + - - - - - - How to continue? + + + + + + How to continue? + + + + + + + DONE + + - - - - - - DONE - - + The sample is approved + - The sample is approved - + + + + + REPEAT + + - - + Dye more samples + + + + + + + + + + + + + + + Sample Approved: + + + - - REPEAT + + ANOTHER SAMPLE + + + + + + + + + + - Dye more samples - - - - - - - - - - - - - - - Sample Approved: - - - - - - ANOTHER SAMPLE - - - - - - + + + - - - - - - - - - + + - - - + + + You can use the color fine tuning tool to adjust the colors. - + + - - + - - - - - Color Fine Tuning - - - - - - - - - - - - - - - - - - + + + + + Color Fine Tuning + + - - Reset + - - START - - - - - - - - - - - - - - 1 - - Select the best variation for each color: - + + + + + + + + + + + + + + + + + 2 + + How to continue - - - - - REPEAT - - + + + + + + DONE + + - Some color need more fine tuning - - - - - - + All colors are approved + - - - - - - + + + + + REPEAT + + + + Some color need more fine tuning + + + + + + + + + + + + + Colors Approved: - - - - - REPEAT FINE TUNING - - - - - - - - - - - - - + + + + + REPEAT FINE TUNING + + + + + + + + + + + + + + - - + + + + + + + + diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml.cs index 90be80a84..72e13d5c7 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -23,15 +24,16 @@ namespace Tango.PPC.Jobs.Views /// /// Interaction logic for JobView.xaml /// - public partial class JobView : UserControl ,INavigationView, IJobView + public partial class JobView : UserControl, INavigationView, IJobView { private JobViewVM _vm; + private bool _is_edit_docked; public JobView() { InitializeComponent(); - Loaded += (_, __) => + Loaded += (_, __) => { _vm = DataContext as JobViewVM; }; @@ -41,6 +43,7 @@ namespace Tango.PPC.Jobs.Views public void OnNavigatedTo() { + FloatEditing(); scrollViewer.ScrollToTop(); } @@ -65,7 +68,48 @@ namespace Tango.PPC.Jobs.Views public void OnNavigatedFrom() { - + + } + + private void scrollViewer_Scrolling(object sender, Touch.Controls.DoubleValueChangedEventArgs e) + { + if (_vm.Job.Segments.Count > 3) + { + var position = scrollViewer.GetElementPosition(listSegments); + var stackOutputPosition = scrollViewer.GetElementPosition(stackOutput); + + if (stackOutputPosition.Y > 100) + { + if (position.Y < 110 && !_is_edit_docked) + { + DockEditing(); + } + else if (position.Y > 110 && _is_edit_docked) + { + FloatEditing(); + } + } + else + { + borderEditDock.Visibility = Visibility.Collapsed; + } + } + } + + private void DockEditing() + { + _is_edit_docked = true; + borderDockFloat.Child = null; + borderEditDock.Child = dockEdit; + borderEditDock.Visibility = Visibility.Visible; + } + + private void FloatEditing() + { + _is_edit_docked = false; + borderEditDock.Child = null; + borderDockFloat.Child = dockEdit; + borderEditDock.Visibility = Visibility.Collapsed; } } } -- cgit v1.3.1