From 2b8e41b5279c2d3ab370595f6593b64ea734ef87 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Sun, 4 Mar 2018 15:28:15 +0200 Subject: Implemented job embroidery image capture, display export, Implemented running job text to speech. --- .../ViewModels/EmbroideryDisplayViewVM.cs | 38 +++++++++ .../ViewModels/MainViewVM.cs | 98 +++++++++++++++++++--- 2 files changed, 124 insertions(+), 12 deletions(-) create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/EmbroideryDisplayViewVM.cs (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels') diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/EmbroideryDisplayViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/EmbroideryDisplayViewVM.cs new file mode 100644 index 000000000..74cb2ffa6 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/EmbroideryDisplayViewVM.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL.Entities; +using Tango.Core.Commands; +using Tango.MachineStudio.Common.Notifications; +using Tango.SharedUI; + +namespace Tango.MachineStudio.Developer.ViewModels +{ + public class EmbroideryDisplayViewVM : DialogViewVM + { + private Job _job; + + public Job Job + { + get { return _job; } + set { _job = value; RaisePropertyChangedAuto(); } + } + + public RelayCommand ExportCommand { get; set; } + + public EmbroideryDisplayViewVM() + { + ExportCommand = new RelayCommand(() => + { + Accept(); + }); + } + + public EmbroideryDisplayViewVM(Job job) : this() + { + Job = job; + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs index c265c7d25..76fe33a87 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs @@ -28,6 +28,11 @@ using Tango.BL; using Microsoft.Win32; using Tango.PMR.Embroidery; using Tango.EmbroideryUI; +using System.IO; +using System.Windows; +using Tango.Core.Helpers; +using System.Speech.Synthesis; +using System.Media; namespace Tango.MachineStudio.Developer.ViewModels { @@ -38,7 +43,8 @@ namespace Tango.MachineStudio.Developer.ViewModels public class MainViewVM : ViewModel, IShutdownRequestBlocker, IShutdownListener { private static object _syncLock = new object(); - private const string EMB_FORMATS = "Embroidery Files|*.pes;*.hus"; + private const string EMB_FORMATS_EXPORT = "Baby Lock (PES)|*.pes|Tajima (DST)|*.dst|EXP|*.exp|PCS|*.pcs|HUS|*.hus|KSM|*.ksm"; + private const string EMB_FORMATS_IMPORT = "Embroidery Files|*.pes;*.hus;*.dst"; private INotificationProvider _notification; private TimeSpan _runningJobEstimatedDuration; @@ -49,6 +55,8 @@ namespace Tango.MachineStudio.Developer.ViewModels private ObservablesContext _machineDbContext; private ObservablesContext _activeJobDbContext; private LogManager LogManager = LogManager.Default; + private SpeechSynthesizer _speech; + private SoundPlayer _soundPlayer; #region Properties @@ -577,6 +585,10 @@ namespace Tango.MachineStudio.Developer.ViewModels /// public RelayCommand ImportEmbroideryFileCommand { get; set; } + /// + /// Gets or sets the display job embroidery file command. + /// + public RelayCommand DisplayJobEmbroideryFileCommand { get; set; } #endregion #region Constructors @@ -625,6 +637,10 @@ namespace Tango.MachineStudio.Developer.ViewModels LogManager.Log("Initializing relay commands..."); + _speech = new SpeechSynthesizer(); + _soundPlayer = new SoundPlayer(EmbeddedResourceHelper.GetEmbeddedResourceStream("Tango.MachineStudio.Developer.bip.wav")); + _speech.SelectVoice(_speech.GetInstalledVoices().LastOrDefault(x => x.VoiceInfo.Gender == VoiceGender.Female).VoiceInfo.Name); + //Initialize Commands... EditMachineCommand = new RelayCommand(EditMachine, () => SelectedMachine != null); EditRMLCommand = new RelayCommand(EditRML, () => SelectedRML != null); @@ -648,6 +664,7 @@ namespace Tango.MachineStudio.Developer.ViewModels SaveProcessParametersCommand = new RelayCommand(SaveProcessParameters, () => SelectedRML != null && SelectedRML.ProcessParametersTablesGroups.Count > 0); PushProcessParametersCommand = new RelayCommand(PushProcessParameters, () => SelectedRML != null && SelectedRML.ProcessParametersTablesGroups.Count > 0 && SelectedProcessParametersTable != null && MachineOperator != null); ImportEmbroideryFileCommand = new RelayCommand(ImportEmbroideryFile, () => SelectedMachine != null); + DisplayJobEmbroideryFileCommand = new RelayCommand(DisplayJobEmbroideryFile); ApplicationManager.ConnectedMachineChanged += ApplicationManager_ConnectedMachineChanged; } @@ -891,6 +908,9 @@ namespace Tango.MachineStudio.Developer.ViewModels LogManager.Log("Setting job failed state..."); IsJobRunning = false; IsJobFailed = true; + + _soundPlayer.Play(); + _speech.SpeakAsync("Job Failed!"); } /// @@ -901,6 +921,8 @@ namespace Tango.MachineStudio.Developer.ViewModels LogManager.Log("Setting job completed state..."); IsJobRunning = false; IsJobCompleted = true; + _soundPlayer.Play(); + _speech.SpeakAsync("Job Completed!"); } /// @@ -958,12 +980,27 @@ namespace Tango.MachineStudio.Developer.ViewModels } if (remaining < segmentDuration) { - segment.Started = true; + if (!segment.Started) + { + segment.Started = true; + _soundPlayer.Play(); + + if (segment.ID != -1) + { + _speech.SpeakAsync(String.Format("Segment {0} Started.", segment.SegmentIndex)); + } + else + { + _speech.SpeakAsync(String.Format("Inter Segment Started.")); + } + } } if (remaining <= TimeSpan.Zero) { - segment.Completed = true; - segment.Started = false; + if (!segment.Completed) + { + segment.Completed = true; + } } } }; @@ -1020,6 +1057,7 @@ namespace Tango.MachineStudio.Developer.ViewModels segments.Add(new Segment() { Length = job.InterSegmentLength, + ID = -1, BrushStops = new System.Collections.ObjectModel.ObservableCollection() { new BrushStop() @@ -1588,18 +1626,20 @@ namespace Tango.MachineStudio.Developer.ViewModels { OpenFileDialog dlg = new OpenFileDialog(); dlg.Title = "Select embroidery file"; - dlg.Filter = EMB_FORMATS; - if (dlg.ShowDialog().Value) + dlg.Filter = EMB_FORMATS_IMPORT; + if (dlg.ShowDialogCenter()) { + var view = new EmbroideryImportView(); + _notification.ShowModalDialog( - new EmbroideryImportViewVM() { FileName = dlg.FileName }, + new EmbroideryImportViewVM() { FileName = dlg.FileName }, view, (vm) => { String jobName = _notification.ShowTextInput("Please provide a job name", "Name"); if (jobName != null) { - AddJobFromEmbroideryFile(jobName, vm.Paths.ToList(), vm.EmbroideryFile); + AddJobFromEmbroideryFile(jobName, vm.Paths.ToList(), vm.EmbroideryFile, dlg.FileName, view.EmbroideryImageBytes); } }, () => @@ -1609,7 +1649,7 @@ namespace Tango.MachineStudio.Developer.ViewModels } } - private async void AddJobFromEmbroideryFile(String jobName, List paths, EmbroideryFile embroideryFile) + private async void AddJobFromEmbroideryFile(String jobName, List paths, EmbroideryFile embroideryFile, String fileName, byte[] imageBytes) { LogManager.Log(String.Format("Adding new job from embroidery file {0}...", jobName)); @@ -1623,12 +1663,17 @@ namespace Tango.MachineStudio.Developer.ViewModels job.SpoolType = _machineDbContext.SpoolTypes.FirstOrDefault(); job.Machine = SelectedMachine; + job.EmbroideryFileName = Path.GetFileName(fileName); + job.EmbroideryFileData = File.ReadAllBytes(fileName); + job.EmbroideryJpeg = imageBytes; + job.HasEmbroideryFile = true; + foreach (var path in paths.Skip(1)) { Segment segment = new Segment(); segment.Length = path.Length / 1000d; segment.Name = "Embroidery Segment"; - segment.SegmentIndex = paths.IndexOf(path) + 1; + segment.SegmentIndex = paths.IndexOf(path) + 2; if (path.Brush is SolidColorBrush) { @@ -1639,7 +1684,7 @@ namespace Tango.MachineStudio.Developer.ViewModels Red = brush.Color.R, Green = brush.Color.G, Blue = brush.Color.B, - ColorSpace = _machineDbContext.ColorSpaces.ToList().SingleOrDefault(x => x.Code == BL.Entities.ColorSpaces.RGB.ToInt32()), + ColorSpace = _machineDbContext.ColorSpaces.ToList().SingleOrDefault(x => x.Code == BL.Enumerations.ColorSpaces.RGB.ToInt32()), }); } else @@ -1655,7 +1700,7 @@ namespace Tango.MachineStudio.Developer.ViewModels Green = stop.Color.G, Blue = stop.Color.B, OffsetPercent = stop.Offset, - ColorSpace = _machineDbContext.ColorSpaces.ToList().SingleOrDefault(x => x.Code == BL.Entities.ColorSpaces.RGB.ToInt32()), + ColorSpace = _machineDbContext.ColorSpaces.ToList().SingleOrDefault(x => x.Code == BL.Enumerations.ColorSpaces.RGB.ToInt32()), }); } } @@ -1670,6 +1715,35 @@ namespace Tango.MachineStudio.Developer.ViewModels LoadSelectedJob(); } + private void DisplayJobEmbroideryFile(Job job) + { + _notification.ShowModalDialog(new EmbroideryDisplayViewVM(job), (vm) => + { + + SaveFileDialog dlg = new SaveFileDialog(); + dlg.Title = "Select embroidery file location and format"; + dlg.Filter = EMB_FORMATS_EXPORT; + dlg.FileName = job.EmbroideryFileName; + if (dlg.ShowDialogCenter()) + { + try + { + String tempPath = PathHelper.GetTempFolderPath(); + String filePath = Path.Combine(tempPath, job.EmbroideryFileName); + File.WriteAllBytes(filePath, job.EmbroideryFileData); + EmbroideryFileConverter.ConvertEmbroideryFile(filePath, dlg.FileName); + _notification.ShowInfo("Embroidery file exported successfully."); + } + catch (Exception ex) + { + LogManager.Log(ex, "An error has occurred while trying to export the attached embroidery file."); + _notification.ShowError("An error has occurred while trying to export the attached embroidery file."); + } + } + + }, () => { }); + } + #endregion #region Override Methods -- cgit v1.3.1 From 8e2cbf02b6c819e92ee4eec2a673586438edfa93 Mon Sep 17 00:00:00 2001 From: Roy Date: Mon, 5 Mar 2018 09:12:59 +0200 Subject: Some work on embroidery import/export. --- Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 1048576 -> 1048576 bytes .../EmbroideryFileEditor.xaml.cs | 1 + .../Tango.EmbroideryUI/EmbroideryPath.cs | 8 +++++++- .../Images/seamless-grid.jpg | Bin 0 -> 12022 bytes .../Tango.MachineStudio.Developer.csproj | 3 +++ .../ViewModels/EmbroideryImportViewVM.cs | 9 +++++++++ .../ViewModels/MainViewVM.cs | 6 +++--- .../Views/EmbroideryDisplayView.xaml | 10 ++++++++-- .../Views/EmbroideryImportView.xaml | 16 ++++++++++++++-- .../Views/EmbroideryImportView.xaml.cs | 2 +- .../Views/MachineJobSelectionView.xaml | 4 ++-- .../Tango.BL/ObservablesEntitiesAdapter.cs | 2 +- 13 files changed, 49 insertions(+), 12 deletions(-) create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/seamless-grid.jpg (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels') diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index fa3574dc5..ce28c30c9 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 553558665..db9c7db73 100644 Binary files a/Software/DB/Tango_log.ldf and b/Software/DB/Tango_log.ldf differ diff --git a/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/EmbroideryFileEditor.xaml.cs b/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/EmbroideryFileEditor.xaml.cs index 9d7475aea..1ed1e5b18 100644 --- a/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/EmbroideryFileEditor.xaml.cs +++ b/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/EmbroideryFileEditor.xaml.cs @@ -215,6 +215,7 @@ namespace Tango.EmbroideryUI { path.PathFigure.Segments.Add(new LineSegment(new Point(_currentPoint.X, _currentPoint.Y), true)); path.Length += Math.Abs(GetDistance(_lastStitch.XX, _lastStitch.YY, stitch.XX, stitch.YY)); + path.StitchCount++; } _mode = StitchFlag.Normal; break; diff --git a/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/EmbroideryPath.cs b/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/EmbroideryPath.cs index 385266228..5999845bf 100644 --- a/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/EmbroideryPath.cs +++ b/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/EmbroideryPath.cs @@ -37,7 +37,13 @@ namespace Tango.EmbroideryUI public static readonly DependencyProperty PathFigureProperty = DependencyProperty.Register("PathFigure", typeof(PathFigure), typeof(EmbroideryPath), new PropertyMetadata(null)); - + public int StitchCount + { + get { return (int)GetValue(StitchCountProperty); } + set { SetValue(StitchCountProperty, value); } + } + public static readonly DependencyProperty StitchCountProperty = + DependencyProperty.Register("StitchCount", typeof(int), typeof(EmbroideryPath), new PropertyMetadata(0)); private void OnBrushChanged() { diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/seamless-grid.jpg b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/seamless-grid.jpg new file mode 100644 index 000000000..59bb9c370 Binary files /dev/null and b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/seamless-grid.jpg differ diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj index 378fb443b..0e64872f7 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj @@ -353,5 +353,8 @@ + + + \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/EmbroideryImportViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/EmbroideryImportViewVM.cs index a0f4314dc..530893535 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/EmbroideryImportViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/EmbroideryImportViewVM.cs @@ -27,8 +27,17 @@ namespace Tango.MachineStudio.Developer.ViewModels public ObservableCollection Paths { get; set; } + private int _stitchLength; + + public int StitchLength + { + get { return _stitchLength; } + set { _stitchLength = value; RaisePropertyChangedAuto(); } + } + public EmbroideryImportViewVM() : base() { + StitchLength = 6; ImportCommand = new RelayCommand(Import); } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs index 76fe33a87..aef928486 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs @@ -1639,7 +1639,7 @@ namespace Tango.MachineStudio.Developer.ViewModels if (jobName != null) { - AddJobFromEmbroideryFile(jobName, vm.Paths.ToList(), vm.EmbroideryFile, dlg.FileName, view.EmbroideryImageBytes); + AddJobFromEmbroideryFile(jobName, vm.Paths.ToList(), vm.StitchLength, vm.EmbroideryFile, dlg.FileName, view.EmbroideryImageBytes); } }, () => @@ -1649,7 +1649,7 @@ namespace Tango.MachineStudio.Developer.ViewModels } } - private async void AddJobFromEmbroideryFile(String jobName, List paths, EmbroideryFile embroideryFile, String fileName, byte[] imageBytes) + private async void AddJobFromEmbroideryFile(String jobName, List paths, int stitchLength, EmbroideryFile embroideryFile, String fileName, byte[] imageBytes) { LogManager.Log(String.Format("Adding new job from embroidery file {0}...", jobName)); @@ -1671,7 +1671,7 @@ namespace Tango.MachineStudio.Developer.ViewModels foreach (var path in paths.Skip(1)) { Segment segment = new Segment(); - segment.Length = path.Length / 1000d; + segment.Length = ((double)path.StitchCount * (double)stitchLength) / 1000d; segment.Name = "Embroidery Segment"; segment.SegmentIndex = paths.IndexOf(path) + 2; diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/EmbroideryDisplayView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/EmbroideryDisplayView.xaml index a753453f9..22414b4b2 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/EmbroideryDisplayView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/EmbroideryDisplayView.xaml @@ -9,7 +9,7 @@ xmlns:converters="clr-namespace:Tango.MachineStudio.Developer.Converters" xmlns:local="clr-namespace:Tango.MachineStudio.Developer.Views" mc:Ignorable="d" - Width="600" Height="350" Background="White" d:DataContext="{d:DesignInstance Type=vm:EmbroideryDisplayViewVM, IsDesignTimeCreatable=False}"> + Width="1280" Height="720" Background="White" d:DataContext="{d:DesignInstance Type=vm:EmbroideryDisplayViewVM, IsDesignTimeCreatable=False}"> @@ -33,12 +33,18 @@ + + + + + + - diff --git a/Software/Visual_Studio/Tango.BL/ObservablesEntitiesAdapter.cs b/Software/Visual_Studio/Tango.BL/ObservablesEntitiesAdapter.cs index 8e898ac18..770931309 100644 --- a/Software/Visual_Studio/Tango.BL/ObservablesEntitiesAdapter.cs +++ b/Software/Visual_Studio/Tango.BL/ObservablesEntitiesAdapter.cs @@ -158,7 +158,7 @@ namespace Tango.BL foreach (var machine in Machines) { machine.MachinesConfigurations = machine.MachinesConfigurations.OrderByDescending(x => x.Configuration.CreationDate).Take(30).ToObservableCollection(); - machine.Jobs = machine.Jobs.OrderByDescending(x => x.CreationDate).ToObservableCollection(); + //machine.Jobs = machine.Jobs.OrderByDescending(x => x.CreationDate).ToObservableCollection(); //No need to load jobs. } MachinesConfigurations = Context.MachinesConfigurations.ToObservableCollection(); -- cgit v1.3.1 From 4a9f241ed8230586242621795f76aa0add9f6008 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Mon, 5 Mar 2018 11:35:46 +0200 Subject: Started implementing color lab module. --- Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 1048576 -> 1048576 bytes Software/Graphics/color-lab.jpg | Bin 0 -> 79639 bytes .../Tango.MachineStudio.ColorLab/ColorLabModule.cs | 62 ++++++ .../Images/color-lab.jpg | Bin 0 -> 79639 bytes .../Properties/AssemblyInfo.cs | 18 ++ .../Properties/Resources.Designer.cs | 62 ++++++ .../Properties/Resources.resx | 117 ++++++++++ .../Properties/Settings.Designer.cs | 30 +++ .../Properties/Settings.settings | 7 + .../Tango.MachineStudio.ColorLab.csproj | 129 +++++++++++ .../Views/MainView.xaml | 12 + .../Views/MainView.xaml.cs | 28 +++ .../ViewModels/MainViewVM.cs | 2 +- .../Tango.MachineStudio.UI.csproj | 4 + .../Tango.MachineStudio.UI/Views/MainView.xaml | 3 +- .../Tango.BL/ObservablesEntitiesAdapter.cs | 246 +++++++++++---------- Software/Visual_Studio/Tango.sln | 35 ++- 18 files changed, 633 insertions(+), 122 deletions(-) create mode 100644 Software/Graphics/color-lab.jpg create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ColorLabModule.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Images/color-lab.jpg create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Properties/AssemblyInfo.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Properties/Resources.Designer.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Properties/Resources.resx create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Properties/Settings.Designer.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Properties/Settings.settings create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Tango.MachineStudio.ColorLab.csproj create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Views/MainView.xaml create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Views/MainView.xaml.cs (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels') diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index ce28c30c9..2a2bb2670 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 db9c7db73..fb985a544 100644 Binary files a/Software/DB/Tango_log.ldf and b/Software/DB/Tango_log.ldf differ diff --git a/Software/Graphics/color-lab.jpg b/Software/Graphics/color-lab.jpg new file mode 100644 index 000000000..f0f608a6a Binary files /dev/null and b/Software/Graphics/color-lab.jpg differ diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ColorLabModule.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ColorLabModule.cs new file mode 100644 index 000000000..41cd13cc4 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ColorLabModule.cs @@ -0,0 +1,62 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Media.Imaging; +using Tango.BL.Enumerations; +using Tango.MachineStudio.ColorLab.Views; +using Tango.MachineStudio.Common; +using Tango.SharedUI.Helpers; + +namespace Tango.MachineStudio.ColorLab +{ + public class ColorLabModule : StudioModuleBase + { + public override string Name + { + get + { + return "Color Lab"; + } + } + + public override string Description + { + get + { + return "Color adjustment and calibration algorithms testing environment."; + } + } + + public override BitmapSource Image + { + get + { + return ResourceHelper.GetImageFromResources("Images/color-lab.jpg"); + } + } + + public override FrameworkElement MainView + { + get + { + return new MainView(); + } + } + + public override Permissions Permission + { + get + { + return Permissions.RunDeveloperModule; + } + } + + public override void Dispose() + { + + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Images/color-lab.jpg b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Images/color-lab.jpg new file mode 100644 index 000000000..f0f608a6a Binary files /dev/null and b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Images/color-lab.jpg differ diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Properties/AssemblyInfo.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..e62c20367 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Properties/AssemblyInfo.cs @@ -0,0 +1,18 @@ +using System.Reflection; +using System.Resources; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Windows; + +[assembly: AssemblyTitle("Tango - Machine Studio Color Lab Module")] + +[assembly: ComVisible(false)] + +[assembly:ThemeInfo( + ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located + //(used if a resource is not found in the page, + // or application resource dictionaries) + ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located + //(used if a resource is not found in the page, + // app, or any theme specific resource dictionaries) +)] diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Properties/Resources.Designer.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Properties/Resources.Designer.cs new file mode 100644 index 000000000..536f97b56 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Properties/Resources.Designer.cs @@ -0,0 +1,62 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Tango.MachineStudio.ColorLab.Properties { + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if ((resourceMan == null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Tango.MachineStudio.ColorLab.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Properties/Resources.resx b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Properties/Resources.resx new file mode 100644 index 000000000..af7dbebba --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Properties/Settings.Designer.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Properties/Settings.Designer.cs new file mode 100644 index 000000000..1d914d2b6 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Tango.MachineStudio.ColorLab.Properties +{ + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Properties/Settings.settings b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Properties/Settings.settings new file mode 100644 index 000000000..033d7a5e9 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Tango.MachineStudio.ColorLab.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Tango.MachineStudio.ColorLab.csproj new file mode 100644 index 000000000..11a522b51 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Tango.MachineStudio.ColorLab.csproj @@ -0,0 +1,129 @@ + + + + + Debug + AnyCPU + {4D183ACA-552B-4135-AE81-7C5A8E5FC3B1} + library + Tango.MachineStudio.ColorLab + Tango.MachineStudio.ColorLab + v4.6 + 512 + {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 4 + + + true + full + false + ..\..\..\Build\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + 4.0 + + + + + + + + GlobalVersionInfo.cs + + + MainView.xaml + + + + + + Code + + + True + True + Resources.resx + + + True + Settings.settings + True + + + ResXFileCodeGenerator + Resources.Designer.cs + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + + + {f441feee-322a-4943-b566-110e12fd3b72} + Tango.BL + + + {40085232-aced-4cbe-945b-90ba8153c151} + Tango.BrushPicker + + + {a2f5af44-29ff-45d6-9d25-ecda5cce88b5} + Tango.ColorPicker + + + {a34ee0f0-649d-41c8-8489-b6f1cc6924ee} + Tango.Core + + + {bc932dbd-7cdb-488c-99e4-f02cf441f55e} + Tango.Logging + + + {e4927038-348d-4295-aaf4-861c58cb3943} + Tango.PMR + + + {d8f1ad85-526a-4f50-b6dc-d437af63d8d8} + Tango.Settings + + + {8491d07b-c1f6-4b62-a412-41b9fd2d6538} + Tango.SharedUI + + + {cb0b0aa2-bb24-4bca-a720-45e397684e12} + Tango.MachineStudio.Common + + + + + Designer + MSBuild:Compile + + + + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Views/MainView.xaml new file mode 100644 index 000000000..a2bb7f1f2 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Views/MainView.xaml @@ -0,0 +1,12 @@ + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Views/MainView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Views/MainView.xaml.cs new file mode 100644 index 000000000..1a96386f6 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Views/MainView.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.MachineStudio.ColorLab.Views +{ + /// + /// Interaction logic for MainView.xaml + /// + public partial class MainView : UserControl + { + public MainView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs index aef928486..218733819 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs @@ -1671,7 +1671,7 @@ namespace Tango.MachineStudio.Developer.ViewModels foreach (var path in paths.Skip(1)) { Segment segment = new Segment(); - segment.Length = ((double)path.StitchCount * (double)stitchLength) / 1000d; + segment.Length = (path.Length / 1000d) * 2d; segment.Name = "Embroidery Segment"; segment.SegmentIndex = paths.IndexOf(path) + 2; diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj index dd534eba1..52bd44239 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj @@ -335,6 +335,10 @@ {74e700b0-1156-4126-be40-ee450d3c3026} Tango.Transport + + {4d183aca-552b-4135-ae81-7c5a8e5fc3b1} + Tango.MachineStudio.ColorLab + {fc337a7f-1214-41d8-9992-78092a3b961e} Tango.MachineStudio.DataCapture diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml index f2c9ddba5..a4256436c 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml @@ -293,13 +293,14 @@ - + + diff --git a/Software/Visual_Studio/Tango.BL/ObservablesEntitiesAdapter.cs b/Software/Visual_Studio/Tango.BL/ObservablesEntitiesAdapter.cs index 770931309..297de3b88 100644 --- a/Software/Visual_Studio/Tango.BL/ObservablesEntitiesAdapter.cs +++ b/Software/Visual_Studio/Tango.BL/ObservablesEntitiesAdapter.cs @@ -13,6 +13,7 @@ using System.Windows.Threading; using Tango.BL.Entities; using Tango.Core; using Tango.DAL.Remote.DB; +using Tango.Logging; using Tango.Settings; namespace Tango.BL @@ -115,205 +116,212 @@ namespace Tango.BL /// if set to true [initializing]. public void Invalidate(bool initializing = false) { - _syncLock = new object(); - - if (initializing) + try { - //Remove Unlinked Configurations.. - List remove_configurations = new List(); + _syncLock = new object(); - foreach (var config in Context.Configurations) + if (initializing) { - if (Context.MachineVersions.FirstOrDefault(x => x.DefaultConfigurationGuid == config.Guid) != null) - { - continue; - } + //Remove Unlinked Configurations.. + List remove_configurations = new List(); - if (Context.MachinesConfigurations.FirstOrDefault(x => x.ConfigurationGuid == config.Guid) != null) + foreach (var config in Context.Configurations) { - continue; + if (Context.MachineVersions.FirstOrDefault(x => x.DefaultConfigurationGuid == config.Guid) != null) + { + continue; + } + + if (Context.MachinesConfigurations.FirstOrDefault(x => x.ConfigurationGuid == config.Guid) != null) + { + continue; + } + + if (Context.Machines.FirstOrDefault(x => x.ConfigurationGuid == config.Guid) != null) + { + continue; + } + + remove_configurations.Add(config); } - if (Context.Machines.FirstOrDefault(x => x.ConfigurationGuid == config.Guid) != null) + foreach (var config in remove_configurations) { - continue; + Context.Configurations.Remove(config); } - remove_configurations.Add(config); - } - - foreach (var config in remove_configurations) - { - Context.Configurations.Remove(config); + Context.SaveChanges(); + //Remove Unlinked Configurations.. } - Context.SaveChanges(); - //Remove Unlinked Configurations.. - } - - Organizations = Context.Organizations.ToObservableCollection(); + Organizations = Context.Organizations.ToObservableCollection(); - Machines = Context.Machines.ToObservableCollection(); + Machines = Context.Machines.ToObservableCollection(); - foreach (var machine in Machines) - { - machine.MachinesConfigurations = machine.MachinesConfigurations.OrderByDescending(x => x.Configuration.CreationDate).Take(30).ToObservableCollection(); - //machine.Jobs = machine.Jobs.OrderByDescending(x => x.CreationDate).ToObservableCollection(); //No need to load jobs. - } + foreach (var machine in Machines) + { + machine.MachinesConfigurations = machine.MachinesConfigurations.OrderByDescending(x => x.Configuration.CreationDate).Take(30).ToObservableCollection(); + //machine.Jobs = machine.Jobs.OrderByDescending(x => x.CreationDate).ToObservableCollection(); //No need to load jobs. + } - MachinesConfigurations = Context.MachinesConfigurations.ToObservableCollection(); + MachinesConfigurations = Context.MachinesConfigurations.ToObservableCollection(); - MachineVersions = Context.MachineVersions.ToList().OrderBy(x => x.Version).ToObservableCollection(); + MachineVersions = Context.MachineVersions.ToList().OrderBy(x => x.Version).ToObservableCollection(); - Addresses = Context.Addresses.Where(x => !x.Deleted).ToList().OrderBy(x => x.AddressString).ToObservableCollection(); - Contacts = Context.Contacts.Where(x => !x.Deleted).ToList().OrderBy(x => x.FullName).ToObservableCollection(); + Addresses = Context.Addresses.Where(x => !x.Deleted).ToList().OrderBy(x => x.AddressString).ToObservableCollection(); + Contacts = Context.Contacts.Where(x => !x.Deleted).ToList().OrderBy(x => x.FullName).ToObservableCollection(); - Roles = Context.Roles.ToList().OrderBy(x => x.Name).ToObservableCollection(); + Roles = Context.Roles.ToList().OrderBy(x => x.Name).ToObservableCollection(); - Permissions = Context.Permissions.ToList().OrderBy(x => x.Name).ToObservableCollection(); + Permissions = Context.Permissions.ToList().OrderBy(x => x.Name).ToObservableCollection(); - UsersRoles = Context.UsersRoles.ToObservableCollection(); + UsersRoles = Context.UsersRoles.ToObservableCollection(); - Users = Context.Users.Where(x => !x.Deleted).ToList().OrderBy(x => x.Contact.FullName).ToObservableCollection(); + Users = Context.Users.Where(x => !x.Deleted).ToList().OrderBy(x => x.Contact.FullName).ToObservableCollection(); - //foreach (var user in Users) - //{ - // user.UsersRoles = user.UsersRoles.Where(x => !x.Deleted).ToObservableCollection(); - //} + //foreach (var user in Users) + //{ + // user.UsersRoles = user.UsersRoles.Where(x => !x.Deleted).ToObservableCollection(); + //} - foreach (var role in Roles) - { - role.RolesPermissions = role.RolesPermissions.ToObservableCollection(); - } + foreach (var role in Roles) + { + role.RolesPermissions = role.RolesPermissions.ToObservableCollection(); + } - Configurations = Context.Configurations.ToList().OrderBy(x => x.LastUpdated).ToObservableCollection(); + Configurations = Context.Configurations.ToList().OrderBy(x => x.LastUpdated).ToObservableCollection(); - foreach (var config in Configurations) - { - config.IdsPacks = config.IdsPacks.ToObservableCollection(); - } + foreach (var config in Configurations) + { + config.IdsPacks = config.IdsPacks.ToObservableCollection(); + } - ApplicationVersions = Context.ApplicationVersions.ToList().OrderBy(x => x.Version).ToObservableCollection(); + ApplicationVersions = Context.ApplicationVersions.ToList().OrderBy(x => x.Version).ToObservableCollection(); - ApplicationOsVersions = Context.ApplicationOsVersions.ToList().OrderBy(x => x.Version).ToObservableCollection(); + ApplicationOsVersions = Context.ApplicationOsVersions.ToList().OrderBy(x => x.Version).ToObservableCollection(); - ApplicationFirmwareVersions = Context.ApplicationFirmwareVersions.ToList().OrderBy(x => x.Version).ToObservableCollection(); + ApplicationFirmwareVersions = Context.ApplicationFirmwareVersions.ToList().OrderBy(x => x.Version).ToObservableCollection(); - ApplicationDisplayPanelVersions = Context.ApplicationDisplayPanelVersions.ToList().OrderBy(x => x.Version).ToObservableCollection(); + ApplicationDisplayPanelVersions = Context.ApplicationDisplayPanelVersions.ToList().OrderBy(x => x.Version).ToObservableCollection(); - EmbeddedFirmwareVersions = Context.EmbeddedFirmwareVersions.ToList().OrderBy(x => x.Version).ToObservableCollection(); + EmbeddedFirmwareVersions = Context.EmbeddedFirmwareVersions.ToList().OrderBy(x => x.Version).ToObservableCollection(); - EmbeddedSoftwareVersions = Context.EmbeddedSoftwareVersions.ToList().OrderBy(x => x.Version).ToObservableCollection(); + EmbeddedSoftwareVersions = Context.EmbeddedSoftwareVersions.ToList().OrderBy(x => x.Version).ToObservableCollection(); - HardwareVersions = Context.HardwareVersions.ToList().OrderBy(x => x.Version).ToObservableCollection(); + HardwareVersions = Context.HardwareVersions.ToList().OrderBy(x => x.Version).ToObservableCollection(); - IdsPacks = Context.IdsPacks.ToObservableCollection(); + IdsPacks = Context.IdsPacks.ToObservableCollection(); - DispenserTypes = Context.DispenserTypes.ToObservableCollection(); + DispenserTypes = Context.DispenserTypes.ToObservableCollection(); - LiquidTypes = Context.LiquidTypes.ToObservableCollection(); + LiquidTypes = Context.LiquidTypes.ToObservableCollection(); - CartridgeTypes = Context.CartridgeTypes.ToObservableCollection(); + CartridgeTypes = Context.CartridgeTypes.ToObservableCollection(); - MidTankTypes = Context.MidTankTypes.ToObservableCollection(); + MidTankTypes = Context.MidTankTypes.ToObservableCollection(); - ActionTypes = Context.ActionTypes.ToObservableCollection(); + ActionTypes = Context.ActionTypes.ToObservableCollection(); - EventTypesActions = Context.EventTypesActions.ToObservableCollection(); + EventTypesActions = Context.EventTypesActions.ToObservableCollection(); - EventTypes = Context.EventTypes.ToObservableCollection(); + EventTypes = Context.EventTypes.ToObservableCollection(); - foreach (var eventType in EventTypes) - { - eventType.EventTypesActions = eventType.EventTypesActions.ToObservableCollection(); - } + foreach (var eventType in EventTypes) + { + eventType.EventTypesActions = eventType.EventTypesActions.ToObservableCollection(); + } - MediaMaterials = Context.MediaMaterials.ToObservableCollection(); + MediaMaterials = Context.MediaMaterials.ToObservableCollection(); - MediaColors = Context.MediaColors.ToObservableCollection(); + MediaColors = Context.MediaColors.ToObservableCollection(); - MediaPurposes = Context.MediaPurposes.ToObservableCollection(); + MediaPurposes = Context.MediaPurposes.ToObservableCollection(); - MediaConditions = Context.MediaConditions.ToObservableCollection(); + MediaConditions = Context.MediaConditions.ToObservableCollection(); - LinearMassDensityUnits = Context.LinearMassDensityUnits.ToObservableCollection(); + LinearMassDensityUnits = Context.LinearMassDensityUnits.ToObservableCollection(); - FiberShapes = Context.FiberShapes.ToObservableCollection(); + FiberShapes = Context.FiberShapes.ToObservableCollection(); - FiberSynths = Context.FiberSynths.ToObservableCollection(); + FiberSynths = Context.FiberSynths.ToObservableCollection(); - Rmls = Context.Rmls.ToObservableCollection(); + Rmls = Context.Rmls.ToObservableCollection(); - LiquidTypesRmls = Context.LiquidTypesRmls.ToObservableCollection(); + LiquidTypesRmls = Context.LiquidTypesRmls.ToObservableCollection(); - Ccts = Context.Ccts.ToObservableCollection(); + Ccts = Context.Ccts.ToObservableCollection(); - Cats = Context.Cats.ToObservableCollection(); + Cats = Context.Cats.ToObservableCollection(); - ProcessParametersTables = Context.ProcessParametersTables.ToObservableCollection(); + ProcessParametersTables = Context.ProcessParametersTables.ToObservableCollection(); - ProcessParametersTablesGroups = Context.ProcessParametersTablesGroups.ToObservableCollection(); + ProcessParametersTablesGroups = Context.ProcessParametersTablesGroups.ToObservableCollection(); - foreach (var group in ProcessParametersTablesGroups) - { - group.ProcessParametersTables = group.ProcessParametersTables.OrderBy(x => x.TableIndex).ToObservableCollection(); - } + foreach (var group in ProcessParametersTablesGroups) + { + group.ProcessParametersTables = group.ProcessParametersTables.OrderBy(x => x.TableIndex).ToObservableCollection(); + } - WindingMethods = Context.WindingMethods.ToObservableCollection(); + WindingMethods = Context.WindingMethods.ToObservableCollection(); - TechMonitors = Context.TechMonitors.ToObservableCollection(); + TechMonitors = Context.TechMonitors.ToObservableCollection(); - TechMotors = Context.TechMotors.ToObservableCollection(); + TechMotors = Context.TechMotors.ToObservableCollection(); - TechDispensers = Context.TechDispensers.ToObservableCollection(); + TechDispensers = Context.TechDispensers.ToObservableCollection(); - TechValves = Context.TechValves.ToObservableCollection(); + TechValves = Context.TechValves.ToObservableCollection(); - TechIos = Context.TechIos.ToObservableCollection(); + TechIos = Context.TechIos.ToObservableCollection(); - TechHeaters = Context.TechHeaters.ToObservableCollection(); + TechHeaters = Context.TechHeaters.ToObservableCollection(); - IdsPackFormulas = Context.IdsPackFormulas.ToObservableCollection(); + IdsPackFormulas = Context.IdsPackFormulas.ToObservableCollection(); - ColorSpaces = Context.ColorSpaces.ToObservableCollection(); + ColorSpaces = Context.ColorSpaces.ToObservableCollection(); - HardwareDancerTypes = Context.HardwareDancerTypes.ToObservableCollection(); + HardwareDancerTypes = Context.HardwareDancerTypes.ToObservableCollection(); - HardwareDancers = Context.HardwareDancers.ToObservableCollection(); + HardwareDancers = Context.HardwareDancers.ToObservableCollection(); - HardwareMotorTypes = Context.HardwareMotorTypes.ToObservableCollection(); + HardwareMotorTypes = Context.HardwareMotorTypes.ToObservableCollection(); - HardwareMotors = Context.HardwareMotors.ToObservableCollection(); + HardwareMotors = Context.HardwareMotors.ToObservableCollection(); - HardwarePidControlTypes = Context.HardwarePidControlTypes.ToObservableCollection(); + HardwarePidControlTypes = Context.HardwarePidControlTypes.ToObservableCollection(); - HardwarePidControls = Context.HardwarePidControls.ToObservableCollection(); + HardwarePidControls = Context.HardwarePidControls.ToObservableCollection(); - HardwareWinderTypes = Context.HardwareWinderTypes.ToObservableCollection(); + HardwareWinderTypes = Context.HardwareWinderTypes.ToObservableCollection(); - HardwareWinders = Context.HardwareWinders.ToObservableCollection(); + HardwareWinders = Context.HardwareWinders.ToObservableCollection(); - _dispatcher = Application.Current.Dispatcher; + _dispatcher = Application.Current.Dispatcher; - _dispatcher.Invoke(() => - { - InitCollectionSources(); - }); + _dispatcher.Invoke(() => + { + InitCollectionSources(); + }); - //var action = ActionTypes.First(); + //var action = ActionTypes.First(); - //action.Name = "Action 1 Yesss"; + //action.Name = "Action 1 Yesss"; - //SaveChanges(); + //SaveChanges(); - //BindingOperations.EnableCollectionSynchronization(Machines, _syncLock); - //BindingOperations.EnableCollectionSynchronization(MachinesViewSource, _syncLock); + //BindingOperations.EnableCollectionSynchronization(Machines, _syncLock); + //BindingOperations.EnableCollectionSynchronization(MachinesViewSource, _syncLock); - //BindingOperations.EnableCollectionSynchronization(MachinesConfigurations, _syncLock); - //BindingOperations.EnableCollectionSynchronization(MachinesConfigurationsViewSource, _syncLock); + //BindingOperations.EnableCollectionSynchronization(MachinesConfigurations, _syncLock); + //BindingOperations.EnableCollectionSynchronization(MachinesConfigurationsViewSource, _syncLock); - //BindingOperations.EnableCollectionSynchronization(EventTypesActions, _syncLock); - //BindingOperations.EnableCollectionSynchronization(EventTypesActionsViewSource, _syncLock); + //BindingOperations.EnableCollectionSynchronization(EventTypesActions, _syncLock); + //BindingOperations.EnableCollectionSynchronization(EventTypesActionsViewSource, _syncLock); + } + catch (Exception ex) + { + throw LogManager.Default.Log(ex, "Error on observables entities adapter initialization."); + } } /// diff --git a/Software/Visual_Studio/Tango.sln b/Software/Visual_Studio/Tango.sln index bff1e877e..8973f3988 100644 --- a/Software/Visual_Studio/Tango.sln +++ b/Software/Visual_Studio/Tango.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 -VisualStudioVersion = 15.0.26430.14 +VisualStudioVersion = 15.0.26430.16 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tango.Protobuf", "Tango.Protobuf\Tango.Protobuf.csproj", "{40073806-914E-4E78-97AB-FA9639308EBE}" EndProject @@ -153,6 +153,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tango.EmbroideryUI", "Embro EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tango.BrushPicker", "Tango.BrushPicker\Tango.BrushPicker.csproj", "{40085232-ACED-4CBE-945B-90BA8153C151}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tango.MachineStudio.ColorLab", "MachineStudio\Modules\Tango.MachineStudio.ColorLab\Tango.MachineStudio.ColorLab.csproj", "{4D183ACA-552B-4135-AE81-7C5A8E5FC3B1}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -2008,6 +2010,36 @@ Global {40085232-ACED-4CBE-945B-90BA8153C151}.Release|x64.Build.0 = Release|Any CPU {40085232-ACED-4CBE-945B-90BA8153C151}.Release|x86.ActiveCfg = Release|Any CPU {40085232-ACED-4CBE-945B-90BA8153C151}.Release|x86.Build.0 = Release|Any CPU + {4D183ACA-552B-4135-AE81-7C5A8E5FC3B1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4D183ACA-552B-4135-AE81-7C5A8E5FC3B1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4D183ACA-552B-4135-AE81-7C5A8E5FC3B1}.Debug|ARM.ActiveCfg = Debug|Any CPU + {4D183ACA-552B-4135-AE81-7C5A8E5FC3B1}.Debug|ARM.Build.0 = Debug|Any CPU + {4D183ACA-552B-4135-AE81-7C5A8E5FC3B1}.Debug|ARM64.ActiveCfg = Debug|Any CPU + {4D183ACA-552B-4135-AE81-7C5A8E5FC3B1}.Debug|ARM64.Build.0 = Debug|Any CPU + {4D183ACA-552B-4135-AE81-7C5A8E5FC3B1}.Debug|x64.ActiveCfg = Debug|Any CPU + {4D183ACA-552B-4135-AE81-7C5A8E5FC3B1}.Debug|x64.Build.0 = Debug|Any CPU + {4D183ACA-552B-4135-AE81-7C5A8E5FC3B1}.Debug|x86.ActiveCfg = Debug|Any CPU + {4D183ACA-552B-4135-AE81-7C5A8E5FC3B1}.Debug|x86.Build.0 = Debug|Any CPU + {4D183ACA-552B-4135-AE81-7C5A8E5FC3B1}.DefaultBuild|Any CPU.ActiveCfg = Debug|Any CPU + {4D183ACA-552B-4135-AE81-7C5A8E5FC3B1}.DefaultBuild|Any CPU.Build.0 = Debug|Any CPU + {4D183ACA-552B-4135-AE81-7C5A8E5FC3B1}.DefaultBuild|ARM.ActiveCfg = Debug|Any CPU + {4D183ACA-552B-4135-AE81-7C5A8E5FC3B1}.DefaultBuild|ARM.Build.0 = Debug|Any CPU + {4D183ACA-552B-4135-AE81-7C5A8E5FC3B1}.DefaultBuild|ARM64.ActiveCfg = Debug|Any CPU + {4D183ACA-552B-4135-AE81-7C5A8E5FC3B1}.DefaultBuild|ARM64.Build.0 = Debug|Any CPU + {4D183ACA-552B-4135-AE81-7C5A8E5FC3B1}.DefaultBuild|x64.ActiveCfg = Debug|Any CPU + {4D183ACA-552B-4135-AE81-7C5A8E5FC3B1}.DefaultBuild|x64.Build.0 = Debug|Any CPU + {4D183ACA-552B-4135-AE81-7C5A8E5FC3B1}.DefaultBuild|x86.ActiveCfg = Debug|Any CPU + {4D183ACA-552B-4135-AE81-7C5A8E5FC3B1}.DefaultBuild|x86.Build.0 = Debug|Any CPU + {4D183ACA-552B-4135-AE81-7C5A8E5FC3B1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4D183ACA-552B-4135-AE81-7C5A8E5FC3B1}.Release|Any CPU.Build.0 = Release|Any CPU + {4D183ACA-552B-4135-AE81-7C5A8E5FC3B1}.Release|ARM.ActiveCfg = Release|Any CPU + {4D183ACA-552B-4135-AE81-7C5A8E5FC3B1}.Release|ARM.Build.0 = Release|Any CPU + {4D183ACA-552B-4135-AE81-7C5A8E5FC3B1}.Release|ARM64.ActiveCfg = Release|Any CPU + {4D183ACA-552B-4135-AE81-7C5A8E5FC3B1}.Release|ARM64.Build.0 = Release|Any CPU + {4D183ACA-552B-4135-AE81-7C5A8E5FC3B1}.Release|x64.ActiveCfg = Release|Any CPU + {4D183ACA-552B-4135-AE81-7C5A8E5FC3B1}.Release|x64.Build.0 = Release|Any CPU + {4D183ACA-552B-4135-AE81-7C5A8E5FC3B1}.Release|x86.ActiveCfg = Release|Any CPU + {4D183ACA-552B-4135-AE81-7C5A8E5FC3B1}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -2053,6 +2085,7 @@ Global {A37247ED-B26B-42EE-9F3B-EF0FDEB381F1} = {34839F9A-61D3-4ED3-B3F7-7DA3424CB0B6} {793FBFC1-549E-458B-A52F-784BD4F28586} = {5F6BBAA8-EAD0-4B18-97E5-55B4F56DD760} {BDBBE284-F564-4F51-AF41-3DF0434CEC62} = {34839F9A-61D3-4ED3-B3F7-7DA3424CB0B6} + {4D183ACA-552B-4135-AE81-7C5A8E5FC3B1} = {B2AF4F3F-2828-47C3-8F3E-A0EA0BD66FF8} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {7986F7F4-A86A-4994-B1B6-0988D7F057B6} -- cgit v1.3.1 From 628819a1787290f84c22ecc7cb747f649fd54468 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Mon, 5 Mar 2018 12:34:58 +0200 Subject: Added dynamic factoring for embroidery import thread length. --- Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 1048576 -> 1048576 bytes .../EmbroideryMaterialsHelper.cs | 23 +++++++++++ .../Tango.EmbroideryUI/IEmbroideryMaterial.cs | 15 +++++++ .../Tango.EmbroideryUI/Materials/Jersey.cs | 27 +++++++++++++ .../Tango.EmbroideryUI/Materials/Leather.cs | 27 +++++++++++++ .../Tango.EmbroideryUI/Materials/Linen.cs | 27 +++++++++++++ .../Tango.EmbroideryUI/Materials/Lycra.cs | 27 +++++++++++++ .../Tango.EmbroideryUI/Materials/Mesh.cs | 27 +++++++++++++ .../Tango.EmbroideryUI/Materials/MicroFiber.cs | 27 +++++++++++++ .../Tango.EmbroideryUI/Materials/Nylon.cs | 27 +++++++++++++ .../Tango.EmbroideryUI/Materials/Pique.cs | 27 +++++++++++++ .../Tango.EmbroideryUI/Materials/PolyCotton.cs | 27 +++++++++++++ .../Tango.EmbroideryUI/Materials/Polyester.cs | 27 +++++++++++++ .../Tango.EmbroideryUI/Materials/PureCotton.cs | 27 +++++++++++++ .../Tango.EmbroideryUI/Materials/Rayon.cs | 27 +++++++++++++ .../Tango.EmbroideryUI/Tango.EmbroideryUI.csproj | 14 +++++++ .../ViewModels/EmbroideryImportViewVM.cs | 43 ++++++++++++++++++--- .../ViewModels/MainViewVM.cs | 21 +++++++--- .../Views/EmbroideryImportView.xaml | 29 ++++++++++++-- 20 files changed, 456 insertions(+), 13 deletions(-) create mode 100644 Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/EmbroideryMaterialsHelper.cs create mode 100644 Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/IEmbroideryMaterial.cs create mode 100644 Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/Materials/Jersey.cs create mode 100644 Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/Materials/Leather.cs create mode 100644 Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/Materials/Linen.cs create mode 100644 Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/Materials/Lycra.cs create mode 100644 Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/Materials/Mesh.cs create mode 100644 Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/Materials/MicroFiber.cs create mode 100644 Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/Materials/Nylon.cs create mode 100644 Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/Materials/Pique.cs create mode 100644 Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/Materials/PolyCotton.cs create mode 100644 Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/Materials/Polyester.cs create mode 100644 Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/Materials/PureCotton.cs create mode 100644 Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/Materials/Rayon.cs (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels') diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index 2a2bb2670..eb37646b5 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 fb985a544..cb71621e6 100644 Binary files a/Software/DB/Tango_log.ldf and b/Software/DB/Tango_log.ldf differ diff --git a/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/EmbroideryMaterialsHelper.cs b/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/EmbroideryMaterialsHelper.cs new file mode 100644 index 000000000..86704a2fd --- /dev/null +++ b/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/EmbroideryMaterialsHelper.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.EmbroideryUI +{ + public static class EmbroideryMaterialsHelper + { + public static List GetAvailableEmbroideryMaterials() + { + List materials = new List(); + + foreach (var type in typeof(IEmbroideryMaterial).Assembly.GetTypes().Where(x => typeof(IEmbroideryMaterial).IsAssignableFrom(x) && !x.IsAbstract)) + { + materials.Add(Activator.CreateInstance(type) as IEmbroideryMaterial); + } + + return materials; + } + } +} diff --git a/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/IEmbroideryMaterial.cs b/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/IEmbroideryMaterial.cs new file mode 100644 index 000000000..e1d304086 --- /dev/null +++ b/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/IEmbroideryMaterial.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.EmbroideryUI +{ + public interface IEmbroideryMaterial + { + double Coefficient { get; } + + String Name { get; } + } +} diff --git a/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/Materials/Jersey.cs b/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/Materials/Jersey.cs new file mode 100644 index 000000000..004a67940 --- /dev/null +++ b/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/Materials/Jersey.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.EmbroideryUI.Materials +{ + public class Jersey : IEmbroideryMaterial + { + public double Coefficient + { + get + { + return 1; + } + } + + public string Name + { + get + { + return "Jersey"; + } + } + } +} diff --git a/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/Materials/Leather.cs b/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/Materials/Leather.cs new file mode 100644 index 000000000..5cf26d890 --- /dev/null +++ b/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/Materials/Leather.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.EmbroideryUI.Materials +{ + public class Leather : IEmbroideryMaterial + { + public double Coefficient + { + get + { + return 1; + } + } + + public string Name + { + get + { + return "Leather"; + } + } + } +} diff --git a/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/Materials/Linen.cs b/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/Materials/Linen.cs new file mode 100644 index 000000000..db7f2fcaa --- /dev/null +++ b/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/Materials/Linen.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.EmbroideryUI.Materials +{ + public class Linen : IEmbroideryMaterial + { + public double Coefficient + { + get + { + return 1; + } + } + + public string Name + { + get + { + return "Linen"; + } + } + } +} diff --git a/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/Materials/Lycra.cs b/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/Materials/Lycra.cs new file mode 100644 index 000000000..1e020d3f2 --- /dev/null +++ b/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/Materials/Lycra.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.EmbroideryUI.Materials +{ + public class Lycra : IEmbroideryMaterial + { + public double Coefficient + { + get + { + return 1; + } + } + + public string Name + { + get + { + return "Lycra"; + } + } + } +} diff --git a/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/Materials/Mesh.cs b/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/Materials/Mesh.cs new file mode 100644 index 000000000..e99dd4823 --- /dev/null +++ b/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/Materials/Mesh.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.EmbroideryUI.Materials +{ + public class Mesh : IEmbroideryMaterial + { + public double Coefficient + { + get + { + return 1; + } + } + + public string Name + { + get + { + return "Mesh"; + } + } + } +} diff --git a/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/Materials/MicroFiber.cs b/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/Materials/MicroFiber.cs new file mode 100644 index 000000000..51b16afe7 --- /dev/null +++ b/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/Materials/MicroFiber.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.EmbroideryUI.Materials +{ + public class MicroFiber : IEmbroideryMaterial + { + public double Coefficient + { + get + { + return 1; + } + } + + public string Name + { + get + { + return "Micro Fiber"; + } + } + } +} diff --git a/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/Materials/Nylon.cs b/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/Materials/Nylon.cs new file mode 100644 index 000000000..9cf33d1ee --- /dev/null +++ b/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/Materials/Nylon.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.EmbroideryUI.Materials +{ + public class Nylon : IEmbroideryMaterial + { + public double Coefficient + { + get + { + return 1; + } + } + + public string Name + { + get + { + return "Nylon"; + } + } + } +} diff --git a/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/Materials/Pique.cs b/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/Materials/Pique.cs new file mode 100644 index 000000000..1263b23d2 --- /dev/null +++ b/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/Materials/Pique.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.EmbroideryUI.Materials +{ + public class Pique : IEmbroideryMaterial + { + public double Coefficient + { + get + { + return 1; + } + } + + public string Name + { + get + { + return "Pique"; + } + } + } +} diff --git a/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/Materials/PolyCotton.cs b/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/Materials/PolyCotton.cs new file mode 100644 index 000000000..7dacaa945 --- /dev/null +++ b/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/Materials/PolyCotton.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.EmbroideryUI.Materials +{ + public class PolyCotton : IEmbroideryMaterial + { + public double Coefficient + { + get + { + return 1; + } + } + + public string Name + { + get + { + return "Poly Cotton"; + } + } + } +} diff --git a/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/Materials/Polyester.cs b/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/Materials/Polyester.cs new file mode 100644 index 000000000..7c915f138 --- /dev/null +++ b/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/Materials/Polyester.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.EmbroideryUI.Materials +{ + public class Polyester : IEmbroideryMaterial + { + public double Coefficient + { + get + { + return 1; + } + } + + public string Name + { + get + { + return "Polyester"; + } + } + } +} diff --git a/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/Materials/PureCotton.cs b/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/Materials/PureCotton.cs new file mode 100644 index 000000000..270756af2 --- /dev/null +++ b/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/Materials/PureCotton.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.EmbroideryUI.Materials +{ + public class PureCotton : IEmbroideryMaterial + { + public double Coefficient + { + get + { + return 1; + } + } + + public string Name + { + get + { + return "Pure Cotton"; + } + } + } +} diff --git a/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/Materials/Rayon.cs b/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/Materials/Rayon.cs new file mode 100644 index 000000000..e71258aba --- /dev/null +++ b/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/Materials/Rayon.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.EmbroideryUI.Materials +{ + public class Rayon : IEmbroideryMaterial + { + public double Coefficient + { + get + { + return 1; + } + } + + public string Name + { + get + { + return "Rayon"; + } + } + } +} diff --git a/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/Tango.EmbroideryUI.csproj b/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/Tango.EmbroideryUI.csproj index 9ef098618..11b779275 100644 --- a/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/Tango.EmbroideryUI.csproj +++ b/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/Tango.EmbroideryUI.csproj @@ -60,7 +60,21 @@ EmbroideryFileEditor.xaml + + + + + + + + + + + + + + Code diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/EmbroideryImportViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/EmbroideryImportViewVM.cs index 530893535..eaffab9e5 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/EmbroideryImportViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/EmbroideryImportViewVM.cs @@ -27,17 +27,50 @@ namespace Tango.MachineStudio.Developer.ViewModels public ObservableCollection Paths { get; set; } - private int _stitchLength; + public List EmbroideryMaterials { get; set; } - public int StitchLength + private IEmbroideryMaterial _selectedEmbroideryMaterial; + public IEmbroideryMaterial SelectedEmbroideryMaterial { - get { return _stitchLength; } - set { _stitchLength = value; RaisePropertyChangedAuto(); } + get { return _selectedEmbroideryMaterial; } + set { _selectedEmbroideryMaterial = value; RaisePropertyChangedAuto(); } + } + + private IEmbroideryMaterial _selectedStabilizer; + public IEmbroideryMaterial SelectedStabilizer + { + get { return _selectedStabilizer; } + set { _selectedStabilizer = value; RaisePropertyChangedAuto(); } + } + + private double _embroideryMaterialThickness; + public double EmbroideryMaterialThickness + { + get { return _embroideryMaterialThickness; } + set { _embroideryMaterialThickness = value; RaisePropertyChangedAuto(); } + } + + private double _stabilizerThickness; + public double StabilizerThickness + { + get { return _stabilizerThickness; } + set { _stabilizerThickness = value; RaisePropertyChangedAuto(); } + } + + private bool _hasStabilizer; + public bool HasStabilizer + { + get { return _hasStabilizer; } + set { _hasStabilizer = value; RaisePropertyChangedAuto(); } } public EmbroideryImportViewVM() : base() { - StitchLength = 6; + EmbroideryMaterials = EmbroideryMaterialsHelper.GetAvailableEmbroideryMaterials(); + SelectedEmbroideryMaterial = EmbroideryMaterials.FirstOrDefault(); + SelectedStabilizer = EmbroideryMaterials.FirstOrDefault(); + EmbroideryMaterialThickness = 1; + StabilizerThickness = 1; ImportCommand = new RelayCommand(Import); } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs index 218733819..566dc7a16 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs @@ -1639,7 +1639,7 @@ namespace Tango.MachineStudio.Developer.ViewModels if (jobName != null) { - AddJobFromEmbroideryFile(jobName, vm.Paths.ToList(), vm.StitchLength, vm.EmbroideryFile, dlg.FileName, view.EmbroideryImageBytes); + AddJobFromEmbroideryFile(jobName, vm, dlg.FileName, view.EmbroideryImageBytes); } }, () => @@ -1649,7 +1649,7 @@ namespace Tango.MachineStudio.Developer.ViewModels } } - private async void AddJobFromEmbroideryFile(String jobName, List paths, int stitchLength, EmbroideryFile embroideryFile, String fileName, byte[] imageBytes) + private async void AddJobFromEmbroideryFile(String jobName, EmbroideryImportViewVM vm, String fileName, byte[] imageBytes) { LogManager.Log(String.Format("Adding new job from embroidery file {0}...", jobName)); @@ -1668,12 +1668,23 @@ namespace Tango.MachineStudio.Developer.ViewModels job.EmbroideryJpeg = imageBytes; job.HasEmbroideryFile = true; - foreach (var path in paths.Skip(1)) + foreach (var path in vm.Paths.Skip(1)) { Segment segment = new Segment(); - segment.Length = (path.Length / 1000d) * 2d; + + double baseLength = path.Length / 1000d; + double embThicknessLength = (vm.EmbroideryMaterialThickness * path.StitchCount) / 1000d; + double stabilizerThicknessLength = (vm.StabilizerThickness * path.StitchCount) / 1000d; + double totalLength = (baseLength + embThicknessLength) * vm.SelectedEmbroideryMaterial.Coefficient; + + if (vm.HasStabilizer) + { + totalLength += (stabilizerThicknessLength * vm.SelectedStabilizer.Coefficient); + } + + segment.Length = totalLength; segment.Name = "Embroidery Segment"; - segment.SegmentIndex = paths.IndexOf(path) + 2; + segment.SegmentIndex = vm.Paths.IndexOf(path) + 2; if (path.Brush is SolidColorBrush) { diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/EmbroideryImportView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/EmbroideryImportView.xaml index 17a5a5b8c..42d0bb106 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/EmbroideryImportView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/EmbroideryImportView.xaml @@ -45,10 +45,33 @@ Region Brush - + + + - - + + + + + + + + + + + + + + + + + + + + + -- cgit v1.3.1