aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer
diff options
context:
space:
mode:
authorShlomo Hecht <shlomo@twine-s.com>2018-03-06 12:11:22 +0200
committerShlomo Hecht <shlomo@twine-s.com>2018-03-06 12:11:22 +0200
commit99715aa1c659a3d5d7709cb16d5dfe1b1c29a135 (patch)
treed003fe1c07117036039294ffc8b6ba51096938d4 /Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer
parentce68bf700e2e6535e1ed155fe2806c1ed6030edd (diff)
parent7e6c673cc8b04086fa3c78cd1bf5e31085fd8cc8 (diff)
downloadTango-99715aa1c659a3d5d7709cb16d5dfe1b1c29a135.tar.gz
Tango-99715aa1c659a3d5d7709cb16d5dfe1b1c29a135.zip
Merge branch 'master' of https://twinetfs.visualstudio.com/_git/Tango
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer')
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/ByteArrayToBitmapSourceConverter.cs29
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/DeveloperModule.cs1
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/job-emb.pngbin0 -> 1626 bytes
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/seamless-grid.jpgbin0 -> 12022 bytes
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj20
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/EmbroideryDisplayViewVM.cs38
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/EmbroideryImportViewVM.cs42
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs113
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/EmbroideryDisplayView.xaml57
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/EmbroideryDisplayView.xaml.cs28
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/EmbroideryImportView.xaml43
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/EmbroideryImportView.xaml.cs9
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml4
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MachineJobSelectionView.xaml27
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml4
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/bip.wavbin0 -> 161420 bytes
16 files changed, 390 insertions, 25 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/ByteArrayToBitmapSourceConverter.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/ByteArrayToBitmapSourceConverter.cs
new file mode 100644
index 000000000..d839b0060
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/ByteArrayToBitmapSourceConverter.cs
@@ -0,0 +1,29 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Data;
+
+namespace Tango.MachineStudio.Developer.Converters
+{
+ public class ByteArrayToBitmapSourceConverter : IValueConverter
+ {
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ byte[] bytes = value as byte[];
+ if (bytes != null)
+ {
+ return bytes.ToBitmapSource();
+ }
+
+ return value;
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/DeveloperModule.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/DeveloperModule.cs
index 0dc35e3bf..9ac8de012 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/DeveloperModule.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/DeveloperModule.cs
@@ -6,6 +6,7 @@ using System.Threading.Tasks;
using System.Windows;
using System.Windows.Media.Imaging;
using Tango.BL.Entities;
+using Tango.BL.Enumerations;
using Tango.MachineStudio.Common;
using Tango.MachineStudio.Developer.Views;
using Tango.SharedUI.Helpers;
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/job-emb.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/job-emb.png
new file mode 100644
index 000000000..15f9c73bb
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/job-emb.png
Binary files differ
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
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/seamless-grid.jpg
Binary files 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 7bf4d22cd..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
@@ -67,6 +67,7 @@
<Reference Include="System" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Data" />
+ <Reference Include="System.Drawing" />
<Reference Include="System.Reactive.Core, Version=3.0.3000.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\System.Reactive.Core.3.1.1\lib\net46\System.Reactive.Core.dll</HintPath>
</Reference>
@@ -82,6 +83,7 @@
<Reference Include="System.Reactive.Windows.Threading, Version=3.0.1000.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\System.Reactive.Windows.Threading.3.1.1\lib\net45\System.Reactive.Windows.Threading.dll</HintPath>
</Reference>
+ <Reference Include="System.Speech" />
<Reference Include="System.Windows" />
<Reference Include="System.Windows.Interactivity, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\MvvmLightLibs.5.3.0.0\lib\net45\System.Windows.Interactivity.dll</HintPath>
@@ -105,6 +107,7 @@
<Compile Include="Converters\BrushStopToColorConverter.cs" />
<Compile Include="Converters\BrushStopToOffsetLimitConverter.cs" />
<Compile Include="Converters\BrushStopToOffsetValueConverter.cs" />
+ <Compile Include="Converters\ByteArrayToBitmapSourceConverter.cs" />
<Compile Include="Converters\InkVolumeToLiquidRmlFactor.cs" />
<Compile Include="Converters\JobProgressToPositionConverter.cs" />
<Compile Include="Converters\JobToColumnDefinitionsConverter.cs" />
@@ -120,8 +123,12 @@
<Compile Include="Navigation\DeveloperNavigationManager.cs" />
<Compile Include="Navigation\DeveloperNavigationView.cs" />
<Compile Include="ViewModelLocator.cs" />
+ <Compile Include="ViewModels\EmbroideryDisplayViewVM.cs" />
<Compile Include="ViewModels\EmbroideryImportViewVM.cs" />
<Compile Include="ViewModels\MainViewVM.cs" />
+ <Compile Include="Views\EmbroideryDisplayView.xaml.cs">
+ <DependentUpon>EmbroideryDisplayView.xaml</DependentUpon>
+ </Compile>
<Compile Include="Views\EmbroideryImportView.xaml.cs">
<DependentUpon>EmbroideryImportView.xaml</DependentUpon>
</Compile>
@@ -141,6 +148,10 @@
<Compile Include="Views\RunningJobView.xaml.cs">
<DependentUpon>RunningJobView.xaml</DependentUpon>
</Compile>
+ <Page Include="Views\EmbroideryDisplayView.xaml">
+ <SubType>Designer</SubType>
+ <Generator>MSBuild:Compile</Generator>
+ </Page>
<Page Include="Views\EmbroideryImportView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
@@ -336,5 +347,14 @@
<ItemGroup>
<Resource Include="Images\sewing-machine.png" />
</ItemGroup>
+ <ItemGroup>
+ <Resource Include="Images\job-emb.png" />
+ </ItemGroup>
+ <ItemGroup>
+ <EmbeddedResource Include="bip.wav" />
+ </ItemGroup>
+ <ItemGroup>
+ <Resource Include="Images\seamless-grid.jpg" />
+ </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project> \ No newline at end of file
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/EmbroideryImportViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/EmbroideryImportViewVM.cs
index a0f4314dc..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,8 +27,50 @@ namespace Tango.MachineStudio.Developer.ViewModels
public ObservableCollection<EmbroideryPath> Paths { get; set; }
+ public List<IEmbroideryMaterial> EmbroideryMaterials { get; set; }
+
+ private IEmbroideryMaterial _selectedEmbroideryMaterial;
+ public IEmbroideryMaterial SelectedEmbroideryMaterial
+ {
+ 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()
{
+ 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 c265c7d25..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
@@ -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<IMainView>, 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
/// </summary>
public RelayCommand ImportEmbroideryFileCommand { get; set; }
+ /// <summary>
+ /// Gets or sets the display job embroidery file command.
+ /// </summary>
+ public RelayCommand<Job> 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<Job>(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!");
}
/// <summary>
@@ -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!");
}
/// <summary>
@@ -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<BrushStop>()
{
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<EmbroideryImportViewVM, EmbroideryImportView>(
- 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, dlg.FileName, view.EmbroideryImageBytes);
}
},
() =>
@@ -1609,7 +1649,7 @@ namespace Tango.MachineStudio.Developer.ViewModels
}
}
- private async void AddJobFromEmbroideryFile(String jobName, List<EmbroideryPath> paths, EmbroideryFile embroideryFile)
+ private async void AddJobFromEmbroideryFile(String jobName, EmbroideryImportViewVM vm, String fileName, byte[] imageBytes)
{
LogManager.Log(String.Format("Adding new job from embroidery file {0}...", jobName));
@@ -1623,12 +1663,28 @@ namespace Tango.MachineStudio.Developer.ViewModels
job.SpoolType = _machineDbContext.SpoolTypes.FirstOrDefault();
job.Machine = SelectedMachine;
- foreach (var path in paths.Skip(1))
+ job.EmbroideryFileName = Path.GetFileName(fileName);
+ job.EmbroideryFileData = File.ReadAllBytes(fileName);
+ job.EmbroideryJpeg = imageBytes;
+ job.HasEmbroideryFile = true;
+
+ foreach (var path in vm.Paths.Skip(1))
{
Segment segment = new Segment();
- segment.Length = path.Length / 1000d;
+
+ 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) + 1;
+ segment.SegmentIndex = vm.Paths.IndexOf(path) + 2;
if (path.Brush is SolidColorBrush)
{
@@ -1639,7 +1695,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 +1711,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 +1726,35 @@ namespace Tango.MachineStudio.Developer.ViewModels
LoadSelectedJob();
}
+ private void DisplayJobEmbroideryFile(Job job)
+ {
+ _notification.ShowModalDialog<EmbroideryDisplayViewVM, EmbroideryDisplayView>(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
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
new file mode 100644
index 000000000..22414b4b2
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/EmbroideryDisplayView.xaml
@@ -0,0 +1,57 @@
+<UserControl x:Class="Tango.MachineStudio.Developer.Views.EmbroideryDisplayView"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:emb="clr-namespace:Tango.EmbroideryUI;assembly=Tango.EmbroideryUI"
+ xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
+ xmlns:vm="clr-namespace:Tango.MachineStudio.Developer.ViewModels"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:converters="clr-namespace:Tango.MachineStudio.Developer.Converters"
+ xmlns:local="clr-namespace:Tango.MachineStudio.Developer.Views"
+ mc:Ignorable="d"
+ Width="1280" Height="720" Background="White" d:DataContext="{d:DesignInstance Type=vm:EmbroideryDisplayViewVM, IsDesignTimeCreatable=False}">
+
+ <UserControl.Resources>
+ <converters:ByteArrayToBitmapSourceConverter x:Key="ByteArrayToBitmapSourceConverter" />
+ </UserControl.Resources>
+
+ <Grid>
+ <Grid>
+ <Grid.RowDefinitions>
+ <RowDefinition Height="60"/>
+ <RowDefinition Height="593*"/>
+ <RowDefinition Height="60"/>
+ </Grid.RowDefinitions>
+
+ <Grid>
+ <StackPanel Orientation="Horizontal">
+ <Image Source="../Images/sewing-machine.png" Width="48"></Image>
+ <TextBlock VerticalAlignment="Center" Margin="10 0 0 0" FontSize="20" Text="{Binding Job.EmbroideryFileName}"></TextBlock>
+ </StackPanel>
+
+ <Rectangle VerticalAlignment="Bottom" Stroke="Silver"></Rectangle>
+ </Grid>
+
+ <Grid Grid.Row="1">
+ <Grid.Background>
+ <ImageBrush ImageSource="../Images/seamless-grid.jpg" Stretch="None" Opacity="0.5" TileMode="Tile" ViewportUnits="Absolute" Viewport="0,0,32,32"></ImageBrush>
+ </Grid.Background>
+ <Rectangle HorizontalAlignment="Left" Stroke="Silver"></Rectangle>
+ <Rectangle HorizontalAlignment="Right" Stroke="Silver"></Rectangle>
+ <Image HorizontalAlignment="Center" VerticalAlignment="Center" Source="{Binding Job.EmbroideryJpeg,Converter={StaticResource ByteArrayToBitmapSourceConverter}}"></Image>
+ </Grid>
+
+ <Grid Grid.Row="2">
+ <Rectangle VerticalAlignment="Top" Stroke="Silver"></Rectangle>
+ <StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
+ <Button Height="50" Command="{Binding ExportCommand}" Width="180">
+ <StackPanel Orientation="Horizontal">
+ <materialDesign:PackIcon Kind="Export" Width="24" Height="24" />
+ <TextBlock Margin="5 0 0 0" FontSize="16">EXPORT</TextBlock>
+ </StackPanel>
+ </Button>
+ </StackPanel>
+ </Grid>
+ </Grid>
+ </Grid>
+</UserControl>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/EmbroideryDisplayView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/EmbroideryDisplayView.xaml.cs
new file mode 100644
index 000000000..7d0771098
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/EmbroideryDisplayView.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.Developer.Views
+{
+ /// <summary>
+ /// Interaction logic for EmbroideryDisplayView.xaml
+ /// </summary>
+ public partial class EmbroideryDisplayView : UserControl
+ {
+ public EmbroideryDisplayView()
+ {
+ InitializeComponent();
+ }
+ }
+}
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 220e7d3ab..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
@@ -6,6 +6,7 @@
xmlns:emb="clr-namespace:Tango.EmbroideryUI;assembly=Tango.EmbroideryUI"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:vm="clr-namespace:Tango.MachineStudio.Developer.ViewModels"
+ xmlns:mahApps="http://metro.mahapps.com/winfx/xaml/controls"
xmlns:brushPicker="clr-namespace:Tango.BrushPicker;assembly=Tango.BrushPicker"
xmlns:local="clr-namespace:Tango.MachineStudio.Developer.Views"
mc:Ignorable="d"
@@ -33,21 +34,55 @@
<Rectangle VerticalAlignment="Bottom" Stroke="Silver"></Rectangle>
</Grid>
- <Grid Grid.Row="1">
- <emb:EmbroideryFileEditor x:Name="editor" Background="White" FileName="{Binding FileName}" EmbroideryFile="{Binding EmbroideryFile,Mode=OneWayToSource}" Paths="{Binding Paths,Mode=OneWayToSource}" />
+ <Grid Grid.Row="1" x:Name="gridEditor">
+ <Grid.Background>
+ <ImageBrush ImageSource="../Images/seamless-grid.jpg" Stretch="None" Opacity="0.5" TileMode="Tile" ViewportUnits="Absolute" Viewport="0,0,32,32"></ImageBrush>
+ </Grid.Background>
+ <Rectangle HorizontalAlignment="Left" Stroke="Silver"></Rectangle>
+ <emb:EmbroideryFileEditor x:Name="editor" Background="Transparent" FileName="{Binding FileName}" EmbroideryFile="{Binding EmbroideryFile,Mode=OneWayToSource}" Paths="{Binding Paths,Mode=OneWayToSource}" />
</Grid>
<Grid Grid.Column="1" Grid.Row="1">
<StackPanel>
<TextBlock Margin="5">Region Brush</TextBlock>
- <brushPicker:BrushPicker Margin="0 10 0 0" Background="White" BorderThickness="0" Brush="{Binding ElementName=editor,Path=SelectedPath.Brush,Mode=TwoWay}" />
+ <Border Margin="5" BorderThickness="1" BorderBrush="Silver">
+ <brushPicker:BrushPicker Background="White" BorderThickness="0" Brush="{Binding ElementName=editor,Path=SelectedPath.Brush,Mode=TwoWay}" />
+ </Border>
+
+ <Border BorderThickness="1" BorderBrush="Silver" Padding="5 0 5 5" Margin="5">
+ <Border.Resources>
+ <Style TargetType="TextBlock">
+ <Setter Property="Margin" Value="0 10 0 5"></Setter>
+ </Style>
+ </Border.Resources>
+ <StackPanel>
+ <TextBlock Text="Material"></TextBlock>
+ <ComboBox ItemsSource="{Binding EmbroideryMaterials}" SelectedItem="{Binding SelectedEmbroideryMaterial}" DisplayMemberPath="Name" Margin="5 0"></ComboBox>
+
+ <TextBlock Text="Material Thickness"></TextBlock>
+ <mahApps:NumericUpDown Minimum="0" Maximum="100" StringFormat="# mm" Value="{Binding EmbroideryMaterialThickness}" HasDecimals="False" HorizontalContentAlignment="Center" />
+
+ <Grid Margin="0 20 0 5">
+ <TextBlock Text="Stabilizer" Margin="0" HorizontalAlignment="Left"></TextBlock>
+ <ToggleButton HorizontalAlignment="Right" IsChecked="{Binding HasStabilizer}"></ToggleButton>
+ </Grid>
+ <ComboBox IsEnabled="{Binding HasStabilizer}" ItemsSource="{Binding EmbroideryMaterials}" SelectedItem="{Binding SelectedStabilizer}" DisplayMemberPath="Name" Margin="5 0"></ComboBox>
+
+ <TextBlock Text="Stabilizer Thickness"></TextBlock>
+ <mahApps:NumericUpDown IsEnabled="{Binding HasStabilizer}" Minimum="1" Maximum="100" StringFormat="# mm" Value="{Binding StabilizerThickness}" HasDecimals="False" HorizontalContentAlignment="Center" />
+ </StackPanel>
+ </Border>
</StackPanel>
<Rectangle HorizontalAlignment="Left" Stroke="Silver" />
</Grid>
+ <Grid Grid.Row="2" Grid.ColumnSpan="2">
+ <Rectangle VerticalAlignment="Top" Stroke="Silver"></Rectangle>
+ </Grid>
+
<Grid Grid.Row="2" Grid.Column="1">
- <Button Height="50" Command="{Binding ImportCommand}">
+ <Button Height="50" Click="OnImportClick" Command="{Binding ImportCommand}">
<StackPanel Orientation="Horizontal">
<materialDesign:PackIcon Kind="Import" Width="24" Height="24" />
<TextBlock Margin="5 0 0 0" FontSize="16">IMPORT</TextBlock>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/EmbroideryImportView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/EmbroideryImportView.xaml.cs
index c34b6fef7..0b368a809 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/EmbroideryImportView.xaml.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/EmbroideryImportView.xaml.cs
@@ -12,6 +12,7 @@ using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
+using Tango.SharedUI.Helpers;
namespace Tango.MachineStudio.Developer.Views
{
@@ -20,9 +21,17 @@ namespace Tango.MachineStudio.Developer.Views
/// </summary>
public partial class EmbroideryImportView : UserControl
{
+ public byte[] EmbroideryImageBytes { get; set; }
+
public EmbroideryImportView()
{
InitializeComponent();
}
+
+ private void OnImportClick(object sender, RoutedEventArgs e)
+ {
+ var source = UIHelper.TakeSnapshot(gridEditor);
+ EmbroideryImageBytes = source.ToJpegBytes(50);
+ }
}
}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml
index 9ba41f688..1dea01de7 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml
@@ -438,13 +438,13 @@
<Grid HorizontalAlignment="Right" Margin="0 0 10 0">
<StackPanel Orientation="Horizontal">
- <Button Height="70" Width="135" Margin="0 0 10 0" Background="White" Foreground="#202020" VerticalAlignment="Bottom" BorderBrush="Transparent" Command="{Binding DiscardJobCommand}">
+ <Button Height="70" Width="100" Margin="0 0 10 0" Style="{StaticResource MaterialDesignFlatButton}" Foreground="#202020" VerticalAlignment="Bottom" BorderBrush="Transparent" Command="{Binding DiscardJobCommand}">
<StackPanel>
<materialDesign:PackIcon HorizontalAlignment="Center" Width="24" Height="24" Kind="KeyboardBackspace" />
<TextBlock VerticalAlignment="Center" Margin="0 10 0 0">TO JOBS</TextBlock>
</StackPanel>
</Button>
- <Button Height="70" Width="135" Margin="0 0 0 0" Background="White" Foreground="#202020" VerticalAlignment="Bottom" BorderBrush="Transparent" Command="{Binding SaveJobCommand}">
+ <Button Height="70" Width="100" Margin="0 0 0 0" Style="{StaticResource MaterialDesignFlatButton}" Foreground="#202020" VerticalAlignment="Bottom" BorderBrush="Transparent" Command="{Binding SaveJobCommand}">
<StackPanel>
<materialDesign:PackIcon HorizontalAlignment="Center" Width="24" Height="24" Kind="ContentSave" />
<TextBlock VerticalAlignment="Center" Margin="0 10 0 0">SAVE JOB</TextBlock>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MachineJobSelectionView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MachineJobSelectionView.xaml
index 2115f2503..a8274a4f7 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MachineJobSelectionView.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MachineJobSelectionView.xaml
@@ -14,7 +14,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Tango.MachineStudio.Developer.Views"
mc:Ignorable="d"
- d:DesignHeight="1080" d:DesignWidth="1920" Background="Transparent" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}">
+ x:Name="control" d:DesignHeight="1080" d:DesignWidth="1920" Background="Transparent" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}">
<UserControl.Resources>
<localConverters:SegmentToBrushConverterMulti x:Key="SegmentToBrushConverterMulti" />
@@ -131,8 +131,29 @@
<DataGrid.Columns>
<DataGridTemplateColumn>
<DataGridTemplateColumn.CellTemplate>
- <DataTemplate>
- <Image Source="../Images/rgb.png" Width="40" Margin="5"></Image>
+ <DataTemplate DataType="{x:Type observables:Job}">
+ <ContentControl>
+ <ContentControl.Style>
+ <Style TargetType="ContentControl">
+ <Setter Property="Content">
+ <Setter.Value>
+ <Image Source="../Images/rgb.png" Width="40" Margin="5"></Image>
+ </Setter.Value>
+ </Setter>
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding HasEmbroideryFile}" Value="True">
+ <Setter Property="Content">
+ <Setter.Value>
+ <Button ToolTip="Press to display the attached embroidery file information" Style="{StaticResource emptyButton}" Cursor="Hand" Command="{Binding DataContext.DisplayJobEmbroideryFileCommand, Source={x:Reference control}}" CommandParameter="{Binding}">
+ <Image Source="../Images/job-emb.png" Width="40" Margin="5"></Image>
+ </Button>
+ </Setter.Value>
+ </Setter>
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </ContentControl.Style>
+ </ContentControl>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml
index 7a50a499e..c4915a4c8 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml
@@ -132,7 +132,7 @@
<StackPanel Margin="0 0 0 0" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock Margin="0 0 0 0" FontSize="14" HorizontalAlignment="Right">
- <Run Text="{Binding Length,Mode=OneWay}"></Run>
+ <Run Text="{Binding Length,Mode=OneWay,StringFormat=N2}"></Run>
<Run FontSize="12" Text="m"></Run>
</TextBlock>
<materialDesign:PackIcon HorizontalAlignment="Center" RenderTransformOrigin="0.5,0.5" Kind="Triangle" Width="12" Height="12">
@@ -197,7 +197,7 @@
<StackPanel Margin="0 -5 -40 0" HorizontalAlignment="Right">
<TextBlock FontSize="14">
- <Run Text="{Binding RunningJob.Length,Mode=OneWay}"></Run>
+ <Run Text="{Binding RunningJob.Length,Mode=OneWay,StringFormat=N2}"></Run>
<Run FontSize="13" Text="m"></Run>
</TextBlock>
<materialDesign:PackIcon HorizontalAlignment="Right" RenderTransformOrigin="0.5,0.5" Kind="FlagCheckered" Width="20" Height="20">
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/bip.wav b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/bip.wav
new file mode 100644
index 000000000..5a1d74045
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/bip.wav
Binary files differ