From a46fd6cec3dc8aa99e7a3067de4c0617b232ff88 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Wed, 8 May 2019 13:35:30 +0300 Subject: Working on TCC... --- .../Tango.UnitTesting/SendGrid/SendGrid_TST.cs | 29 +++------------------- 1 file changed, 4 insertions(+), 25 deletions(-) (limited to 'Software/Visual_Studio/Tango.UnitTesting') diff --git a/Software/Visual_Studio/Tango.UnitTesting/SendGrid/SendGrid_TST.cs b/Software/Visual_Studio/Tango.UnitTesting/SendGrid/SendGrid_TST.cs index 9465676ef..ca0ba1143 100644 --- a/Software/Visual_Studio/Tango.UnitTesting/SendGrid/SendGrid_TST.cs +++ b/Software/Visual_Studio/Tango.UnitTesting/SendGrid/SendGrid_TST.cs @@ -50,26 +50,12 @@ namespace Tango.UnitTesting.SendGrid msg.Subject = "SnapMatch Color Result"; msg.SetTemplateId("d-619b8adc604d4f6fa486d7bbc9e3c2cc"); - Bitmap rect = new Bitmap(80, 80); - using (Graphics g = Graphics.FromImage(rect)) + var dynamicTemplateData = new { - g.Clear(Color.FromArgb(255, 0, 0)); - } - - String image64 = String.Empty; - - using (MemoryStream ms = new MemoryStream()) - { - rect.Save(ms, ImageFormat.Jpeg); - ms.Position = 0; - image64 = Convert.ToBase64String(ms.ToArray()); - } - - var dynamicTemplateData = new ExampleTemplateData - { - Name = "Roy", Message = "This is my personal note...", - ImageSource = image64, + R = 0, + G = 255, + B = 0, }; msg.SetTemplateData(dynamicTemplateData); @@ -86,12 +72,5 @@ namespace Tango.UnitTesting.SendGrid Assert.IsTrue(result.StatusCode == HttpStatusCode.Accepted); } - - public class ExampleTemplateData - { - public String Name { get; set; } - public String ImageSource { get; set; } - public String Message { get; set; } - } } } -- cgit v1.3.1 From e5200c6ba6a1b13525cc1261992ad61b03f93951 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Fri, 10 May 2019 14:49:12 +0300 Subject: Implemented TWN & TCC Import on PPC. --- Software/DB/PPC/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/PPC/Tango_log.ldf | Bin 53673984 -> 53673984 bytes .../Dialogs/ImportColorProfileView.xaml | 35 ++++++++ .../Dialogs/ImportColorProfileView.xaml.cs | 28 ++++++ .../Dialogs/ImportColorProfileViewVM.cs | 16 ++++ .../Tango.PPC.Jobs/Dialogs/ImportJobView.xaml | 10 +-- .../Tango.PPC.Jobs/Dialogs/ImportTwnFileView.xaml | 28 ++++++ .../Dialogs/ImportTwnFileView.xaml.cs | 28 ++++++ .../Tango.PPC.Jobs/Dialogs/ImportTwnFileViewVM.cs | 17 ++++ .../PPC/Modules/Tango.PPC.Jobs/Images/emb-file.png | Bin 0 -> 2588 bytes .../Modules/Tango.PPC.Jobs/Tango.PPC.Jobs.csproj | 26 +++++- .../Tango.PPC.Jobs/ViewModels/JobsViewVM.cs | 100 ++++++++++++++++++++- .../PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml | 2 +- .../Visual_Studio/PPC/Tango.PPC.UI/app.manifest | 2 +- .../ExtensionMethods/ByteArrayExtensions.cs | 33 +++++++ .../Visual_Studio/Tango.Core/Tango.Core.csproj | 3 +- .../Visual_Studio/Tango.Explorer/Images/color.png | Bin 2287 -> 6704 bytes Software/Visual_Studio/Tango.Pulse/TwnFile.cs | 5 ++ .../Visual_Studio/Tango.Pulse/TwnFileReader.cs | 1 + .../Tango.UnitTesting/Pulse/Pulse_TST.cs | 42 +++++++++ 20 files changed, 365 insertions(+), 11 deletions(-) create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/ImportColorProfileView.xaml create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/ImportColorProfileView.xaml.cs create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/ImportColorProfileViewVM.cs create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/ImportTwnFileView.xaml create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/ImportTwnFileView.xaml.cs create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/ImportTwnFileViewVM.cs create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/emb-file.png create mode 100644 Software/Visual_Studio/Tango.Core/ExtensionMethods/ByteArrayExtensions.cs (limited to 'Software/Visual_Studio/Tango.UnitTesting') diff --git a/Software/DB/PPC/Tango.mdf b/Software/DB/PPC/Tango.mdf index dff95607f..43db581e7 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 d83b8d16c..b956aa006 100644 Binary files a/Software/DB/PPC/Tango_log.ldf and b/Software/DB/PPC/Tango_log.ldf differ diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/ImportColorProfileView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/ImportColorProfileView.xaml new file mode 100644 index 000000000..41010261e --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/ImportColorProfileView.xaml @@ -0,0 +1,35 @@ + + + + + CANCEL + IMPORT + + + + Import SnapMatch Color + + A SnapMatch color detection result file has been selected from the storage device. press 'IMPORT' to create a new job from this color. + + + + + Detected Color + + + + + + + + + + diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/ImportColorProfileView.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/ImportColorProfileView.xaml.cs new file mode 100644 index 000000000..f919b9df8 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/ImportColorProfileView.xaml.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace Tango.PPC.Jobs.Dialogs +{ + /// + /// Interaction logic for ImportJobView.xaml + /// + public partial class ImportColorProfileView : UserControl + { + public ImportColorProfileView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/ImportColorProfileViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/ImportColorProfileViewVM.cs new file mode 100644 index 000000000..100236d8e --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/ImportColorProfileViewVM.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Media; +using Tango.Core.Commands; +using Tango.SharedUI; + +namespace Tango.PPC.Jobs.Dialogs +{ + public class ImportColorProfileViewVM : DialogViewVM + { + public Color Color { get; set; } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/ImportJobView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/ImportJobView.xaml index 6d719aba9..ac27cc00d 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/ImportJobView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/ImportJobView.xaml @@ -6,13 +6,13 @@ xmlns:local="clr-namespace:Tango.PPC.Jobs.Dialogs" xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" mc:Ignorable="d" - Background="{StaticResource TangoPrimaryBackgroundBrush}" d:DesignHeight="555" d:DesignWidth="560" Width="550" Height="450" d:DataContext="{d:DesignInstance Type=local:ImportJobViewVM, IsDesignTimeCreatable=False}"> + Background="{StaticResource TangoPrimaryBackgroundBrush}" d:DesignHeight="555" d:DesignWidth="560" Width="570" Height="700" d:DataContext="{d:DesignInstance Type=local:ImportJobViewVM, IsDesignTimeCreatable=False}"> - - CANCEL - IMPORT - + + CANCEL + IMPORT + IMPORT JOB diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/ImportTwnFileView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/ImportTwnFileView.xaml new file mode 100644 index 000000000..0cd9540ec --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/ImportTwnFileView.xaml @@ -0,0 +1,28 @@ + + + + + CANCEL + IMPORT + + + + Import Embroidery File + + An embroidery design file has been selected from the storage device. press 'IMPORT' to create a new job from this design. + + + + + + + + diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/ImportTwnFileView.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/ImportTwnFileView.xaml.cs new file mode 100644 index 000000000..a04406374 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/ImportTwnFileView.xaml.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace Tango.PPC.Jobs.Dialogs +{ + /// + /// Interaction logic for ImportJobView.xaml + /// + public partial class ImportTwnFileView : UserControl + { + public ImportTwnFileView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/ImportTwnFileViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/ImportTwnFileViewVM.cs new file mode 100644 index 000000000..5792413b8 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/ImportTwnFileViewVM.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using Tango.Core.Commands; +using Tango.SharedUI; + +namespace Tango.PPC.Jobs.Dialogs +{ + public class ImportTwnFileViewVM : DialogViewVM + { + public BitmapSource Thumbnail { get; set; } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/emb-file.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/emb-file.png new file mode 100644 index 000000000..a369eb899 Binary files /dev/null and b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/emb-file.png differ diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Tango.PPC.Jobs.csproj b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Tango.PPC.Jobs.csproj index 792e32521..8659367b3 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Tango.PPC.Jobs.csproj +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Tango.PPC.Jobs.csproj @@ -46,6 +46,7 @@ + ..\..\..\packages\Expression.Blend.Sdk.1.0.2\lib\net45\System.Windows.Interactivity.dll @@ -91,6 +92,14 @@ Designer MSBuild:Compile + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + Designer MSBuild:Compile @@ -173,6 +182,14 @@ BasicColorCorrectionView.xaml + + ImportTwnFileView.xaml + + + ImportColorProfileView.xaml + + + FineTuningPaletteView.xaml @@ -282,6 +299,10 @@ {e4927038-348d-4295-aaf4-861c58cb3943} Tango.PMR + + {8435223d-db6b-45e3-a08b-45b7416f8481} + Tango.Pulse + {d8f1ad85-526a-4f50-b6dc-d437af63d8d8} Tango.Settings @@ -420,10 +441,13 @@ + + + - + \ No newline at end of file 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 2ea3b98b8..530eae385 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 @@ -30,6 +30,9 @@ using Tango.PMR.Exports; using Tango.Settings; using Tango.Integration.ExternalBridge; using System.Windows.Media; +using Tango.PMR.TCC; +using Tango.Pulse; +using System.Windows.Media.Imaging; namespace Tango.PPC.Jobs.ViewModels { @@ -376,7 +379,7 @@ namespace Tango.PPC.Jobs.ViewModels /// /// Adds a new job. /// - private async void AddNewJob(Color? colorProfile = null) + private async void AddNewJob(Color? colorProfile = null, TwnFile twnFile = null) { try { @@ -410,10 +413,13 @@ namespace Tango.PPC.Jobs.ViewModels vm.SelectedColorSpace = space.IsUserSpace() ? space : ColorSpaces.Twine; } - if (colorProfile != null) + if (colorProfile != null || twnFile != null) { vm.SupportedColorSpaces = new List() { ColorSpaces.RGB }; vm.SelectedColorSpace = vm.SupportedColorSpaces.First(); + + vm.SupportedJobTypes = new List() { JobTypes.Embroidery }; + vm.SelectedJobType = vm.SupportedJobTypes.First(); } if (machine.SupportedJobTypes.Count != 1 || machine.SupportedColorSpaces.Count != 1) @@ -461,6 +467,44 @@ namespace Tango.PPC.Jobs.ViewModels job.AddSolidSegment(colorProfile.Value, machine.DefaultSegmentLength > 0 ? machine.DefaultSegmentLength : 100); } + if (twnFile != null) + { + job.Name = twnFile.Name; + job.NumberOfUnits = Math.Max(twnFile.NumberOfCopies, 1); + job.EmbroideryFileName = twnFile.Name + "." + twnFile.EmbroideryFileFormat; + job.EmbroideryFileData = twnFile.EmbroideryFile; + job.EmbroideryJpeg = twnFile.ThumbnailData; + + job.Segments.Clear(); + + int index = 1; + + foreach (var segment in twnFile.Segments) + { + Segment s = new Segment(); + s.Job = job; + s.SegmentIndex = index++; + s.Name = "Embroidery Segment"; + s.Length = segment.Length / 100d; + + int sIndex = 1; + + foreach (var stop in segment.BrushStops) + { + BrushStop st = new BrushStop(); + st.Segment = s; + st.StopIndex = sIndex++; + st.OffsetPercent = stop.Offset * 100d; + st.Red = stop.R; + st.Green = stop.G; + st.Blue = stop.B; + s.BrushStops.Add(st); + } + + job.Segments.Add(s); + } + } + _db.Jobs.Add(job); await _db.SaveChangesAsync(); @@ -621,6 +665,8 @@ namespace Tango.PPC.Jobs.ViewModels { base.OnApplicationReady(); StorageProvider.RegisterFileHandler(ExplorerFileDefinition.Job.Extension, HandleJobFileLoaded); + StorageProvider.RegisterFileHandler(ExplorerFileDefinition.ColorProfile.Extension, HandleColorProfileFileLoaded); + StorageProvider.RegisterFileHandler(ExplorerFileDefinition.Pulse.Extension, HandlePulseFileLoaded); } public override void OnNavigatedTo() @@ -714,6 +760,56 @@ namespace Tango.PPC.Jobs.ViewModels #endregion + #region Handle TCC File Loading From Storage + + private async void HandleColorProfileFileLoaded(ExplorerFileItem tccFile) + { + try + { + DetectionColorFile tcc = DetectionColorFile.Parser.ParseFrom(File.ReadAllBytes(tccFile.Path)); + + var vm = await NotificationProvider.ShowDialog(new ImportColorProfileViewVM() + { + Color = Color.FromRgb( + (byte)tcc.ProcessedColor.R, + (byte)tcc.ProcessedColor.G, + (byte)tcc.ProcessedColor.B), + }); + + if (vm.DialogResult) + { + AddNewJob(vm.Color); + } + } + catch (Exception ex) + { + LogManager.Log(ex, $"Error occurred while trying to import detection color from file {tccFile.Path}."); + await NotificationProvider.ShowError($"An error occurred while trying to import the selected detection color.\n{ex.Message}"); + } + } + + #endregion + + #region Handle Pulse TWN Loading From Storage + + private async void HandlePulseFileLoaded(ExplorerFileItem twnFile) + { + TwnFile twn = TwnFile.FromFile(twnFile.Path); + BitmapSource preview = twn.Thumbnail.ToBitmapSource(); + + var vm = await NotificationProvider.ShowDialog(new ImportTwnFileViewVM() + { + Thumbnail = preview, + }); + + if (vm.DialogResult) + { + AddNewJob(null, twn); + } + } + + #endregion + #region Color Profile Request private void ExternalBridgeService_ColorProfileRequest(object sender, ColorProfileRequestEventArgs e) 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 30a1a4a07..aa04398f1 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 @@ -166,7 +166,7 @@ - + diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest b/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest index d72e75011..efc5f8179 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest @@ -16,7 +16,7 @@ Remove this element if your application requires this virtualization for backwards compatibility. --> - + diff --git a/Software/Visual_Studio/Tango.Core/ExtensionMethods/ByteArrayExtensions.cs b/Software/Visual_Studio/Tango.Core/ExtensionMethods/ByteArrayExtensions.cs new file mode 100644 index 000000000..27a05c39d --- /dev/null +++ b/Software/Visual_Studio/Tango.Core/ExtensionMethods/ByteArrayExtensions.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Media.Imaging; + +public static class ByteArrayExtensions +{ + /// + /// Creates a new BitmapImage from the byte array. + /// + /// The image data. + /// + private static BitmapImage ToBitmapImage(this byte[] data) + { + if (data == null || data.Length == 0) return null; + var image = new BitmapImage(); + using (var mem = new MemoryStream(data)) + { + mem.Position = 0; + image.BeginInit(); + image.CreateOptions = BitmapCreateOptions.PreservePixelFormat; + image.CacheOption = BitmapCacheOption.OnLoad; + image.UriSource = null; + image.StreamSource = mem; + image.EndInit(); + } + image.Freeze(); + return image; + } +} diff --git a/Software/Visual_Studio/Tango.Core/Tango.Core.csproj b/Software/Visual_Studio/Tango.Core/Tango.Core.csproj index 963ec0b79..8d762ee55 100644 --- a/Software/Visual_Studio/Tango.Core/Tango.Core.csproj +++ b/Software/Visual_Studio/Tango.Core/Tango.Core.csproj @@ -86,6 +86,7 @@ GlobalVersionInfo.cs + @@ -196,7 +197,7 @@ - + diff --git a/Software/Visual_Studio/Tango.Explorer/Images/color.png b/Software/Visual_Studio/Tango.Explorer/Images/color.png index 44ca22ae2..ead2991e0 100644 Binary files a/Software/Visual_Studio/Tango.Explorer/Images/color.png and b/Software/Visual_Studio/Tango.Explorer/Images/color.png differ diff --git a/Software/Visual_Studio/Tango.Pulse/TwnFile.cs b/Software/Visual_Studio/Tango.Pulse/TwnFile.cs index 75653c03e..40ee58476 100644 --- a/Software/Visual_Studio/Tango.Pulse/TwnFile.cs +++ b/Software/Visual_Studio/Tango.Pulse/TwnFile.cs @@ -52,6 +52,11 @@ namespace Tango.Pulse /// public Bitmap Thumbnail { get; set; } + /// + /// Gets or sets the thumbnail data. + /// + public byte[] ThumbnailData { get; set; } + /// /// Array of Brush Segment. The number of brush segments must be defined in the header. /// diff --git a/Software/Visual_Studio/Tango.Pulse/TwnFileReader.cs b/Software/Visual_Studio/Tango.Pulse/TwnFileReader.cs index 2efa94936..81fcf4519 100644 --- a/Software/Visual_Studio/Tango.Pulse/TwnFileReader.cs +++ b/Software/Visual_Studio/Tango.Pulse/TwnFileReader.cs @@ -64,6 +64,7 @@ namespace Tango.Pulse //pixels while maintaining aspect ratio. MemoryStream ms = new MemoryStream(reader.ReadBytes((int)thumbnail_size)); twnFile.Thumbnail = new Bitmap(ms); + twnFile.ThumbnailData = ms.ToArray(); //Array of Brush Segment. The number of brush segments must be defined in the header. diff --git a/Software/Visual_Studio/Tango.UnitTesting/Pulse/Pulse_TST.cs b/Software/Visual_Studio/Tango.UnitTesting/Pulse/Pulse_TST.cs index 073841997..65bb31208 100644 --- a/Software/Visual_Studio/Tango.UnitTesting/Pulse/Pulse_TST.cs +++ b/Software/Visual_Studio/Tango.UnitTesting/Pulse/Pulse_TST.cs @@ -82,5 +82,47 @@ namespace Tango.UnitTesting.Pulse Helper.ShowInExplorer(imgFile); } + + [TestMethod] + public void Create_Twn_Sample_File() + { + String abcFile = Path.Combine(Helper.GetResourcePath(), "Pulse", "ABC.dst"); + + TwnFile twnFile = new TwnFile(); + twnFile.Name = "My design"; + twnFile.NumberOfCopies = 1; + twnFile.MediaID = 0; + twnFile.SpoolingMethod = SpoolingMethods.SpoolPerSegment; + + Bitmap thumbnail = new Bitmap(1280, 720); + using (Graphics g = Graphics.FromImage(thumbnail)) + { + g.Clear(Color.Gray); + g.DrawString("My design", new Font(new FontFamily("Arial"), 70), Brushes.Red, 1280 / 2, 720 / 2); + } + twnFile.Thumbnail = thumbnail; + + twnFile.EmbroideryFileFormat = "dst"; + twnFile.EmbroideryFile = File.ReadAllBytes(abcFile); + + //Add gradient segment. + TwnSegment gradientSegment = new TwnSegment(); + gradientSegment.Length = 100 * 10; //10 meters. + gradientSegment.BrushStops.Add(new TwnStop(255, 0, 0, 0)); //0% + gradientSegment.BrushStops.Add(new TwnStop(0, 0, 255, 1)); //100% + twnFile.Segments.Add(gradientSegment); + + //Add solid segment. + TwnSegment solidSegment = new TwnSegment(); + solidSegment.Length = 100 * 20; //20 meters. + solidSegment.BrushStops.Add(new TwnStop(0, 255, 0, 0)); + twnFile.Segments.Add(solidSegment); + + var twnFilePath = TemporaryManager.Default.CreateFile(".twn"); + + twnFile.ToFile(twnFilePath); + + twnFilePath.Display(); + } } } -- cgit v1.3.1 From dad69951c0338be70949e823b1b0c321c862d3b9 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Tue, 14 May 2019 18:16:11 +0300 Subject: Implemented Display & Export embroidery file to storage on PPC. --- .../Android_Studio/ColorCapture/app/build.gradle | 2 +- Software/DB/PPC/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/PPC/Tango_log.ldf | Bin 53673984 -> 53673984 bytes Software/DB/TCC/TCC.mdf | Bin 8388608 -> 8388608 bytes Software/DB/TCC/TCC_log.ldf | Bin 8388608 -> 8388608 bytes .../Converters/JobToEmbroideryImageConverter.cs | 38 +++++++++ .../Modules/Tango.PPC.Jobs/Images/Embroider.png | Bin 0 -> 90271 bytes .../Modules/Tango.PPC.Jobs/Tango.PPC.Jobs.csproj | 3 +- .../Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs | 48 +++++++++++ .../Tango.PPC.Jobs/ViewModels/JobsViewVM.cs | 20 +++-- .../PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml | 21 +++++ .../Visual_Studio/Resources/Pulse/TCap/T-CAP.dst | Bin 0 -> 10737 bytes .../Visual_Studio/Resources/Pulse/TCap/T_Cap.png | Bin 0 -> 129303 bytes .../Resources/Pulse/TCap/T_Cap_Solid.png | Bin 0 -> 58648 bytes .../Pulse/TCap/T_Icon_embroidery_order.jpg | Bin 0 -> 405188 bytes .../Tango.UnitTesting/Pulse/Pulse_TST.cs | 94 +++++++++++++++++++++ 16 files changed, 216 insertions(+), 10 deletions(-) create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Converters/JobToEmbroideryImageConverter.cs create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/Embroider.png create mode 100644 Software/Visual_Studio/Resources/Pulse/TCap/T-CAP.dst create mode 100644 Software/Visual_Studio/Resources/Pulse/TCap/T_Cap.png create mode 100644 Software/Visual_Studio/Resources/Pulse/TCap/T_Cap_Solid.png create mode 100644 Software/Visual_Studio/Resources/Pulse/TCap/T_Icon_embroidery_order.jpg (limited to 'Software/Visual_Studio/Tango.UnitTesting') diff --git a/Software/Android_Studio/ColorCapture/app/build.gradle b/Software/Android_Studio/ColorCapture/app/build.gradle index 60fc89265..facd37772 100644 --- a/Software/Android_Studio/ColorCapture/app/build.gradle +++ b/Software/Android_Studio/ColorCapture/app/build.gradle @@ -23,7 +23,7 @@ android { buildTypes { debug { - buildConfigField "String", "WEB_SERVICE_ADDRESS", "\"http://192.168.1.229:45457/api/\"" + buildConfigField "String", "WEB_SERVICE_ADDRESS", "\"http://tcc.twine-srv.com/api/\"" buildConfigField "String", "WEB_SERVICE_APP_ID", "\"Tdf793i4ughsiduf8749509237885ehgfdlkghlT\"" } diff --git a/Software/DB/PPC/Tango.mdf b/Software/DB/PPC/Tango.mdf index 997a03f9d..3f9ba04a4 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 58b4d3b25..c0013d42f 100644 Binary files a/Software/DB/PPC/Tango_log.ldf and b/Software/DB/PPC/Tango_log.ldf differ diff --git a/Software/DB/TCC/TCC.mdf b/Software/DB/TCC/TCC.mdf index 0dbf598dc..9d9b81a3d 100644 Binary files a/Software/DB/TCC/TCC.mdf and b/Software/DB/TCC/TCC.mdf differ diff --git a/Software/DB/TCC/TCC_log.ldf b/Software/DB/TCC/TCC_log.ldf index f95b21cc9..8f059bbab 100644 Binary files a/Software/DB/TCC/TCC_log.ldf and b/Software/DB/TCC/TCC_log.ldf differ diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Converters/JobToEmbroideryImageConverter.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Converters/JobToEmbroideryImageConverter.cs new file mode 100644 index 000000000..fce5bedf6 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Converters/JobToEmbroideryImageConverter.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Data; +using Tango.BL.Entities; + +namespace Tango.PPC.Jobs.Converters +{ + public class JobToEmbroideryImageConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + Job job = value as Job; + + if (job != null && job.EmbroideryFileData != null) + { + try + { + return job.EmbroideryJpeg.ToBitmapSource(); + } + catch + { + return null; + } + } + + return null; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/Embroider.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/Embroider.png new file mode 100644 index 000000000..f71bc2a70 Binary files /dev/null and b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/Embroider.png differ diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Tango.PPC.Jobs.csproj b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Tango.PPC.Jobs.csproj index b24313bbb..bbfef32fd 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Tango.PPC.Jobs.csproj +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Tango.PPC.Jobs.csproj @@ -172,6 +172,7 @@ + @@ -448,7 +449,7 @@ - + \ No newline at end of file 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 edcc741e6..1e18fb14c 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 @@ -34,6 +34,9 @@ using Tango.PPC.Jobs.AppButtons; using Tango.Core.Threading; using System.Diagnostics; using System.Runtime.ExceptionServices; +using Tango.Explorer; +using Tango.PPC.Storage; +using System.IO; namespace Tango.PPC.Jobs.ViewModels { @@ -306,6 +309,11 @@ namespace Tango.PPC.Jobs.ViewModels /// public RelayCommand RepeatFineTuningCommand { get; set; } + /// + /// Gets or sets the export embroidery command. + /// + public RelayCommand ExportEmbroideryCommand { get; set; } + #endregion #region Constructors @@ -385,6 +393,7 @@ namespace Tango.PPC.Jobs.ViewModels RepeatFineTuningCommand = new RelayCommand(RepeatFineTuning); ApproveFineTuningCommand = new RelayCommand(ApproveFineTuning); OpenTwineCatalogCommand = new RelayCommand(OpenTwineCatalog); + ExportEmbroideryCommand = new RelayCommand(ExportEmbroidery); } #endregion @@ -1146,6 +1155,45 @@ namespace Tango.PPC.Jobs.ViewModels #endregion + #region Export Embroidery + + private async void ExportEmbroidery() + { + try + { + if (!StorageProvider.IsConnected) + { + await NotificationProvider.ShowError("No storage device connected."); + return; + } + + var result = await NavigationManager. + NavigateForResult( + new Storage.Models.StorageNavigationRequest() + { + Intent = Storage.Models.StorageNavigationIntent.SaveFile, + DefaultFileName = Job.Name + Path.GetExtension(Job.EmbroideryFileName), + Filter = Path.GetExtension(Job.EmbroideryFileName), + Title = "Export Embroidery File", + }); + + if (result != null) + { + File.WriteAllBytes(Path.HasExtension(result.Path) ? result.Path : result.Path + Path.GetExtension(Job.EmbroideryFileName), Job.EmbroideryFileData); + await NotificationProvider.ShowSuccess("Embroidery file exported successfully."); + } + } + catch (Exception ex) + { + LogManager.Log(ex, "Error exporting embroidery file."); + await NotificationProvider.ShowError("An error occurred while trying to save the selected embroidery file."); + } + } + + #endregion + #region IPPC ViewModel Overrides /// 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 530eae385..08d135e21 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 @@ -422,15 +422,18 @@ namespace Tango.PPC.Jobs.ViewModels vm.SelectedJobType = vm.SupportedJobTypes.First(); } - if (machine.SupportedJobTypes.Count != 1 || machine.SupportedColorSpaces.Count != 1) + if (twnFile == null) { - vm = await NotificationProvider.ShowDialog(vm); - if (!vm.DialogResult) return; - } - else - { - vm.SelectedJobType = machine.SupportedJobTypes.First(); - vm.SelectedColorSpace = machine.SupportedColorSpaces.First(); + if (machine.SupportedJobTypes.Count != 1 || machine.SupportedColorSpaces.Count != 1) + { + vm = await NotificationProvider.ShowDialog(vm); + if (!vm.DialogResult) return; + } + else + { + vm.SelectedJobType = machine.SupportedJobTypes.First(); + vm.SelectedColorSpace = machine.SupportedColorSpaces.First(); + } } settings.LastJobType = vm.SelectedJobType; @@ -498,6 +501,7 @@ namespace Tango.PPC.Jobs.ViewModels st.Red = stop.R; st.Green = stop.G; st.Blue = stop.B; + st.ColorSpaceGuid = job.ColorSpaceGuid; s.BrushStops.Add(st); } 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 aa04398f1..39a333a3d 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 @@ -22,6 +22,7 @@ + @@ -624,6 +625,26 @@ + + + + + Embroidery File + + + + + + + + Export the attached embroidery file to storage. + EXPORT FILE + + + + + + diff --git a/Software/Visual_Studio/Resources/Pulse/TCap/T-CAP.dst b/Software/Visual_Studio/Resources/Pulse/TCap/T-CAP.dst new file mode 100644 index 000000000..3c89d3b99 Binary files /dev/null and b/Software/Visual_Studio/Resources/Pulse/TCap/T-CAP.dst differ diff --git a/Software/Visual_Studio/Resources/Pulse/TCap/T_Cap.png b/Software/Visual_Studio/Resources/Pulse/TCap/T_Cap.png new file mode 100644 index 000000000..3b221c76d Binary files /dev/null and b/Software/Visual_Studio/Resources/Pulse/TCap/T_Cap.png differ diff --git a/Software/Visual_Studio/Resources/Pulse/TCap/T_Cap_Solid.png b/Software/Visual_Studio/Resources/Pulse/TCap/T_Cap_Solid.png new file mode 100644 index 000000000..9bad2fb00 Binary files /dev/null and b/Software/Visual_Studio/Resources/Pulse/TCap/T_Cap_Solid.png differ diff --git a/Software/Visual_Studio/Resources/Pulse/TCap/T_Icon_embroidery_order.jpg b/Software/Visual_Studio/Resources/Pulse/TCap/T_Icon_embroidery_order.jpg new file mode 100644 index 000000000..6131f55f2 Binary files /dev/null and b/Software/Visual_Studio/Resources/Pulse/TCap/T_Icon_embroidery_order.jpg differ diff --git a/Software/Visual_Studio/Tango.UnitTesting/Pulse/Pulse_TST.cs b/Software/Visual_Studio/Tango.UnitTesting/Pulse/Pulse_TST.cs index 65bb31208..9951d8d10 100644 --- a/Software/Visual_Studio/Tango.UnitTesting/Pulse/Pulse_TST.cs +++ b/Software/Visual_Studio/Tango.UnitTesting/Pulse/Pulse_TST.cs @@ -124,5 +124,99 @@ namespace Tango.UnitTesting.Pulse twnFilePath.Display(); } + + [TestMethod] + public void Compose_Artificial_Twn_File() + { + String dstFile = Path.Combine(Helper.GetResourcePath(), "Pulse", "TCap", "T-CAP.dst"); + String imgSolidFile = Path.Combine(Helper.GetResourcePath(), "Pulse", "TCap", "T_Cap_Solid.png"); + String imgGradientFile = Path.Combine(Helper.GetResourcePath(), "Pulse", "TCap", "T_Cap.png"); + + TwnFile twnFile = new TwnFile(); + twnFile.Version = 1f; + twnFile.Name = "T Cap Solid"; + twnFile.NumberOfCopies = 1; + twnFile.MediaID = 0; + twnFile.SpoolingMethod = SpoolingMethods.SingleSpool; + + twnFile.EmbroideryFile = File.ReadAllBytes(dstFile); + twnFile.EmbroideryFileFormat = "dst"; + + + //Generate solid. + Bitmap thumbnail = new Bitmap(imgSolidFile); + twnFile.Thumbnail = thumbnail; + + twnFile.Segments.Add(CreateSolidSegment(10, 252, 224, 87)); + twnFile.Segments.Add(CreateSolidSegment(10, 251, 168, 45)); + twnFile.Segments.Add(CreateSolidSegment(10, 237, 19, 117)); + twnFile.Segments.Add(CreateSolidSegment(10, 234, 89, 56)); + + var tempFolder = TemporaryManager.Default.CreateFolder(); + twnFile.ToFile(Path.Combine(tempFolder, "t-cap solid.twn")); + + twnFile.Segments.Clear(); + + //Generate gradient. + twnFile.Name = "T Cap Gradient"; + + thumbnail = new Bitmap(imgGradientFile); + twnFile.Thumbnail = thumbnail; + + twnFile.Segments.Add(CreateGradientSegment(10, 237, 19, 117, 251, 168, 45)); + twnFile.Segments.Add(CreateGradientSegment(10, 237, 19, 117, 251, 168, 45)); + twnFile.Segments.Add(CreateGradientSegment(10, 139, 48, 145, 251, 168, 45)); + twnFile.Segments.Add(CreateGradientSegment(10, 139, 48, 145, 242, 141, 172)); + + twnFile.ToFile(Path.Combine(tempFolder, "t-cap gradient.twn")); + + tempFolder.Display(); + } + + private TwnSegment CreateSolidSegment(float meter, byte r, byte g, byte b) + { + var segment = new TwnSegment() + { + Length = meter * 100, + BrushStops = new List() + { + new TwnStop() + { + R = r, + G = g, + B = b + }, + } + }; + + return segment; + } + + private TwnSegment CreateGradientSegment(float meter, byte r1, byte g1, byte b1, byte r2, byte g2, byte b2) + { + var segment = new TwnSegment() + { + Length = meter * 100, + BrushStops = new List() + { + new TwnStop() + { + R = r1, + G = g1, + B = b1, + Offset = 0 + }, + new TwnStop() + { + R = r2, + G = g2, + B = b2, + Offset = 1 + }, + } + }; + + return segment; + } } } -- cgit v1.3.1 From 6cecbdc7b11836807bb53e6874b08dc06113ba18 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Wed, 15 May 2019 15:21:33 +0300 Subject: Added experimental perform CLAHE on color detector. --- Software/PMR/Messages/TCC/DetectionInput.proto | 2 +- Software/PMR/Messages/TCC/DetectionOutput.proto | 13 ++-- .../PPC Installer-cache/cacheIndex.txt | Bin 52 -> 52 bytes .../Advanced Installer Projects/PPC Installer.aip | 18 +++-- .../Models/CaptureConfig.cs | 7 ++ .../ViewModels/MainViewVM.cs | 7 +- .../Views/MainView.xaml | 8 ++- .../Views/MainView.xaml.cs | 47 ++++++++++-- .../PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs | 2 +- .../Visual_Studio/PPC/Tango.PPC.UI/app.manifest | 2 +- .../TCC/Tango.TCC.BL/CardDetectionConfig.cs | 1 + .../Visual_Studio/TCC/Tango.TCC.BL/CardDetector.cs | 11 +++ .../TCC/Tango.TCC.CardDetector/CardDetection.cpp | Bin 10390 -> 12212 bytes .../TCC/Tango.TCC.CardDetector/CardDetection.h | Bin 1240 -> 1310 bytes .../Tango.TCC.CardDetector/CardDetectionConfig.h | 1 + .../TCC/Tango.TCC.ColorDetector/ColorDetection.cpp | 65 +++++++++-------- .../TCC/Tango.TCC.ColorDetector/ColorDetection.h | 15 +++- .../PMR/TCC/DetectionInput.pb-c.c | 17 +++-- .../PMR/TCC/DetectionInput.pb-c.h | 4 +- .../PMR/TCC/DetectionOutput.pb-c.c | 43 ++++------- .../PMR/TCC/DetectionOutput.pb-c.h | 4 +- .../Controllers/ColorDetectionController.cs | 2 +- .../Visual_Studio/Tango.PMR/TCC/DetectionInput.cs | 45 ++++++------ .../Visual_Studio/Tango.PMR/TCC/DetectionOutput.cs | 80 +++++++-------------- .../Visual_Studio/Tango.UnitTesting/TCC/TCC_TST.cs | 3 - 25 files changed, 219 insertions(+), 178 deletions(-) (limited to 'Software/Visual_Studio/Tango.UnitTesting') diff --git a/Software/PMR/Messages/TCC/DetectionInput.proto b/Software/PMR/Messages/TCC/DetectionInput.proto index d9332bbd4..a59a45d0f 100644 --- a/Software/PMR/Messages/TCC/DetectionInput.proto +++ b/Software/PMR/Messages/TCC/DetectionInput.proto @@ -14,5 +14,5 @@ message DetectionInput bool RequestDebugImage = 5; bool RequestColorMatrix = 6; repeated DetectionBenchmark Benchmarks = 7; - double number = 10; + bool PerformCLAHE = 8; } \ No newline at end of file diff --git a/Software/PMR/Messages/TCC/DetectionOutput.proto b/Software/PMR/Messages/TCC/DetectionOutput.proto index cbd20ea52..55cf3608d 100644 --- a/Software/PMR/Messages/TCC/DetectionOutput.proto +++ b/Software/PMR/Messages/TCC/DetectionOutput.proto @@ -7,11 +7,10 @@ option java_package = "com.twine.tango.pmr.tcc"; message DetectionOutput { - double number = 1; - DetectionColor RawColor = 2; - DetectionColor ProcessedColor = 3; - bytes DebugBitmap = 4; - repeated DetectionColor ColorMatrix = 5; - bool HasError = 6; - string ErrorMessage = 7; + DetectionColor RawColor = 1; + DetectionColor ProcessedColor = 2; + bytes DebugBitmap = 3; + repeated DetectionColor ColorMatrix = 4; + bool HasError = 5; + string ErrorMessage = 6; } \ No newline at end of file diff --git a/Software/Visual_Studio/Advanced Installer Projects/PPC Installer-cache/cacheIndex.txt b/Software/Visual_Studio/Advanced Installer Projects/PPC Installer-cache/cacheIndex.txt index a603ff06b..6d87e9201 100644 Binary files a/Software/Visual_Studio/Advanced Installer Projects/PPC Installer-cache/cacheIndex.txt and b/Software/Visual_Studio/Advanced Installer Projects/PPC Installer-cache/cacheIndex.txt differ diff --git a/Software/Visual_Studio/Advanced Installer Projects/PPC Installer.aip b/Software/Visual_Studio/Advanced Installer Projects/PPC Installer.aip index 35eafa66e..424e66b4d 100644 --- a/Software/Visual_Studio/Advanced Installer Projects/PPC Installer.aip +++ b/Software/Visual_Studio/Advanced Installer Projects/PPC Installer.aip @@ -18,10 +18,10 @@ - + - + @@ -115,7 +115,6 @@ - @@ -212,13 +211,16 @@ + + + - + @@ -456,7 +458,7 @@ - + @@ -495,6 +497,9 @@ + + + @@ -510,7 +515,7 @@ - + @@ -577,7 +582,6 @@ - diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Models/CaptureConfig.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Models/CaptureConfig.cs index 0b74f2b3f..730665263 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Models/CaptureConfig.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Models/CaptureConfig.cs @@ -110,6 +110,13 @@ namespace Tango.MachineStudio.ColorCapture.Models set { _enforceBarcodeDetection = value; RaisePropertyChangedAuto(); } } + private bool _performCLAHE; + public bool PerformCLAHE + { + get { return _performCLAHE; } + set { _performCLAHE = value; RaisePropertyChangedAuto(); } + } + public CaptureConfig() { diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/ViewModels/MainViewVM.cs index 93fe776bc..2cf3ed63f 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/ViewModels/MainViewVM.cs @@ -548,6 +548,7 @@ namespace Tango.MachineStudio.ColorCapture.ViewModels HistogramMethod = Config.HistogramComparison, EnableDoubleChecking = Config.EnableDoubleChecking, EnforceBarcodeDetection = Config.EnforceBarcodeDetection, + PerformCLAHE = Config.PerformCLAHE, }); if (result.Similarity > 0) @@ -784,7 +785,11 @@ namespace Tango.MachineStudio.ColorCapture.ViewModels if (EmulatedColors != null) { var source = View.GetViewportImage(); - PerformDetection(source); + + if (source != null) + { + PerformDetection(source); + } } } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Views/MainView.xaml index bd26ff008..96e5fc488 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Views/MainView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Views/MainView.xaml @@ -48,7 +48,7 @@ - +