aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Utilities/Tango.MachineEM.UI
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2019-08-22 11:58:11 +0300
committerRoy Ben-Shabat <Roy@Twine-s.com>2019-08-22 11:58:11 +0300
commit0c97dba8c1443ee39029136c52bc3861702888e2 (patch)
tree0eba2c6e9a170bb316045f67add60060734d4f0d /Software/Visual_Studio/Utilities/Tango.MachineEM.UI
parent884fce5075ca6a53cb5687feb0b01c6db0802f06 (diff)
downloadTango-0c97dba8c1443ee39029136c52bc3861702888e2.tar.gz
Tango-0c97dba8c1443ee39029136c52bc3861702888e2.zip
Added cartridge insertion validation handling.
Implemented a better keep alive mechanism.
Diffstat (limited to 'Software/Visual_Studio/Utilities/Tango.MachineEM.UI')
-rw-r--r--Software/Visual_Studio/Utilities/Tango.MachineEM.UI/ViewModels/MainViewVM.cs20
-rw-r--r--Software/Visual_Studio/Utilities/Tango.MachineEM.UI/Views/MainView.xaml8
2 files changed, 27 insertions, 1 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 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
/// </summary>
public RelayCommand ClearCommand { get; set; }
+ /// <summary>
+ /// Gets or sets the validate cartridge command.
+ /// </summary>
+ 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<string>()
{
@@ -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
}
}
diff --git a/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/Views/MainView.xaml b/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/Views/MainView.xaml
index f9252d970..51cc1d3ec 100644
--- a/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/Views/MainView.xaml
+++ b/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/Views/MainView.xaml
@@ -10,7 +10,7 @@
xmlns:vm="clr-namespace:Tango.MachineEM.UI.ViewModels"
xmlns:local="clr-namespace:Tango.MachineEM.UI.Views"
mc:Ignorable="d"
- d:DesignHeight="720" d:DesignWidth="1200" Foreground="Gainsboro" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" >
+ d:DesignHeight="720" d:DesignWidth="1300" Foreground="Gainsboro" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" >
<UserControl.Resources>
<converters:BooleanInverseConverter x:Key="BooleanInverseConverter"></converters:BooleanInverseConverter>
@@ -179,6 +179,12 @@
<SolidColorBrush Color="#151515" Opacity="0.8" />
</Grid.Background>
<StackPanel HorizontalAlignment="Right" Orientation="Horizontal" Margin="5">
+ <Button Margin="5" MinWidth="100" Style="{StaticResource AccentedSquareButtonStyle}" mahapps:ButtonHelper.PreserveTextCase="True" BorderThickness="0" Command="{Binding ValidateCartridgeCommand}">
+ <StackPanel Orientation="Horizontal">
+ <fa:ImageAwesome Icon="FlagCheckered" Width="16"></fa:ImageAwesome>
+ <TextBlock VerticalAlignment="Center" Margin="10 0 10 0">CARTRIDGE VALIDATION</TextBlock>
+ </StackPanel>
+ </Button>
<ToggleButton Style="{StaticResource AccentedSquareButtonStyle}" BorderThickness="0" x:Name="toggleLevels" MinWidth="140" Margin="5 5 20 5">
<StackPanel Orientation="Horizontal">
<TextBlock VerticalAlignment="Center" Margin="10 0 10 0">STATUS</TextBlock>