diff options
Diffstat (limited to 'Software/Visual_Studio/Utilities/Tango.MachineEM.UI/ViewModels/MainViewVM.cs')
| -rw-r--r-- | Software/Visual_Studio/Utilities/Tango.MachineEM.UI/ViewModels/MainViewVM.cs | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/ViewModels/MainViewVM.cs b/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/ViewModels/MainViewVM.cs index 1662a3ede..f42e7f161 100644 --- a/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/ViewModels/MainViewVM.cs @@ -20,6 +20,7 @@ namespace Tango.MachineEM.UI.ViewModels private TcpServer TcpServer; private bool _running; private LogManager logManager = LogManager.Default; + private bool _isThreadLoading; #region Properties @@ -101,6 +102,16 @@ namespace Tango.MachineEM.UI.ViewModels /// </summary> public RelayCommand ValidateCartridgeCommand { get; set; } + /// <summary> + /// Gets or sets the start thread loading sequence command. + /// </summary> + public RelayCommand StartThreadLoadingCommand { get; set; } + + /// <summary> + /// Gets or sets the finalize thread loading command. + /// </summary> + public RelayCommand FinalizeThreadLoadingCommand { get; set; } + #endregion #region Constructors @@ -131,6 +142,8 @@ namespace Tango.MachineEM.UI.ViewModels CancelCommand = new RelayCommand(Cancel, (x) => _running); ClearCommand = new RelayCommand(() => Log = String.Empty); ValidateCartridgeCommand = new RelayCommand(ValidateCartridge, (x) => Emulator.IsStarted); + StartThreadLoadingCommand = new RelayCommand(StartThreadLoading, (x) => Emulator.IsStarted && !_isThreadLoading); + FinalizeThreadLoadingCommand = new RelayCommand(FinalizeThreadLoading, (x) => Emulator.IsStarted && _isThreadLoading); Ports = new List<string>() { @@ -218,6 +231,26 @@ namespace Tango.MachineEM.UI.ViewModels } } + private async void StartThreadLoading() + { + LogManager.Log("Starting thread loading sequence..."); + Emulator.StartThreadLoading(); + _isThreadLoading = true; + InvalidateRelayCommands(); + + await Task.Delay(10000); + _isThreadLoading = false; + InvalidateRelayCommands(); + } + + private void FinalizeThreadLoading() + { + LogManager.Log("Finalizing thread loading sequence..."); + Emulator.FinalizeThreadLoading(); + _isThreadLoading = false; + InvalidateRelayCommands(); + } + #endregion } } |
