From 739fd56662cdee59f42ec8d80654babf158b9f51 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Sun, 11 Nov 2018 16:18:23 +0200 Subject: Machine Studio v3.5.63 --- .../MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI') diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs index de819a61f..b45a71b6a 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs @@ -4,5 +4,5 @@ using System.Runtime.InteropServices; [assembly: System.Windows.ThemeInfo(System.Windows.ResourceDictionaryLocation.None, System.Windows.ResourceDictionaryLocation.SourceAssembly)] [assembly: AssemblyTitle("Tango - Machine Studio")] -[assembly: AssemblyVersion("3.5.61.18305")] +[assembly: AssemblyVersion("3.5.62.18305")] [assembly: ComVisible(false)] \ No newline at end of file -- cgit v1.3.1 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. --- Software/DB/PPC/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/PPC/Tango_log.ldf | Bin 20578304 -> 20578304 bytes Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 15400960 -> 15400960 bytes .../Build/Shortcuts/Machine Studio.lnk | Bin 1532 -> 1532 bytes .../Build/Shortcuts/Proto Compiler GUI.lnk | Bin 1448 -> 1464 bytes .../Properties/AssemblyInfo.cs | 2 +- .../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 +- .../Visual_Studio/Tango.BL/Builders/JobBuilder.cs | 2 +- .../Tango.BL/EntitiesExtensions/BrushStop.cs | 34 +- .../Tango.BL/EntitiesExtensions/ColorCatalog.cs | 32 + .../Tango.BL/ObservablesStaticCollections.cs | 7 +- Software/Visual_Studio/Tango.BL/Tango.BL.csproj | 3 +- .../Tango.Touch/Controls/LightTouchScrollViewer.cs | 5 + .../Tango.Touch/Controls/TouchAutoComplete.cs | 17 +- .../Tango.Touch/Controls/TouchAutoComplete.xaml | 2 +- 21 files changed, 708 insertions(+), 500 deletions(-) create mode 100644 Software/Visual_Studio/Tango.BL/EntitiesExtensions/ColorCatalog.cs (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI') diff --git a/Software/DB/PPC/Tango.mdf b/Software/DB/PPC/Tango.mdf index 8a70af50e..7a00ca094 100644 Binary files a/Software/DB/PPC/Tango.mdf and b/Software/DB/PPC/Tango.mdf differ diff --git a/Software/DB/PPC/Tango_log.ldf b/Software/DB/PPC/Tango_log.ldf index 336d28c2f..ffb2044cf 100644 Binary files a/Software/DB/PPC/Tango_log.ldf and b/Software/DB/PPC/Tango_log.ldf differ diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index 052a165b9..e3cd1d1a2 100644 Binary files a/Software/DB/Tango.mdf and b/Software/DB/Tango.mdf differ diff --git a/Software/DB/Tango_log.ldf b/Software/DB/Tango_log.ldf index 642680034..a9975f8dd 100644 Binary files a/Software/DB/Tango_log.ldf and b/Software/DB/Tango_log.ldf differ diff --git a/Software/Visual_Studio/Build/Shortcuts/Machine Studio.lnk b/Software/Visual_Studio/Build/Shortcuts/Machine Studio.lnk index dd5f55739..a7935df17 100644 Binary files a/Software/Visual_Studio/Build/Shortcuts/Machine Studio.lnk and b/Software/Visual_Studio/Build/Shortcuts/Machine Studio.lnk differ diff --git a/Software/Visual_Studio/Build/Shortcuts/Proto Compiler GUI.lnk b/Software/Visual_Studio/Build/Shortcuts/Proto Compiler GUI.lnk index 63119ef64..c20fa96d6 100644 Binary files a/Software/Visual_Studio/Build/Shortcuts/Proto Compiler GUI.lnk and b/Software/Visual_Studio/Build/Shortcuts/Proto Compiler GUI.lnk differ diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs index b45a71b6a..d4f5c4c48 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs @@ -4,5 +4,5 @@ using System.Runtime.InteropServices; [assembly: System.Windows.ThemeInfo(System.Windows.ResourceDictionaryLocation.None, System.Windows.ResourceDictionaryLocation.SourceAssembly)] [assembly: AssemblyTitle("Tango - Machine Studio")] -[assembly: AssemblyVersion("3.5.62.18305")] +[assembly: AssemblyVersion("3.5.63.18305")] [assembly: ComVisible(false)] \ No newline at end of file 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; } } } diff --git a/Software/Visual_Studio/Tango.BL/Builders/JobBuilder.cs b/Software/Visual_Studio/Tango.BL/Builders/JobBuilder.cs index c70688819..a0a88f4a7 100644 --- a/Software/Visual_Studio/Tango.BL/Builders/JobBuilder.cs +++ b/Software/Visual_Studio/Tango.BL/Builders/JobBuilder.cs @@ -40,7 +40,7 @@ namespace Tango.BL.Builders { foreach (var segment in Entity.Segments.ToList()) { - Context.BrushStops.Where(x => x.SegmentGuid == segment.Guid).Include(x => x.ColorSpace).OrderBy(x => x.StopIndex).ToList(); + Context.BrushStops.Where(x => x.SegmentGuid == segment.Guid).Include(x => x.ColorSpace).Include(x => x.ColorCatalog).OrderBy(x => x.StopIndex).ToList(); } }); } diff --git a/Software/Visual_Studio/Tango.BL/EntitiesExtensions/BrushStop.cs b/Software/Visual_Studio/Tango.BL/EntitiesExtensions/BrushStop.cs index 73d987468..82f9dc106 100644 --- a/Software/Visual_Studio/Tango.BL/EntitiesExtensions/BrushStop.cs +++ b/Software/Visual_Studio/Tango.BL/EntitiesExtensions/BrushStop.cs @@ -50,6 +50,7 @@ namespace Tango.BL.Entities _colorPropertyNames.Add(nameof(Black)); _colorPropertyNames.Add(nameof(Color)); + _colorPropertyNames.Add(nameof(ColorCatalog)); } #region Properties @@ -350,7 +351,7 @@ namespace Tango.BL.Entities /// Raises the property changed event. /// /// Name of the property. - protected override void RaisePropertyChanged(string propName) + protected override async void RaisePropertyChanged(string propName) { base.RaisePropertyChanged(propName); @@ -358,7 +359,7 @@ namespace Tango.BL.Entities { if (_colorPropertyNames.Contains(propName)) { - SynchronizeColorSpaces(); + await SynchronizeColorSpaces(); _ignorePropChanged = true; @@ -412,13 +413,19 @@ namespace Tango.BL.Entities /// /// Synchronizes between the different brush stop color spaces. /// - private void SynchronizeColorSpaces() + private Task SynchronizeColorSpaces() { - Task.Factory.StartNew(() => + return Task.Factory.StartNew(() => { Rgb rgb = new Rgb(Red, Green, Blue); Cmyk cmyk = new Cmyk(Cyan, Magenta, Yellow, Black); Lab lab = new Lab(L, A, B); + Rgb rgb_twine = new Rgb(0, 0, 0); + + if (ColorCatalog != null) + { + rgb_twine = new Rgb(ColorCatalog.Red, ColorCatalog.Green, ColorCatalog.Blue); + } switch ((ColorSpaces)ColorSpace.Code) { @@ -434,6 +441,12 @@ namespace Tango.BL.Entities rgb = lab.To(); cmyk = lab.To(); break; + case ColorSpaces.Twine: + cmyk = rgb_twine.To(); + lab = rgb_twine.To(); + rgb = rgb_twine; + Validate(null); + break; } _red = (int)rgb.R; @@ -448,12 +461,19 @@ namespace Tango.BL.Entities _l = lab.L; _a = lab.A; _b = lab.B; - - //TODO: Remove this.. - //IsOutOfGamut = _red > 250; }); } + protected override void OnValidating(ObservablesContext context) + { + base.OnValidating(context); + + if (ColorSpace.Code == ColorSpaces.Twine.ToInt32() && ColorCatalog == null) + { + InsertError(nameof(ColorCatalog), "Please specify a color code."); + } + } + #endregion } } diff --git a/Software/Visual_Studio/Tango.BL/EntitiesExtensions/ColorCatalog.cs b/Software/Visual_Studio/Tango.BL/EntitiesExtensions/ColorCatalog.cs new file mode 100644 index 000000000..fe79c3362 --- /dev/null +++ b/Software/Visual_Studio/Tango.BL/EntitiesExtensions/ColorCatalog.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Media; + +namespace Tango.BL.Entities +{ + public partial class ColorCatalog + { + private Color _color; + /// + /// Gets the color. + /// + public Color Color + { + get { return _color; } + private set { _color = value; RaisePropertyChangedAuto(); } + } + + protected override void RaisePropertyChanged(string propName) + { + base.RaisePropertyChanged(propName); + + if (propName == nameof(Red) || propName == nameof(Green) || propName == nameof(Blue)) + { + Color = Color.FromRgb((byte)Red, (byte)Green, (byte)Blue); + } + } + } +} diff --git a/Software/Visual_Studio/Tango.BL/ObservablesStaticCollections.cs b/Software/Visual_Studio/Tango.BL/ObservablesStaticCollections.cs index 2847c508e..9ff695567 100644 --- a/Software/Visual_Studio/Tango.BL/ObservablesStaticCollections.cs +++ b/Software/Visual_Studio/Tango.BL/ObservablesStaticCollections.cs @@ -33,6 +33,11 @@ namespace Tango.BL } } + public ObservablesContext Context + { + get { return db; } + } + /// /// Initializes this instance. /// @@ -87,7 +92,6 @@ namespace Tango.BL MachineVersions = db.MachineVersions.ToObservableCollection(); - //Load later... Task.Factory.StartNew(() => { @@ -96,6 +100,7 @@ namespace Tango.BL MidTankTypes = db.MidTankTypes.ToObservableCollection(); CartridgeTypes = db.CartridgeTypes.ToObservableCollection(); IdsPackFormulas = db.IdsPackFormulas.ToObservableCollection(); + ColorCatalogs = db.ColorCatalogs.ToObservableCollection(); Rmls = db.Rmls.ToObservableCollection(); diff --git a/Software/Visual_Studio/Tango.BL/Tango.BL.csproj b/Software/Visual_Studio/Tango.BL/Tango.BL.csproj index 736a96e24..cf95ea9bc 100644 --- a/Software/Visual_Studio/Tango.BL/Tango.BL.csproj +++ b/Software/Visual_Studio/Tango.BL/Tango.BL.csproj @@ -110,6 +110,7 @@ + @@ -344,7 +345,7 @@ - + \ No newline at end of file diff --git a/Software/Visual_Studio/Tango.Touch/Controls/LightTouchScrollViewer.cs b/Software/Visual_Studio/Tango.Touch/Controls/LightTouchScrollViewer.cs index bea8f299e..d12be0e4c 100644 --- a/Software/Visual_Studio/Tango.Touch/Controls/LightTouchScrollViewer.cs +++ b/Software/Visual_Studio/Tango.Touch/Controls/LightTouchScrollViewer.cs @@ -792,6 +792,11 @@ namespace Tango.Touch.Controls return null; } + public Point GetElementPosition(FrameworkElement element) + { + return element.TranslatePoint(new Point(0, 0), this); + } + public T GetMostVisibleElementDataContext() where T : class { var elements = _grid_content.FindVisualChildren().Where(x => x.DataContext is T).ToList(); diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchAutoComplete.cs b/Software/Visual_Studio/Tango.Touch/Controls/TouchAutoComplete.cs index da5b44fa6..fd8f17367 100644 --- a/Software/Visual_Studio/Tango.Touch/Controls/TouchAutoComplete.cs +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchAutoComplete.cs @@ -107,7 +107,7 @@ namespace Tango.Touch.Controls public TouchAutoComplete() { - AutoCompleteProvider = new AutoCompleteProvider((obj, filter) => { return obj.ToString().ToLower().StartsWith(filter.ToLower()); }); + //AutoCompleteProvider = new AutoCompleteProvider((obj, filter) => { return obj.ToString().ToLower().StartsWith(filter.ToLower()); }); ItemSelectedCommand = new RelayCommand(() => OnSelectedItemChanged()); } @@ -136,6 +136,18 @@ namespace Tango.Touch.Controls private void _textBox_LostFocus(object sender, RoutedEventArgs e) { _popup.IsOpen = false; + + if (EffectiveItemsSource != null && EffectiveItemsSource.Count > 0 && SelectedItem == null) + { + SelectedItem = EffectiveItemsSource[0]; + + var binding = BindingOperations.GetBindingExpressionBase(this, SelectedItemProperty); + + if (binding != null) + { + binding.UpdateSource(); + } + } } private void _textBox_GotFocus(object sender, RoutedEventArgs e) @@ -152,6 +164,9 @@ namespace Tango.Touch.Controls { EffectiveItemsSource = AutoCompleteProvider.Filter(ItemsSource, Text); + SelectedItem = null; + + if (EffectiveItemsSource.Count > 0) { _popup.IsOpen = true; diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchAutoComplete.xaml b/Software/Visual_Studio/Tango.Touch/Controls/TouchAutoComplete.xaml index 37d8e26a6..94efc967f 100644 --- a/Software/Visual_Studio/Tango.Touch/Controls/TouchAutoComplete.xaml +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchAutoComplete.xaml @@ -101,7 +101,7 @@ - +