diff options
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer')
5 files changed, 46 insertions, 7 deletions
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 c165552d1..ed55edbe6 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 @@ -267,6 +267,10 @@ <Project>{cb0b0aa2-bb24-4bca-a720-45e397684e12}</Project> <Name>Tango.MachineStudio.Common</Name> </ProjectReference> + <ProjectReference Include="..\Tango.MachineStudio.DataCapture\Tango.MachineStudio.DataCapture.csproj"> + <Project>{fc337a7f-1214-41d8-9992-78092a3b961e}</Project> + <Name>Tango.MachineStudio.DataCapture</Name> + </ProjectReference> <ProjectReference Include="..\Tango.MachineStudio.DB\Tango.MachineStudio.DB.csproj"> <Project>{94f7acf8-55e1-4a02-b9bc-a818413fdbbf}</Project> <Name>Tango.MachineStudio.DB</Name> @@ -351,13 +355,7 @@ <Resource Include="Images\job-emb.png" /> </ItemGroup> <ItemGroup> - <EmbeddedResource Include="bip.wav" /> - </ItemGroup> - <ItemGroup> <Resource Include="Images\seamless-grid.jpg" /> </ItemGroup> - <ItemGroup> - <EmbeddedResource Include="error.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/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs index cdfeee54d..036b01e34 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 @@ -35,6 +35,7 @@ using System.Speech.Synthesis; using System.Media; using Tango.MachineStudio.Common.EventLogging; using Tango.MachineStudio.Common.Speech; +using Microsoft.Practices.ServiceLocation; namespace Tango.MachineStudio.Developer.ViewModels { @@ -58,6 +59,8 @@ namespace Tango.MachineStudio.Developer.ViewModels private ObservablesContext _activeJobDbContext; private IEventLogger _eventLogger; private ISpeechProvider _speech; + private DataCapture.ViewModels.MainViewVM _dataCaptureVM; + private bool _isRecording; #region Properties @@ -556,6 +559,11 @@ namespace Tango.MachineStudio.Developer.ViewModels public RelayCommand StartJobCommand { get; set; } /// <summary> + /// Gets or sets the start job and record command. + /// </summary> + public RelayCommand StartJobAndRecordCommand { get; set; } + + /// <summary> /// Gets or sets the stop job command. /// </summary> public RelayCommand StopJobCommand { get; set; } @@ -642,6 +650,9 @@ namespace Tango.MachineStudio.Developer.ViewModels LogManager.Log("Initializing relay commands..."); + _dataCaptureVM = ServiceLocator.Current.GetInstance<DataCapture.ViewModels.MainViewVM>(); + _dataCaptureVM.RelayCommandsInvalidated += (_, __) => StartJobAndRecordCommand.RaiseCanExecuteChanged(); + //Initialize Commands... EditMachineCommand = new RelayCommand(EditMachine, () => SelectedMachine != null); EditRMLCommand = new RelayCommand(EditRML, () => SelectedRML != null); @@ -656,6 +667,7 @@ namespace Tango.MachineStudio.Developer.ViewModels SaveJobCommand = new RelayCommand(SaveActiveJob, () => SelectedMachine != null); DiscardJobCommand = new RelayCommand(BackToJobs, () => SelectedMachine != null); StartJobCommand = new RelayCommand(StartJob, () => ActiveJob != null && !IsJobRunning && MachineOperator != null && !MachineOperator.MachineEventsStateProvider.Events.ToList().Exists(x => x.ActionTypes.Contains(BL.Enumerations.ActionTypes.PreventJobExecution))); + StartJobAndRecordCommand = new RelayCommand(StartJobAndRecord, () => !_dataCaptureVM.Recorder.IsRecording && !_dataCaptureVM.Player.IsPlaying && ActiveJob != null && !IsJobRunning && MachineOperator != null && !MachineOperator.MachineEventsStateProvider.Events.ToList().Exists(x => x.ActionTypes.Contains(BL.Enumerations.ActionTypes.PreventJobExecution))); StopJobCommand = new RelayCommand(StopJob, () => IsJobRunning); CloseJobCompletionStatusCommand = new RelayCommand(CloseJobCompletionStatusBar); LoadJobCommand = new RelayCommand(LoadSelectedJob, () => SelectedMachineJob != null); @@ -1053,7 +1065,7 @@ namespace Tango.MachineStudio.Developer.ViewModels if (segment.ID != -1) { _speech.SpeakInfo(String.Format("Segment {0} Started.", segment.SegmentIndex)); - _eventLogger.Log(String.Format("Segment {0} Started.", segment.SegmentIndex)); + _eventLogger.Log(String.Format("Segment {0} Started.", segment.SegmentIndex) + Environment.NewLine + segment.ToJsonString()); } else { @@ -1081,6 +1093,7 @@ namespace Tango.MachineStudio.Developer.ViewModels InvokeUI(() => { _notification.ShowError("Job failed. " + ex.Message); + StopRecordingIfInProgress(); }); }; @@ -1089,12 +1102,14 @@ namespace Tango.MachineStudio.Developer.ViewModels LogManager.Log(String.Format("Job {0} has completed.", RunningJob.Name)); _eventLogger.Log(String.Format("Job {0} has completed.", RunningJob.Name)); SetJobCompleted(); + StopRecordingIfInProgress(); }; _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)); + StopRecordingIfInProgress(); //Finally Canceled.. }; } @@ -1104,6 +1119,29 @@ namespace Tango.MachineStudio.Developer.ViewModels _eventLogger.Log(ex, "An error occurred while starting the job."); _notification.ShowError("An error occurred while starting the job. " + Environment.NewLine + ex.Message); SetJobFailed(); + StopRecordingIfInProgress(); + } + } + + /// <summary> + /// Starts the job and record using the data capture module. + /// </summary> + private void StartJobAndRecord() + { + _isRecording = true; + _dataCaptureVM.StartDiagnosticsRecording(); + StartJob(); + } + + /// <summary> + /// Stops the recording if in progress. + /// </summary> + private void StopRecordingIfInProgress() + { + if (_isRecording) + { + _isRecording = false; + InvokeUI(() => _dataCaptureVM.StopRecorderOrPlayer()); } } 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 4c0784d1d..c575ef2a3 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 @@ -1066,6 +1066,9 @@ <TextBlock VerticalAlignment="Center" Margin="10 0 0 0" FontSize="18">START JOB</TextBlock> </StackPanel> </Button> + <Button Height="60" Width="60" Margin="-60 0 0 0" Padding="0" Command="{Binding StartJobAndRecordCommand}" Click="OnJobStartClick" ToolTip="Start Job and Record"> + <materialDesign:PackIcon VerticalAlignment="Center" Width="38" Height="38" Kind="Record" Foreground="#FF6D6D" /> + </Button> </StackPanel> </Grid> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/bip.wav b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/bip.wav Binary files differdeleted file mode 100644 index 5a1d74045..000000000 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/bip.wav +++ /dev/null diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/error.wav b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/error.wav Binary files differdeleted file mode 100644 index 4dce7d623..000000000 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/error.wav +++ /dev/null |
