From 0c97dba8c1443ee39029136c52bc3861702888e2 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Thu, 22 Aug 2019 11:58:11 +0300 Subject: Added cartridge insertion validation handling. Implemented a better keep alive mechanism. --- .../Tango.MachineEM.UI/ViewModels/MainViewVM.cs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'Software/Visual_Studio/Utilities/Tango.MachineEM.UI/ViewModels') 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 8e5393eda..1662a3ede 100644 --- a/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/ViewModels/MainViewVM.cs @@ -96,6 +96,11 @@ namespace Tango.MachineEM.UI.ViewModels /// public RelayCommand ClearCommand { get; set; } + /// + /// Gets or sets the validate cartridge command. + /// + public RelayCommand ValidateCartridgeCommand { get; set; } + #endregion #region Constructors @@ -125,6 +130,7 @@ namespace Tango.MachineEM.UI.ViewModels StopCommand = new RelayCommand(Stop, (x) => Emulator.IsStarted); CancelCommand = new RelayCommand(Cancel, (x) => _running); ClearCommand = new RelayCommand(() => Log = String.Empty); + ValidateCartridgeCommand = new RelayCommand(ValidateCartridge, (x) => Emulator.IsStarted); Ports = new List() { @@ -198,6 +204,20 @@ namespace Tango.MachineEM.UI.ViewModels } + private async void ValidateCartridge() + { + LogManager.Log("Sending cartridge validation request..."); + try + { + var index = await Emulator.ValidateCartridge(); + LogManager.Log($"Cartridge validation response received: '{index}'."); + } + catch (Exception ex) + { + LogManager.Log(ex, "Cartridge validation request failed."); + } + } + #endregion } } -- cgit v1.3.1