aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2018-03-04 15:28:15 +0200
committerRoy Ben-Shabat <Roy@Twine-s.com>2018-03-04 15:28:15 +0200
commit2b8e41b5279c2d3ab370595f6593b64ea734ef87 (patch)
tree084ceaae9e1b65454e9e2264ce6fdb0511ca4cf9 /Software/Visual_Studio/MachineStudio
parentd734bb5cf08ba2433b74fc86a8858d2437d1a237 (diff)
downloadTango-2b8e41b5279c2d3ab370595f6593b64ea734ef87.tar.gz
Tango-2b8e41b5279c2d3ab370595f6593b64ea734ef87.zip
Implemented job embroidery image capture, display export,
Implemented running job text to speech.
Diffstat (limited to 'Software/Visual_Studio/MachineStudio')
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/DBModule.cs1
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/DataCaptureModule.cs1
-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/Tango.MachineStudio.Developer.csproj17
-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/MainViewVM.cs98
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/EmbroideryDisplayView.xaml51
-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.xaml2
-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.xaml25
-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
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/HardwareDesignerModule.cs1
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/MachineDesignerModule.cs1
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/StubsModule.cs1
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/SynchronizationModule.cs1
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechnicianModule.cs1
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/ExtensionMethods/CommonDialogExtensions.cs15
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/IStudioModule.cs1
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Notifications/INotificationProvider.cs11
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioModuleBase.cs1
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj1
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Authentication/DefaultAuthenticationProvider.cs1
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DefaultNotificationProvider.cs50
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UpdateService/MachineStudioUpdateService.svc.cs1
29 files changed, 375 insertions, 19 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/DBModule.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/DBModule.cs
index 01cbee209..b53f28bd4 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/DBModule.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/DBModule.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.DB.Views;
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/DataCaptureModule.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/DataCaptureModule.cs
index f3bdb974e..38e82257f 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/DataCaptureModule.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/DataCaptureModule.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.DataCapture.Views;
using Tango.SharedUI.Helpers;
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/Tango.MachineStudio.Developer.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj
index 7bf4d22cd..378fb443b 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,11 @@
<ItemGroup>
<Resource Include="Images\sewing-machine.png" />
</ItemGroup>
+ <ItemGroup>
+ <Resource Include="Images\job-emb.png" />
+ </ItemGroup>
+ <ItemGroup>
+ <EmbeddedResource Include="bip.wav" />
+ </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/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<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.Paths.ToList(), vm.EmbroideryFile, 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, List<EmbroideryPath> 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<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..a753453f9
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/EmbroideryDisplayView.xaml
@@ -0,0 +1,51 @@
+<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="600" Height="350" 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">
+ <Image HorizontalAlignment="Center" VerticalAlignment="Center" Source="{Binding Job.EmbroideryJpeg,Converter={StaticResource ByteArrayToBitmapSourceConverter}}"></Image>
+ </Grid>
+
+ <Grid Grid.Row="2">
+ <StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
+ <Button Height="40" Command="{Binding ExportCommand}">
+ <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..d084aabcf 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
@@ -47,7 +47,7 @@
</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..ce481a87b 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(editor);
+ 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..ebacd122c 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
@@ -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 embroidery file information." Style="{StaticResource emptyButton}" Cursor="Hand" Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.DisplayJobEmbroideryFileCommand}" 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
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/HardwareDesignerModule.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/HardwareDesignerModule.cs
index 62fc02083..71b86b54a 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/HardwareDesignerModule.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/HardwareDesignerModule.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.HardwareDesigner.Views;
using Tango.SharedUI.Helpers;
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/MachineDesignerModule.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/MachineDesignerModule.cs
index f086f1873..c770695c6 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/MachineDesignerModule.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/MachineDesignerModule.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.MachineDesigner.Views;
using Tango.SharedUI.Helpers;
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/StubsModule.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/StubsModule.cs
index ad5f2f91c..62a208d87 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/StubsModule.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/StubsModule.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.Stubs.Views;
using Tango.SharedUI.Helpers;
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/SynchronizationModule.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/SynchronizationModule.cs
index 998475d1e..1a05c9248 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/SynchronizationModule.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/SynchronizationModule.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.Synchronization.Views;
using Tango.SharedUI.Helpers;
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechnicianModule.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechnicianModule.cs
index f31fdc9fd..92293e7d0 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechnicianModule.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechnicianModule.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.Technician.Views;
using Tango.SharedUI.Helpers;
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/ExtensionMethods/CommonDialogExtensions.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/ExtensionMethods/CommonDialogExtensions.cs
new file mode 100644
index 000000000..886ccdd1e
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/ExtensionMethods/CommonDialogExtensions.cs
@@ -0,0 +1,15 @@
+using Microsoft.Win32;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+
+public static class CommonDialogExtensions
+{
+ public static bool ShowDialogCenter(this CommonDialog dialog)
+ {
+ return dialog.ShowDialog(Application.Current.MainWindow).Value;
+ }
+}
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/IStudioModule.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/IStudioModule.cs
index 1107222ef..ee01def9e 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/IStudioModule.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/IStudioModule.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;
namespace Tango.MachineStudio.Common
{
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Notifications/INotificationProvider.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Notifications/INotificationProvider.cs
index 79bcc9bf9..ce60715a8 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Notifications/INotificationProvider.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Notifications/INotificationProvider.cs
@@ -102,6 +102,17 @@ namespace Tango.MachineStudio.Common.Notifications
void ShowModalDialog<VM, View>(VM vm, Action<VM> onAccept, Action onCancel) where View : FrameworkElement where VM : DialogViewVM;
/// <summary>
+ /// Shows the specified view with the specified view model as it's data context.
+ /// </summary>
+ /// <typeparam name="VM">The type of the mm.</typeparam>
+ /// <typeparam name="View">The type of the view.</typeparam>
+ /// <param name="vm">The view model.</param>
+ /// <param name="view">The view.</param>
+ /// <param name="onAccept">The accept action.</param>
+ /// <param name="onCancel">The cancel action.</param>
+ void ShowModalDialog<VM, View>(VM vm, View view, Action<VM> onAccept, Action onCancel) where View : FrameworkElement where VM : DialogViewVM;
+
+ /// <summary>
/// Creates a new view by a naming convention of the specified view model type.
/// </summary>
/// <typeparam name="VM">The type of the view model.</typeparam>
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioModuleBase.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioModuleBase.cs
index 3d17b245f..11da53c6c 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioModuleBase.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioModuleBase.cs
@@ -7,6 +7,7 @@ using System.Windows;
using System.Windows.Media.Imaging;
using Tango.Core;
using Tango.BL.Entities;
+using Tango.BL.Enumerations;
namespace Tango.MachineStudio.Common
{
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj
index bc102a017..457646223 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj
@@ -87,6 +87,7 @@
<Compile Include="Converters\SecondsToGraphPointsConverter.cs" />
<Compile Include="Diagnostics\DefaultDiagnosticsFrameProvider.cs" />
<Compile Include="Diagnostics\IDiagnosticsFrameProvider.cs" />
+ <Compile Include="ExtensionMethods\CommonDialogExtensions.cs" />
<Compile Include="Helpers\GraphsHelper.cs" />
<Compile Include="Notifications\BarItem.cs" />
<Compile Include="Notifications\DialogViewVM.cs" />
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Authentication/DefaultAuthenticationProvider.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Authentication/DefaultAuthenticationProvider.cs
index b3c4f5cb3..bc57aee20 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Authentication/DefaultAuthenticationProvider.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Authentication/DefaultAuthenticationProvider.cs
@@ -8,6 +8,7 @@ using Tango.Core;
using Tango.BL.Entities;
using Tango.MachineStudio.Common.Authentication;
using Tango.BL;
+using Tango.BL.Enumerations;
namespace Tango.MachineStudio.UI.Authentication
{
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DefaultNotificationProvider.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DefaultNotificationProvider.cs
index a07c0ef13..1c9b8732f 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DefaultNotificationProvider.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DefaultNotificationProvider.cs
@@ -193,6 +193,56 @@ namespace Tango.MachineStudio.UI.Notifications
}
/// <summary>
+ /// Shows the specified view with the specified view model as it's data context.
+ /// </summary>
+ /// <typeparam name="VM">The type of the mm.</typeparam>
+ /// <typeparam name="View">The type of the view.</typeparam>
+ /// <param name="vm">The view model.</param>
+ /// <param name="view">The view.</param>
+ /// <param name="onAccept">The accept action.</param>
+ /// <param name="onCancel">The cancel action.</param>
+ public void ShowModalDialog<VM, View>(VM vm, View view, Action<VM> onAccept, Action onCancel) where View : FrameworkElement where VM : DialogViewVM
+ {
+ DialogWindow dialog = new DialogWindow();
+ dialog.Owner = Application.Current.MainWindow;
+ dialog.InnerContent = view;
+ MainWindow.Instance.shadowGrid.Visibility = Visibility.Visible;
+ view.Loaded += (x, y) =>
+ {
+ VM context = vm;
+ dialog.DataContext = context;
+
+ Action onAcceptAction = null;
+ onAcceptAction = new Action(() =>
+ {
+ dialog.Close();
+ onAccept(context);
+ context.Accepted -= onAcceptAction;
+ });
+
+ Action onCancelAction = null;
+ onCancelAction = new Action(() =>
+ {
+ dialog.Close();
+
+ if (onCancel != null)
+ {
+ onCancel();
+ }
+
+ context.Canceled -= onCancelAction;
+ });
+
+ context.Accepted += onAcceptAction;
+ context.Canceled += onCancelAction;
+
+ context.OnShow();
+ };
+ dialog.ShowDialog();
+ MainWindow.Instance.shadowGrid.Visibility = Visibility.Hidden;
+ }
+
+ /// <summary>
/// Creates a new view by a naming convention of the specified view model type.
/// </summary>
/// <typeparam name="VM">The type of the view model.</typeparam>
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UpdateService/MachineStudioUpdateService.svc.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UpdateService/MachineStudioUpdateService.svc.cs
index 6deb9ac7b..907dcf757 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UpdateService/MachineStudioUpdateService.svc.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UpdateService/MachineStudioUpdateService.svc.cs
@@ -12,6 +12,7 @@ using Tango.BL.Entities;
using Tango.Logging;
using Tango.MachineStudio.Common.Update;
using Tango.BL;
+using Tango.BL.Enumerations;
namespace Tango.MachineStudio.UpdateService
{