aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Utilities
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2019-12-19 18:01:01 +0200
committerRoy Ben-Shabat <Roy@Twine-s.com>2019-12-19 18:01:01 +0200
commit1208554e06da8aec1b074932df488769572ffcfb (patch)
tree9858ededeb8badda5fc8b3052ef9745e419f35fd /Software/Visual_Studio/Utilities
parent690604e6167bfa4fea0ab02f8b24a68142e8b546 (diff)
downloadTango-1208554e06da8aec1b074932df488769572ffcfb.tar.gz
Tango-1208554e06da8aec1b074932df488769572ffcfb.zip
Implemented auto thread loading.
Implemented advanced settings for technician. Implemented thread loading on emulator. Removed PowerUpSelectedRML from settings. Now using LoadedRml settings for ThreadLoading and PowerUp.
Diffstat (limited to 'Software/Visual_Studio/Utilities')
-rw-r--r--Software/Visual_Studio/Utilities/Tango.MachineEM.UI/ViewModels/MainViewVM.cs33
-rw-r--r--Software/Visual_Studio/Utilities/Tango.MachineEM.UI/Views/MainView.xaml143
2 files changed, 114 insertions, 62 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
}
}
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 58fbfef4c..23154aafd 100644
--- a/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/Views/MainView.xaml
+++ b/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/Views/MainView.xaml
@@ -53,17 +53,95 @@
<Grid>
<Grid.ColumnDefinitions>
+ <ColumnDefinition Width="220"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="280"/>
</Grid.ColumnDefinitions>
- <TextBox x:Name="txtLog" FontFamily="monospaced" TextChanged="txtLog_TextChanged" Text="{Binding Log}" Background="Transparent" Foreground="Red" FontSize="11" Padding="5" Style="{x:Null}" BorderThickness="0" IsReadOnly="True" AcceptsReturn="True" VerticalScrollBarVisibility="Auto" TextWrapping="Wrap">
+ <Grid Background="#A3000000">
+ <StackPanel>
+ <!--BUTTONS HERE-->
+ <Button Padding="10 0 0 0" Height="45" Margin="5" HorizontalContentAlignment="Left" MinWidth="100" Style="{StaticResource AccentedSquareButtonStyle}" mahapps:ButtonHelper.PreserveTextCase="True" BorderThickness="0" Command="{Binding StartThreadLoadingCommand}">
+ <StackPanel Orientation="Horizontal">
+ <fa:ImageAwesome Icon="ChevronCircleDown" Width="16"></fa:ImageAwesome>
+ <TextBlock VerticalAlignment="Center" Margin="10 0 10 0">START THREAD LOADING</TextBlock>
+ </StackPanel>
+ </Button>
+ <Button Padding="10 0 0 0" Height="45" Margin="5" HorizontalContentAlignment="Left" Style="{StaticResource AccentedSquareButtonStyle}" mahapps:ButtonHelper.PreserveTextCase="True" BorderThickness="0" Command="{Binding FinalizeThreadLoadingCommand}">
+ <StackPanel Orientation="Horizontal">
+ <fa:ImageAwesome Icon="ChevronCircleUp" Width="16"></fa:ImageAwesome>
+ <TextBlock VerticalAlignment="Center" Margin="10 0 10 0">FINALIZE THREAD LOADING</TextBlock>
+ </StackPanel>
+ </Button>
+ <Button Padding="10 0 0 0" Margin="5" Height="45" HorizontalContentAlignment="Left" 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" Height="45" Margin="5">
+ <StackPanel Orientation="Horizontal">
+ <TextBlock VerticalAlignment="Center" Margin="10 0 10 0">STATUS</TextBlock>
+ <fa:ImageAwesome Icon="ChevronDown" Width="16" Foreground="White"></fa:ImageAwesome>
+ </StackPanel>
+ </ToggleButton>
+ <Popup IsOpen="{Binding ElementName=toggleLevels,Path=IsChecked}" StaysOpen="True">
+ <Border Padding="10">
+ <StackPanel Orientation="Horizontal">
+ <StackPanel HorizontalAlignment="Left">
+ <TextBlock Foreground="Red">IDS Packs Levels</TextBlock>
+ <ScrollViewer Height="400" HorizontalScrollBarVisibility="Disabled" Width="300">
+ <ItemsControl Margin="0 5 0 0" ItemsSource="{Binding Emulator.MachineStatus.IDSPacksLevels}">
+ <ItemsControl.ItemTemplate>
+ <DataTemplate>
+ <StackPanel Margin="0 5">
+ <TextBlock>
+ <Run Text="Index: "></Run>
+ <Run Text="{Binding Index}"></Run>
+ </TextBlock>
+
+ <StackPanel Orientation="Horizontal">
+ <TextBlock Text="Dispenser Level (nl): " />
+ <TextBox Text="{Binding ElementName=sliderDispenser,Path=Value,UpdateSourceTrigger=PropertyChanged,Mode=TwoWay}"></TextBox>
+ </StackPanel>
+
+ <Slider x:Name="sliderDispenser" Orientation="Horizontal" Minimum="0" Maximum="130000000" Value="{Binding DispenserLevel}"></Slider>
+
+ <TextBlock>
+ <Run Text="MidTank Level (ml): "></Run>
+ <Run Text="{Binding ElementName=sliderMidTank,Path=Value}"></Run>
+ </TextBlock>
+
+ <Slider x:Name="sliderMidTank" Orientation="Horizontal" Minimum="0" Maximum="1.8" Value="{Binding MidTankLevel}"></Slider>
+ </StackPanel>
+ </DataTemplate>
+ </ItemsControl.ItemTemplate>
+ </ItemsControl>
+ </ScrollViewer>
+ </StackPanel>
+ <StackPanel Margin="10 0 0 0">
+ <TextBlock Foreground="Red">MACHINE STATE</TextBlock>
+ <ComboBox Margin="0 5 0 0" Width="150" ItemsSource="{Binding Source={x:Type pmr:MachineState},Converter={StaticResource EnumToItemsSourceConverter}}" SelectedValue="{Binding Emulator.MachineStatus.State,Mode=TwoWay}" SelectedValuePath="Value" DisplayMemberPath="DisplayName"></ComboBox>
+
+ <TextBlock Margin="0 20 0 0" Foreground="Red" Width="160">
+ <Run>OVERALL TEMPERATURE</Run>
+ <Run Text="{Binding ElementName=sliderTemperature,Path=Value,StringFormat='0.0',Mode=OneWay}"></Run>
+ </TextBlock>
+ <Slider x:Name="sliderTemperature" Margin="0 5 0 0" Minimum="0" Maximum="60" Value="{Binding Emulator.MachineStatus.OverallTemperature,Mode=TwoWay}"></Slider>
+ </StackPanel>
+ </StackPanel>
+ </Border>
+ </Popup>
+ <!--BUTTONS HERE-->
+ </StackPanel>
+ </Grid>
+ <TextBox x:Name="txtLog" Grid.Column="1" FontFamily="monospaced" TextChanged="txtLog_TextChanged" Text="{Binding Log}" Background="Transparent" Foreground="Red" FontSize="11" Padding="5" Style="{x:Null}" BorderThickness="0" IsReadOnly="True" AcceptsReturn="True" VerticalScrollBarVisibility="Auto" TextWrapping="Wrap">
</TextBox>
- <Grid Grid.Column="1">
+ <Grid Grid.Column="2">
<DockPanel>
<TextBlock DockPanel.Dock="Top" Margin="10 0 0 0">HARDWARE EVENTS</TextBlock>
- <ListBox BorderThickness="0" Background="#66000000" Margin="10 10 10 40" ItemsSource="{Binding Emulator.EventsStates}" FontSize="11">
+ <ListBox BorderThickness="0" Background="#66000000" Margin="10 10 10 0" ItemsSource="{Binding Emulator.EventsStates}" FontSize="11">
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
@@ -181,65 +259,6 @@
<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>
- <fa:ImageAwesome Icon="ChevronDown" Width="16" Foreground="White"></fa:ImageAwesome>
- </StackPanel>
- </ToggleButton>
- <Popup IsOpen="{Binding ElementName=toggleLevels,Path=IsChecked}" StaysOpen="True">
- <Border Padding="10">
- <StackPanel Orientation="Horizontal">
- <StackPanel HorizontalAlignment="Left">
- <TextBlock Foreground="Red">IDS Packs Levels</TextBlock>
- <ScrollViewer Height="400" HorizontalScrollBarVisibility="Disabled" Width="300">
- <ItemsControl Margin="0 5 0 0" ItemsSource="{Binding Emulator.MachineStatus.IDSPacksLevels}">
- <ItemsControl.ItemTemplate>
- <DataTemplate>
- <StackPanel Margin="0 5">
- <TextBlock>
- <Run Text="Index: "></Run>
- <Run Text="{Binding Index}"></Run>
- </TextBlock>
-
- <StackPanel Orientation="Horizontal">
- <TextBlock Text="Dispenser Level (nl): " />
- <TextBox Text="{Binding ElementName=sliderDispenser,Path=Value,UpdateSourceTrigger=PropertyChanged,Mode=TwoWay}"></TextBox>
- </StackPanel>
-
- <Slider x:Name="sliderDispenser" Orientation="Horizontal" Minimum="0" Maximum="130000000" Value="{Binding DispenserLevel}"></Slider>
-
- <TextBlock>
- <Run Text="MidTank Level (ml): "></Run>
- <Run Text="{Binding ElementName=sliderMidTank,Path=Value}"></Run>
- </TextBlock>
-
- <Slider x:Name="sliderMidTank" Orientation="Horizontal" Minimum="0" Maximum="1.8" Value="{Binding MidTankLevel}"></Slider>
- </StackPanel>
- </DataTemplate>
- </ItemsControl.ItemTemplate>
- </ItemsControl>
- </ScrollViewer>
- </StackPanel>
- <StackPanel Margin="10 0 0 0">
- <TextBlock Foreground="Red">MACHINE STATE</TextBlock>
- <ComboBox Margin="0 5 0 0" Width="150" ItemsSource="{Binding Source={x:Type pmr:MachineState},Converter={StaticResource EnumToItemsSourceConverter}}" SelectedValue="{Binding Emulator.MachineStatus.State,Mode=TwoWay}" SelectedValuePath="Value" DisplayMemberPath="DisplayName"></ComboBox>
-
- <TextBlock Margin="0 20 0 0" Foreground="Red" Width="160">
- <Run>OVERALL TEMPERATURE</Run>
- <Run Text="{Binding ElementName=sliderTemperature,Path=Value,StringFormat='0.0',Mode=OneWay}"></Run>
- </TextBlock>
- <Slider x:Name="sliderTemperature" Margin="0 5 0 0" Minimum="0" Maximum="60" Value="{Binding Emulator.MachineStatus.OverallTemperature,Mode=TwoWay}"></Slider>
- </StackPanel>
- </StackPanel>
- </Border>
- </Popup>
<CheckBox Margin="0 0 20 0" VerticalAlignment="Center" IsChecked="{Binding Emulator.EmulateCorruption}" Foreground="Red">Emulate Corruption</CheckBox>
<CheckBox Margin="0 0 20 0" VerticalAlignment="Center" IsChecked="{Binding Emulator.PerformNativeRoundTrip}">Perform Native RoundTrip</CheckBox>
<ComboBox IsEnabled="{Binding Emulator.IsStarted,Converter={StaticResource BooleanInverseConverter}}" MinWidth="140" Margin="5" BorderThickness="0" ItemsSource="{Binding Ports}" SelectedItem="{Binding SelectedPort}"></ComboBox>