From cdba3267d2a47b3bff8cf3ec0219223e36e234ff Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Mon, 7 May 2018 15:36:03 +0300 Subject: Added machine studio modules order. Implemented delayed GetInstance for TangoIOC. --- .../Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels') 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(); - _dataCaptureVM.RelayCommandsInvalidated += (_, __) => StartJobAndRecordCommand.RaiseCanExecuteChanged(); + TangoIOC.Default.GetInstanceWhenAvailable((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); -- cgit v1.3.1