aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs')
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs9
1 files changed, 6 insertions, 3 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 f557e2923..ab0df302e 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
@@ -652,8 +652,11 @@ namespace Tango.MachineStudio.Developer.ViewModels
LogManager.Log("Initializing relay commands...");
- _dataCaptureVM = TangoIOC.Default.GetInstance<DataCapture.ViewModels.MainViewVM>();
- _dataCaptureVM.RelayCommandsInvalidated += (_, __) => StartJobAndRecordCommand.RaiseCanExecuteChanged();
+ TangoIOC.Default.GetInstanceWhenAvailable<DataCapture.ViewModels.MainViewVM>((vm) =>
+ {
+ _dataCaptureVM = vm;
+ _dataCaptureVM.RelayCommandsInvalidated += (_, __) => StartJobAndRecordCommand.RaiseCanExecuteChanged();
+ });
//Initialize Commands...
EditMachineCommand = new RelayCommand(EditMachine, () => SelectedMachine != null);
@@ -669,7 +672,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)));
+ StartJobAndRecordCommand = new RelayCommand(StartJobAndRecord, () => _dataCaptureVM != null && !_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);