From f681b137c727f7dcdb7d3f5765af8b5b3048c2d9 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Thu, 25 Oct 2018 13:35:52 +0300 Subject: Implemented Job Outline. --- .../Converters/ObjectToPropertiesConverter.cs | 33 ++ .../Tango.MachineStudio.Developer.csproj | 3 +- .../ViewModels/MainViewVM.cs | 39 +- .../Views/RunningJobView.xaml | 484 +++++++++++++++------ 4 files changed, 406 insertions(+), 153 deletions(-) create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/ObjectToPropertiesConverter.cs (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer') diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/ObjectToPropertiesConverter.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/ObjectToPropertiesConverter.cs new file mode 100644 index 000000000..09e7b527a --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/ObjectToPropertiesConverter.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Data; + +namespace Tango.MachineStudio.Developer.Converters +{ + public class ObjectToPropertiesConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if (value != null) + { + var properties = value.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance).Where(x => (!x.PropertyType.IsClass && !typeof(IEnumerable).IsAssignableFrom(x.PropertyType)) || x.PropertyType == typeof(String)).ToList(); + return properties.Select(x => new { x.Name, Value = x.GetValue(value) }); + } + else + { + return null; + } + } + + 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/Tango.MachineStudio.Developer.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj index dca470eed..86f30cd3a 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 @@ -105,6 +105,7 @@ + @@ -360,7 +361,7 @@ - + \ No newline at end of file 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 f55ece6a1..f0568ad6c 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 @@ -62,7 +62,6 @@ namespace Tango.MachineStudio.Developer.ViewModels private INotificationProvider _notification; private TimeSpan _runningJobEstimatedDuration; - private JobHandler _jobHandler; private DeveloperNavigationManager _navigation; private INavigationManager _msNavigation; private bool _blockInvalidateCommands; @@ -113,6 +112,22 @@ namespace Tango.MachineStudio.Developer.ViewModels set { _runningJobStatus = value; RaisePropertyChangedAuto(); } } + private JobHandler _jobHandler; + /// + /// Gets or sets the current running job handler. + /// + public JobHandler JobHandler + { + get + { + return _jobHandler; + } + set + { + _jobHandler = value; RaisePropertyChangedAuto(); + } + } + private ObservableCollection _colorSpaces; /// /// Gets or sets the color spaces. @@ -1017,7 +1032,7 @@ namespace Tango.MachineStudio.Developer.ViewModels if (events.ToList().Exists(x => x.ActionTypes.Contains(BL.Enumerations.ActionTypes.AbortRunningJob))) { - if (_jobHandler != null) + if (JobHandler != null) { InvokeUI(StopJob); } @@ -1207,7 +1222,7 @@ namespace Tango.MachineStudio.Developer.ViewModels LogManager.Log("Stopping job..."); IsJobRunning = false; IsJobCanceled = true; - _jobHandler.Cancel(); + JobHandler.Cancel(); } /// @@ -1278,16 +1293,16 @@ namespace Tango.MachineStudio.Developer.ViewModels if (resumeFunc == null) { - _jobHandler = MachineOperator.Print(ActiveJob, SelectedProcessParametersTable); + JobHandler = MachineOperator.Print(ActiveJob, SelectedProcessParametersTable); } else { - _jobHandler = resumeFunc(ActiveJob); + JobHandler = resumeFunc(ActiveJob); } _eventLogger.Log(String.Format("Job '{0}' started...", ActiveJob.Name)); - _jobHandler.StatusChanged += (x, status) => + JobHandler.StatusChanged += (x, status) => { if (IsJobRunning) { @@ -1301,7 +1316,7 @@ namespace Tango.MachineStudio.Developer.ViewModels } }; - _jobHandler.SegmentStarted += (x, segment) => + JobHandler.SegmentStarted += (x, segment) => { if (!segment.IsInterSegment) { @@ -1315,13 +1330,13 @@ namespace Tango.MachineStudio.Developer.ViewModels } }; - _jobHandler.UnitCompleted += (x, unit) => + JobHandler.UnitCompleted += (x, unit) => { _speech.SpeakInfo(String.Format("{0} Units Completed.", unit + 1)); _eventLogger.Log(String.Format("{0} Units Completed.", unit + 1)); }; - _jobHandler.Failed += (x, ex) => + 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)); @@ -1334,14 +1349,14 @@ namespace Tango.MachineStudio.Developer.ViewModels }); }; - _jobHandler.Finalizing += (_, __) => + JobHandler.Finalizing += (_, __) => { _speech.SpeakInfo("Finalizing job..."); LogManager.Log(String.Format("Finalizing job {0}.", RunningJob.Name)); _eventLogger.Log(String.Format("Finalizing job {0}.", RunningJob.Name)); }; - _jobHandler.Completed += (x, e) => + JobHandler.Completed += (x, e) => { LogManager.Log(String.Format("Job {0} has completed.", RunningJob.Name)); _eventLogger.Log(String.Format("Job {0} has completed.", RunningJob.Name)); @@ -1349,7 +1364,7 @@ namespace Tango.MachineStudio.Developer.ViewModels StopRecordingIfInProgress(); }; - _jobHandler.Canceled += (x, y) => + 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)); diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/RunningJobView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/RunningJobView.xaml index fe04cead7..cff53ea8d 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/RunningJobView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/RunningJobView.xaml @@ -4,6 +4,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" + xmlns:localConverters="clr-namespace:Tango.MachineStudio.Developer.Converters" xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" xmlns:vm="clr-namespace:Tango.MachineStudio.Developer.ViewModels" xmlns:global="clr-namespace:Tango.MachineStudio.Developer" @@ -13,130 +14,40 @@ + + - - - - - - - - - - - - Status - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + - - - - - - Events - - - - + + + + + Status - - - - + @@ -149,34 +60,29 @@ + - + + - + @@ -185,20 +91,318 @@ - - - - + - + + + + + + - - + + + + + + + + + Events + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + BASIC + + + + + + + : + + + + + + + + SPOOL + + + + + + + : + + + + + + + + PROCESS PARAMETERS + + + + + + + : + + + + + + + + SEGMENTS + + + + + + # + + + + + + + + + + : + + + + + + + + BRUSH STOPS + + + + + + # + + + + + + + + + + : + + + + + + + + DISPENSERS + + + + + + # + + + + + + + + + + : + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- cgit v1.3.1