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/Modules') 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 From 529d8938db258e7162b7776a5b5180a9675a7f70 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Mon, 12 Nov 2018 17:24:59 +0200 Subject: Some improvements to PPC. --- .../PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml | 2 +- .../Modules/Tango.PPC.Jobs/Views/JobView.xaml.cs | 2 +- .../Connectivity/DefaultConnectivityProvider.cs | 6 +++- .../PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs | 1 + .../PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs | 35 ++++++++++++++++++++++ .../PPC/Tango.PPC.UI/Views/MainView.xaml | 23 ++++++++++++++ .../Tango.Touch/Controls/TouchPanel.cs | 9 ++++++ .../Tango.Touch/Controls/TouchPanel.xaml | 18 ++++++----- .../Tango.Touch/Keyboard/TouchKeyboard.xaml | 20 ++++++------- .../Tango.Touch/Resources/Colors.xaml | 6 ++-- 10 files changed, 100 insertions(+), 22 deletions(-) (limited to 'Software/Visual_Studio/PPC/Modules') 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 a85da8f18..46fa981e9 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 @@ -263,7 +263,7 @@ - + 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 72e13d5c7..6a6e770a7 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 @@ -73,7 +73,7 @@ namespace Tango.PPC.Jobs.Views private void scrollViewer_Scrolling(object sender, Touch.Controls.DoubleValueChangedEventArgs e) { - if (_vm.Job.Segments.Count > 3) + if (_vm.Job != null && _vm.Job.Segments != null && _vm.Job.Segments.Count > 3) { var position = scrollViewer.GetElementPosition(listSegments); var stackOutputPosition = scrollViewer.GetElementPosition(stackOutput); diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Connectivity/DefaultConnectivityProvider.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Connectivity/DefaultConnectivityProvider.cs index e990b50a1..a3420fb01 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Connectivity/DefaultConnectivityProvider.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Connectivity/DefaultConnectivityProvider.cs @@ -115,7 +115,11 @@ namespace Tango.PPC.UI.Connectivity await RefreshAvailableWiFiNetworks(); var settings = SettingsManager.Default.GetOrCreate(); - var auto_connect_network = AvailableWiFiNetworks.ToList().FirstOrDefault(x => x.Name == settings.AutoConnectWiFiName); + var networks = AvailableWiFiNetworks.ToList(); + + var auto_connect_network = networks.FirstOrDefault(x => x.Name == settings.AutoConnectWiFiName); + + IsConnected = networks.Exists(x => x.IsConnected); if (auto_connect_network != null && !auto_connect_network.IsConnected) { diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs index fd36d0d13..7ac7db47d 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using System.Windows.Threading; using Tango.Core.Commands; using Tango.Core.DI; using Tango.Integration.Operation; diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs index e207c30b3..b01be3734 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using System.Windows.Threading; using Tango.Core.DI; using Tango.Integration.ExternalBridge; using Tango.PPC.Common; @@ -22,11 +23,45 @@ namespace Tango.PPC.UI.ViewModels /// public class MainViewVM : PPCViewModel { + private DispatcherTimer _date_timer; + + private DateTime _currentDateTime; + /// + /// Gets or sets the current date time. + /// + public DateTime CurrentDateTime + { + get { return _currentDateTime; } + set { _currentDateTime = value; RaisePropertyChangedAuto(); } + } + + public MainViewVM() + { + _date_timer = new DispatcherTimer(); + _date_timer.Interval = TimeSpan.FromSeconds(1); + _date_timer.Tick += _date_timer_Tick; + _date_timer.Start(); + } + /// /// Called when the application has been started. /// public override void OnApplicationStarted() { } + + #region Event Handlers + + /// + /// Handles the Tick event of the _date_timer. + /// + /// The source of the event. + /// The instance containing the event data. + private void _date_timer_Tick(object sender, EventArgs e) + { + CurrentDateTime = DateTime.Now; + } + + #endregion } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MainView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MainView.xaml index 8e54f0990..890877bf9 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MainView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MainView.xaml @@ -39,6 +39,29 @@ + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchPanel.cs b/Software/Visual_Studio/Tango.Touch/Controls/TouchPanel.cs index ad66a1170..53ca89bc3 100644 --- a/Software/Visual_Studio/Tango.Touch/Controls/TouchPanel.cs +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchPanel.cs @@ -162,6 +162,15 @@ namespace Tango.Touch.Controls public static readonly DependencyProperty ItemExpandedPropertyPathProperty = DependencyProperty.Register("ItemExpandedPropertyPath", typeof(String), typeof(TouchPanel), new PropertyMetadata(null)); + public FrameworkElement TaskBarElement + { + get { return (FrameworkElement)GetValue(TaskBarElementProperty); } + set { SetValue(TaskBarElementProperty, value); } + } + public static readonly DependencyProperty TaskBarElementProperty = + DependencyProperty.Register("TaskBarElement", typeof(FrameworkElement), typeof(TouchPanel), new PropertyMetadata(null)); + + #region Attached Properties #region Prevent Focus Steal diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchPanel.xaml b/Software/Visual_Studio/Tango.Touch/Controls/TouchPanel.xaml index 5440166f8..366c92dca 100644 --- a/Software/Visual_Studio/Tango.Touch/Controls/TouchPanel.xaml +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchPanel.xaml @@ -37,13 +37,17 @@ - - - - - - - + + + + + + + + + + + diff --git a/Software/Visual_Studio/Tango.Touch/Keyboard/TouchKeyboard.xaml b/Software/Visual_Studio/Tango.Touch/Keyboard/TouchKeyboard.xaml index cfd508ccc..d64164536 100644 --- a/Software/Visual_Studio/Tango.Touch/Keyboard/TouchKeyboard.xaml +++ b/Software/Visual_Studio/Tango.Touch/Keyboard/TouchKeyboard.xaml @@ -31,7 +31,7 @@