aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels
diff options
context:
space:
mode:
authorShlomo Hecht <shlomo@twine-s.com>2018-04-08 18:40:59 +0300
committerShlomo Hecht <shlomo@twine-s.com>2018-04-08 18:40:59 +0300
commitec7c6afede0b9e588c62d23f4957e5d390e4fc43 (patch)
tree565ef4669670038dd2437d8d8dac1aea616c6cc1 /Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels
parentf22f64fec07df88dc302c7d541197a01bec50879 (diff)
parenta0e25846735104f09a18647220db59804977e73a (diff)
downloadTango-ec7c6afede0b9e588c62d23f4957e5d390e4fc43.tar.gz
Tango-ec7c6afede0b9e588c62d23f4957e5d390e4fc43.zip
Merge branch 'master' of https://twinetfs.visualstudio.com/_git/Tango
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels')
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs15
1 files changed, 13 insertions, 2 deletions
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 f455faa9e..7891f96b7 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
@@ -33,6 +33,7 @@ using System.Windows;
using Tango.Core.Helpers;
using System.Speech.Synthesis;
using System.Media;
+using Tango.MachineStudio.Common.EventLogging;
namespace Tango.MachineStudio.Developer.ViewModels
{
@@ -57,6 +58,7 @@ namespace Tango.MachineStudio.Developer.ViewModels
private SpeechSynthesizer _speech;
private SoundPlayer _soundPlayer;
private SoundPlayer _soundPlayerErr;
+ private IEventLogger _eventLogger;
#region Properties
@@ -598,7 +600,7 @@ namespace Tango.MachineStudio.Developer.ViewModels
/// </summary>
/// <param name="applicationManager">The application manager.</param>
/// <param name="notificationProvider">The notification provider.</param>
- public MainViewVM(IStudioApplicationManager applicationManager, INotificationProvider notificationProvider, IDiagnosticsFrameProvider diagnosticsFrameProvider, IVideoCaptureProvider videoCaptureProvider, DeveloperNavigationManager navigation, IAuthenticationProvider authentication)
+ public MainViewVM(IStudioApplicationManager applicationManager, INotificationProvider notificationProvider, IDiagnosticsFrameProvider diagnosticsFrameProvider, IVideoCaptureProvider videoCaptureProvider, DeveloperNavigationManager navigation, IAuthenticationProvider authentication, IEventLogger eventLogger)
{
SelectedJobs = new ObservableCollection<Job>();
@@ -625,6 +627,7 @@ namespace Tango.MachineStudio.Developer.ViewModels
_navigation = navigation;
ApplicationManager = applicationManager;
VideoCaptureProvider = videoCaptureProvider;
+ _eventLogger = eventLogger;
LogManager.Log("Initializing relay commands...");
@@ -1011,6 +1014,8 @@ namespace Tango.MachineStudio.Developer.ViewModels
_jobHandler = MachineOperator.Print(ActiveJob, SelectedProcessParametersTable);
+ _eventLogger.Log(String.Format("Job '{0}' started...", ActiveJob.Name));
+
_jobHandler.StatusReceived += (x, status) =>
{
if (IsJobRunning)
@@ -1044,10 +1049,12 @@ namespace Tango.MachineStudio.Developer.ViewModels
if (segment.ID != -1)
{
SpeakInfo(String.Format("Segment {0} Started.", segment.SegmentIndex));
+ _eventLogger.Log(String.Format("Segment {0} Started.", segment.SegmentIndex));
}
else
{
SpeakInfo(String.Format("Inter Segment Started."));
+ _eventLogger.Log("Inter Segment Started.");
}
}
}
@@ -1064,6 +1071,7 @@ namespace Tango.MachineStudio.Developer.ViewModels
_jobHandler.Failed += (x, ex) =>
{
LogManager.Log(ex, String.Format("Job {0} has failed.", RunningJob.Name));
+ _eventLogger.Log(ex, String.Format("Job {0} has failed.", RunningJob.Name));
SetJobFailed();
InvokeUI(() =>
@@ -1075,18 +1083,21 @@ namespace Tango.MachineStudio.Developer.ViewModels
_jobHandler.Completed += (x, e) =>
{
LogManager.Log(String.Format("Job {0} has completed.", RunningJob.Name));
+ _eventLogger.Log(String.Format("Job {0} has completed.", RunningJob.Name));
SetJobCompleted();
};
_jobHandler.Canceled += (x, y) =>
{
LogManager.Log(String.Format("Job {0} has been canceled.", RunningJob.Name));
+ _eventLogger.Log(String.Format("Job {0} has been canceled.", RunningJob.Name));
//Finally Canceled..
};
}
catch (Exception ex)
{
LogManager.Log(ex);
+ _eventLogger.Log(ex, "An error occurred while starting the job.");
_notification.ShowError("An error occurred while starting the job. " + Environment.NewLine + ex.Message);
SetJobFailed();
}
@@ -1741,7 +1752,7 @@ namespace Tango.MachineStudio.Developer.ViewModels
segment.Length = totalLength;
segment.Name = "Embroidery Segment";
- segment.SegmentIndex = vm.Paths.IndexOf(path) + 2;
+ segment.SegmentIndex = vm.Paths.IndexOf(path);
if (path.Brush is SolidColorBrush)
{