aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio
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
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')
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml62
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/DefaultMachineProvider.cs3
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs25
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/PowerUpView.xaml2
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/ThreadLoadingView.xaml47
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/ThreadLoadingView.xaml.cs28
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/ThreadLoadingViewVM.cs155
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/Images/thread_loading.gifbin0 -> 4467469 bytes
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/Images/thread_loading.pngbin0 -> 7209 bytes
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj12
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs76
-rw-r--r--Software/Visual_Studio/Tango.BL/Entities/ProcessParametersTable.cs8
-rw-r--r--Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs64
-rw-r--r--Software/Visual_Studio/Tango.Emulations/ExternalBridge/EmulatorExternalBridge.cs1
-rw-r--r--Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeTcpClient.cs1
-rw-r--r--Software/Visual_Studio/Tango.Integration/Operation/IMachineOperator.cs31
-rw-r--r--Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs170
-rw-r--r--Software/Visual_Studio/Tango.Integration/Operation/ThreadLoadingConfirmationRequiredEventArgs.cs27
-rw-r--r--Software/Visual_Studio/Tango.Integration/Tango.Integration.csproj3
-rw-r--r--Software/Visual_Studio/Tango.PMR/Common/MessageType.cs9
-rw-r--r--Software/Visual_Studio/Tango.PMR/Power/PowerDownState.cs28
-rw-r--r--Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj4
-rw-r--r--Software/Visual_Studio/Tango.PMR/ThreadLoading/StopThreadLoadingRequest.cs131
-rw-r--r--Software/Visual_Studio/Tango.PMR/ThreadLoading/StopThreadLoadingResponse.cs131
-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
26 files changed, 1104 insertions, 90 deletions
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml
index 4a2f1e253..5f453c874 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml
@@ -11,7 +11,7 @@
xmlns:global="clr-namespace:Tango.PPC.MachineSettings"
xmlns:local="clr-namespace:Tango.PPC.MachineSettings.Views"
mc:Ignorable="d"
- d:DesignHeight="3000" d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}">
+ d:DesignHeight="3600" d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}">
<Grid Background="{StaticResource TangoMidBackgroundBrush}" IsEnabled="{Binding IsFree}">
<Grid.RowDefinitions>
@@ -242,12 +242,70 @@
<DockPanel Margin="0 40 0 0">
<touch:TouchIcon VerticalAlignment="Top" Icon="InformationOutline" Foreground="{StaticResource TangoGrayTextBrush}"></touch:TouchIcon>
<TextBlock Margin="10 0 0 0" VerticalAlignment="Top" TextWrapping="Wrap" FontSize="{StaticResource TangoSmallFontSize}" Foreground="{StaticResource TangoGrayTextBrush}">
- Once enabled, synchronization occurres automatically in the background. you can choose to synchronize right now.
+ Once enabled, synchronization occurs automatically in the background. you can choose to synchronize right now.
</TextBlock>
</DockPanel>
<touch:TouchButton Command="{Binding SynchronizeCommand}" IsEnabled="{Binding MachineDataSynchronizer.IsEnabled}" HorizontalAlignment="Left" Margin="25 10 0 0" Style="{StaticResource TangoHollowButton}" FontSize="{StaticResource TangoDefaultFontSize}" Padding="15 10" CornerRadius="22">Synchronize Now</touch:TouchButton>
</StackPanel>
</touch:TouchExpander>
+
+ <!--TECHNICIAN-->
+ <touch:TouchExpander Visibility="{Binding ApplicationManager.IsInTechnicianMode,Converter={StaticResource BooleanToVisibilityConverter}}" Margin="0 20 0 0" Header="Advanced" IsExpanded="True" FontSize="{StaticResource TangoExpanderHeaderFontSize}">
+ <StackPanel Margin="10 30 10 10">
+
+ <DockPanel TextElement.FontSize="{StaticResource TangoDefaultFontSize}">
+ <TextBlock VerticalAlignment="Center">Embedded COM Port</TextBlock>
+ <touch:TouchTextBox KeyboardContainer="{Binding ElementName=Container}" Text="{Binding Settings.EmbeddedComPort}" Margin="0 0 100 0" DockPanel.Dock="Right" HorizontalAlignment="Right" Width="90"></touch:TouchTextBox>
+ </DockPanel>
+
+ <DockPanel Margin="0 20 0 0" TextElement.FontSize="{StaticResource TangoDefaultFontSize}">
+ <TextBlock VerticalAlignment="Center">Emergency COM Port</TextBlock>
+ <touch:TouchTextBox KeyboardContainer="{Binding ElementName=Container}" Text="{Binding Settings.EmergencyComPort}" Margin="0 0 100 0" DockPanel.Dock="Right" HorizontalAlignment="Right" Width="90"></touch:TouchTextBox>
+ </DockPanel>
+
+ <DockPanel Margin="0 20 0 0" TextElement.FontSize="{StaticResource TangoDefaultFontSize}">
+ <TextBlock VerticalAlignment="Center">Enable Emergency Screen</TextBlock>
+ <touch:TouchToggleSlider IsChecked="{Binding Settings.EnableEmergencyNotifications}" Margin="0 0 100 0" DockPanel.Dock="Right" Style="{StaticResource TangoToggleButtonGrayAccent}" HorizontalAlignment="Right" Width="90"></touch:TouchToggleSlider>
+ </DockPanel>
+
+ <DockPanel Margin="0 20 0 0" TextElement.FontSize="{StaticResource TangoDefaultFontSize}">
+ <TextBlock VerticalAlignment="Center">Enable Embedded Debug Logs</TextBlock>
+ <touch:TouchToggleSlider IsChecked="{Binding Settings.EnableEmbeddedDebugLogs}" Margin="0 0 100 0" DockPanel.Dock="Right" Style="{StaticResource TangoToggleButtonGrayAccent}" HorizontalAlignment="Right" Width="90"></touch:TouchToggleSlider>
+ </DockPanel>
+
+ <DockPanel Margin="0 20 0 0" TextElement.FontSize="{StaticResource TangoDefaultFontSize}">
+ <TextBlock VerticalAlignment="Center">Enable Automatic Thread Loading Support</TextBlock>
+ <touch:TouchToggleSlider IsChecked="{Binding Settings.EnableAutomaticThreadLoading}" Margin="0 0 100 0" DockPanel.Dock="Right" Style="{StaticResource TangoToggleButtonGrayAccent}" HorizontalAlignment="Right" Width="90"></touch:TouchToggleSlider>
+ </DockPanel>
+
+ <DockPanel Margin="0 20 0 0" TextElement.FontSize="{StaticResource TangoDefaultFontSize}">
+ <TextBlock VerticalAlignment="Center">Display PowerUp Screen</TextBlock>
+ <touch:TouchToggleSlider IsChecked="{Binding Settings.DisplayPowerUpScreen}" Margin="0 0 100 0" DockPanel.Dock="Right" Style="{StaticResource TangoToggleButtonGrayAccent}" HorizontalAlignment="Right" Width="90"></touch:TouchToggleSlider>
+ </DockPanel>
+
+ <DockPanel Margin="0 20 0 0" TextElement.FontSize="{StaticResource TangoDefaultFontSize}">
+ <TextBlock VerticalAlignment="Center">Enable Job Liquid Quantity Validation</TextBlock>
+ <touch:TouchToggleSlider IsChecked="{Binding Settings.EnableJobLiquidQuantityValidation}" Margin="0 0 100 0" DockPanel.Dock="Right" Style="{StaticResource TangoToggleButtonGrayAccent}" HorizontalAlignment="Right" Width="90"></touch:TouchToggleSlider>
+ </DockPanel>
+
+ <DockPanel Margin="0 20 0 0" TextElement.FontSize="{StaticResource TangoDefaultFontSize}">
+ <TextBlock VerticalAlignment="Center">Always Start in Technician Mode</TextBlock>
+ <touch:TouchToggleSlider IsChecked="{Binding Settings.EnableTechnicianModeByDefault}" Margin="0 0 100 0" DockPanel.Dock="Right" Style="{StaticResource TangoToggleButtonGrayAccent}" HorizontalAlignment="Right" Width="90"></touch:TouchToggleSlider>
+ </DockPanel>
+
+ <DockPanel Margin="0 20 0 0" TextElement.FontSize="{StaticResource TangoDefaultFontSize}">
+ <TextBlock VerticalAlignment="Center">Gradient Resolution CM</TextBlock>
+ <touch:TouchNumericTextBox Minimum="10" Maximum="500" KeyboardContainer="{Binding ElementName=Container}" Value="{Binding Settings.GradientGenerationResolution}" Margin="0 0 100 0" DockPanel.Dock="Right" HorizontalAlignment="Right" Width="90"></touch:TouchNumericTextBox>
+ </DockPanel>
+
+ <DockPanel Margin="0 20 0 0">
+ <touch:TouchIcon VerticalAlignment="Top" Icon="InformationOutline" Foreground="{StaticResource TangoGrayTextBrush}"></touch:TouchIcon>
+ <TextBlock Margin="10 0 0 0" VerticalAlignment="Top" TextWrapping="Wrap" FontSize="{StaticResource TangoSmallFontSize}" Foreground="{StaticResource TangoGrayTextBrush}">
+ Please restart the application for advanced settings to take effect.
+ </TextBlock>
+ </DockPanel>
+ </StackPanel>
+ </touch:TouchExpander>
</StackPanel>
</touch:LightTouchScrollViewer>
</Grid>
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/DefaultMachineProvider.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/DefaultMachineProvider.cs
index eae09a7e7..6d90ece73 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/DefaultMachineProvider.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/DefaultMachineProvider.cs
@@ -82,7 +82,8 @@ namespace Tango.PPC.Common.Connection
MachineOperator.UseKeepAlive = true;
MachineOperator.EnableMachineStatusUpdates = true;
MachineOperator.EnableDiagnostics = false;
- MachineOperator.EnableEmbeddedDebugging = true;
+ MachineOperator.EnableEmbeddedDebugging = settings.EnableEmbeddedDebugLogs;
+ MachineOperator.EnableAutomaticThreadLoading = settings.EnableAutomaticThreadLoading;
MachineOperator.FirmwareUpgradeMode = Integration.Upgrade.FirmwareUpgradeModes.DFU | Integration.Upgrade.FirmwareUpgradeModes.TFP_PACKAGE;
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs
index cb17f5be3..96fe39a9b 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs
@@ -200,11 +200,6 @@ namespace Tango.PPC.Common
public String FirmwareVersion { get; set; }
/// <summary>
- /// Gets or sets the last power up selected RML.
- /// </summary>
- public String LastPowerUpSelectedRmlGuid { get; set; }
-
- /// <summary>
/// Gets or sets a value indicating whether to display the power up screen.
/// </summary>
public bool DisplayPowerUpScreen { get; set; }
@@ -220,6 +215,21 @@ namespace Tango.PPC.Common
public bool AutoCheckForUpdates { get; set; }
/// <summary>
+ /// Gets or sets a value indicating whether to enable the automatic thread loading support.
+ /// </summary>
+ public bool EnableAutomaticThreadLoading { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether to display the thread loading screen.
+ /// </summary>
+ public bool DisplayAutomaticThreadLoadingScreen { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether to enable embedded debug logs.
+ /// </summary>
+ public bool EnableEmbeddedDebugLogs { get; set; }
+
+ /// <summary>
/// Gets the machine service address.
/// </summary>
/// <returns></returns>
@@ -259,8 +269,11 @@ namespace Tango.PPC.Common
SynchronizationInterval = TimeSpan.FromMinutes(60);
FirmwareVersion = "1.0.0.0";
DisplayPowerUpScreen = true;
- PowerUpScreenTimeout = TimeSpan.FromSeconds(20);
+ PowerUpScreenTimeout = TimeSpan.FromSeconds(60);
AutoCheckForUpdates = true;
+ EnableAutomaticThreadLoading = true;
+ DisplayAutomaticThreadLoadingScreen = true;
+ EnableEmbeddedDebugLogs = true;
}
}
}
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/PowerUpView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/PowerUpView.xaml
index 776233955..28f922898 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/PowerUpView.xaml
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/PowerUpView.xaml
@@ -20,7 +20,7 @@
<TextBlock VerticalAlignment="Center" Margin="20 0 0 0">Minimal temperature</TextBlock>
</DockPanel>
- <touch:TouchButton Command="{Binding OKCommand}" Margin="0 150 0 0" Style="{StaticResource TangoHollowButton}" HorizontalAlignment="Center" Padding="60 15">CONTINUE</touch:TouchButton>
+ <touch:TouchButton Command="{Binding OKCommand}" Margin="0 150 0 0" Style="{StaticResource TangoHollowButton}" HorizontalAlignment="Center" Padding="60 15" CornerRadius="25">CONTINUE</touch:TouchButton>
<TextBlock HorizontalAlignment="Center" Margin="0 10 0 0" Visibility="{Binding IsTimeoutEnabled,Converter={StaticResource BooleanToVisibilityConverter}}">
<Run>auto select in</Run>
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/ThreadLoadingView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/ThreadLoadingView.xaml
new file mode 100644
index 000000000..98f2e1381
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/ThreadLoadingView.xaml
@@ -0,0 +1,47 @@
+<UserControl x:Class="Tango.PPC.UI.Dialogs.ThreadLoadingView"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch"
+ xmlns:local="clr-namespace:Tango.PPC.UI.Dialogs"
+ mc:Ignorable="d"
+ Background="{StaticResource TangoPrimaryBackgroundBrush}" d:DesignHeight="555" d:DesignWidth="560" Width="600" Height="900" d:DataContext="{d:DesignInstance Type=local:ThreadLoadingViewVM, IsDesignTimeCreatable=False}">
+ <Grid>
+ <DockPanel>
+ <StackPanel Margin="0 30 0 0" HorizontalAlignment="Center" DockPanel.Dock="Top">
+ <Image Source="/Images/thread_loading.png" Stretch="None"></Image>
+ <TextBlock HorizontalAlignment="Center" FontSize="{StaticResource TangoTitleFontSize}" Margin="0 30 0 0">Thread Loading</TextBlock>
+
+ <Grid Height="283">
+ <StackPanel Visibility="{Binding IsFinalizing,Converter={StaticResource BooleanToVisibilityInverseConverter}}">
+ <TextBlock HorizontalAlignment="Center" FontSize="{StaticResource TangoDefaultFontSize}" Margin="40 10 40 0" Foreground="{StaticResource TangoGrayTextBrush}" TextWrapping="Wrap" TextAlignment="Center">
+ The machine is ready for loading the thread. Please load the selected thread below and press 'continue'.
+ </TextBlock>
+ <touch:TouchComboBox Margin="0 40 0 0" Width="300" ItemsSource="{Binding Rmls}" SelectedItem="{Binding SelectedRml}" DisplayMemberPath="Name"></touch:TouchComboBox>
+ <touch:TouchButton Command="{Binding ContinueCommand}" Margin="0 50 0 50" Style="{StaticResource TangoHollowButton}" HorizontalAlignment="Center" Padding="60 15" CornerRadius="25">CONTINUE</touch:TouchButton>
+ </StackPanel>
+ <StackPanel Visibility="{Binding IsFinalizing,Converter={StaticResource BooleanToVisibilityConverter}}">
+ <TextBlock HorizontalAlignment="Center" FontSize="{StaticResource TangoDefaultFontSize}" Margin="40 10 40 0" Foreground="{StaticResource TangoPrimaryAccentBrush}" TextWrapping="Wrap" TextAlignment="Center">
+ The machine is now loading the thread. please wait...
+ </TextBlock>
+ <touch:TouchBusyIndicator Margin="0 100 0 0" Width="100" Height="100" IsIndeterminate="True" />
+ </StackPanel>
+ </Grid>
+ </StackPanel>
+
+ <Grid>
+ <touch:TouchGifAnimation Margin="10" Source="/Images/thread_loading.gif" VerticalAlignment="Bottom" Stretch="UniformToFill" EnableAnimation="{Binding IsVisible}" />
+
+ <!--<Grid VerticalAlignment="Top" Height="100">
+ <Grid.Background>
+ <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
+ <GradientStop Offset="0.3" Color="{StaticResource TangoPrimaryBackgroundColor}" />
+ <GradientStop Offset="0.5" Color="Transparent" />
+ </LinearGradientBrush>
+ </Grid.Background>
+ </Grid>-->
+ </Grid>
+ </DockPanel>
+ </Grid>
+</UserControl>
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/ThreadLoadingView.xaml.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/ThreadLoadingView.xaml.cs
new file mode 100644
index 000000000..d4c737bcc
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/ThreadLoadingView.xaml.cs
@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+
+namespace Tango.PPC.UI.Dialogs
+{
+ /// <summary>
+ /// Interaction logic for PowerUpView.xaml
+ /// </summary>
+ public partial class ThreadLoadingView : UserControl
+ {
+ public ThreadLoadingView()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/ThreadLoadingViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/ThreadLoadingViewVM.cs
new file mode 100644
index 000000000..5e5370416
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/ThreadLoadingViewVM.cs
@@ -0,0 +1,155 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.BL.Entities;
+using Tango.Core.Commands;
+using Tango.Integration.Operation;
+using Tango.PMR.ThreadLoading;
+using Tango.PPC.Common.Connection;
+using Tango.SharedUI;
+
+namespace Tango.PPC.UI.Dialogs
+{
+ public class ThreadLoadingViewVM : DialogViewVM
+ {
+ public class ThreadLoadingResult
+ {
+ public bool IsCompleted { get; set; }
+ public Exception FailedException { get; set; }
+ }
+
+ private ThreadLoadingConfirmationRequiredEventArgs _confirmationArgs;
+
+ public ThreadLoadingResult Result { get; set; }
+
+ public IMachineProvider MachineProvider { get; set; }
+
+ private StartThreadLoadingResponse _status;
+ public StartThreadLoadingResponse Status
+ {
+ get { return _status; }
+ set { _status = value; RaisePropertyChangedAuto(); }
+ }
+
+ private bool _isFinalizing;
+ public bool IsFinalizing
+ {
+ get { return _isFinalizing; }
+ set { _isFinalizing = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); }
+ }
+
+ public List<Rml> Rmls { get; set; }
+
+ private Rml _selectedRml;
+ public Rml SelectedRml
+ {
+ get { return _selectedRml; }
+ set { _selectedRml = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); }
+ }
+
+ public RelayCommand ContinueCommand { get; set; }
+
+ public ThreadLoadingViewVM(IMachineProvider machineProvider, ThreadLoadingConfirmationRequiredEventArgs confirmationArgs)
+ {
+ CanClose = true;
+ _confirmationArgs = confirmationArgs;
+ ContinueCommand = new RelayCommand(ContinueThreadLoading, () => !IsFinalizing && SelectedRml != null);
+ MachineProvider = machineProvider;
+ MachineProvider.MachineOperator.ThreadLoadingStatusChanged += MachineOperator_ThreadLoadingStatusChanged;
+ MachineProvider.MachineOperator.ThreadLoadingCompleted += MachineOperator_ThreadLoadingCompleted;
+ MachineProvider.MachineOperator.ThreadLoadingFailed += MachineOperator_ThreadLoadingFailed;
+ }
+
+ private async void ContinueThreadLoading()
+ {
+ IsFinalizing = true;
+
+ try
+ {
+ await Task.Factory.StartNew(() => { _confirmationArgs.Confirm(SelectedRml.GetActiveProcessGroup().ProcessParametersTables.FirstOrDefault()); });
+ }
+ catch (Exception ex)
+ {
+ Result = new ThreadLoadingResult()
+ {
+ FailedException = ex,
+ };
+
+ IsFinalizing = false;
+
+ if (IsVisible)
+ {
+ InvokeUI(() =>
+ {
+ Accept();
+ });
+ }
+ }
+ }
+
+ private void MachineOperator_ThreadLoadingCompleted(object sender, StartThreadLoadingResponse e)
+ {
+ Result = new ThreadLoadingResult()
+ {
+ IsCompleted = true
+ };
+
+ if (IsVisible)
+ {
+ InvokeUI(() =>
+ {
+ Accept();
+ });
+ }
+ }
+
+ private void MachineOperator_ThreadLoadingFailed(object sender, StartThreadLoadingResponse e)
+ {
+ Result = new ThreadLoadingResult()
+ {
+ FailedException = new Exception(e.ErrorReason),
+ };
+
+ if (IsVisible)
+ {
+ InvokeUI(() =>
+ {
+ Accept();
+ });
+ }
+ }
+
+ private void MachineOperator_ThreadLoadingStatusChanged(object sender, StartThreadLoadingResponse e)
+ {
+ Status = e;
+
+ if(Status.State == ThreadLoadingState.Finalizing)
+ {
+ IsFinalizing = true;
+ }
+ }
+
+ protected override void Cancel()
+ {
+ IsFinalizing = false;
+ ClearEvents();
+ base.Cancel();
+ }
+
+ protected override void Accept()
+ {
+ IsFinalizing = false;
+ ClearEvents();
+ base.Accept();
+ }
+
+ private void ClearEvents()
+ {
+ MachineProvider.MachineOperator.ThreadLoadingStatusChanged -= MachineOperator_ThreadLoadingStatusChanged;
+ MachineProvider.MachineOperator.ThreadLoadingCompleted -= MachineOperator_ThreadLoadingCompleted;
+ MachineProvider.MachineOperator.ThreadLoadingFailed -= MachineOperator_ThreadLoadingFailed;
+ }
+ }
+}
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/thread_loading.gif b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/thread_loading.gif
new file mode 100644
index 000000000..a89f37004
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/thread_loading.gif
Binary files differ
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/thread_loading.png b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/thread_loading.png
new file mode 100644
index 000000000..5d536e7ae
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/thread_loading.png
Binary files differ
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj b/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj
index 49b0c81d1..0dbabbf56 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj
@@ -136,6 +136,9 @@
<DependentUpon>InsufficientLiquidQuantityView.xaml</DependentUpon>
</Compile>
<Compile Include="Dialogs\InsufficientLiquidQuantityViewVM.cs" />
+ <Compile Include="Dialogs\ThreadLoadingView.xaml.cs">
+ <DependentUpon>ThreadLoadingView.xaml</DependentUpon>
+ </Compile>
<Compile Include="Dialogs\PowerUpView.xaml.cs">
<DependentUpon>PowerUpView.xaml</DependentUpon>
</Compile>
@@ -149,6 +152,7 @@
</Compile>
<Compile Include="Dialogs\ScreenLockViewVM.cs" />
<Compile Include="Dialogs\TechnicianModeLoginViewVM.cs" />
+ <Compile Include="Dialogs\ThreadLoadingViewVM.cs" />
<Compile Include="Dialogs\UpdateFromFileView.xaml.cs">
<DependentUpon>UpdateFromFileView.xaml</DependentUpon>
</Compile>
@@ -246,6 +250,10 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
+ <Page Include="Dialogs\ThreadLoadingView.xaml">
+ <Generator>MSBuild:Compile</Generator>
+ <SubType>Designer</SubType>
+ </Page>
<Page Include="Dialogs\PowerUpView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
@@ -409,6 +417,8 @@
<Resource Include="Images\update_available.png" />
<Resource Include="Images\powerup.gif" />
<Resource Include="Images\power_off.gif" />
+ <Resource Include="Images\thread_loading.gif" />
+ <Resource Include="Images\thread_loading.png" />
<Content Include="Manifests\release.xml" />
<Content Include="Manifests\debug.xml" />
<None Include="firmware_package.tfp">
@@ -671,7 +681,7 @@ if $(ConfigurationName) == Debug copy /Y "$(TargetDir)Packages" "$(TargetDir)"</
</PropertyGroup>
<ProjectExtensions>
<VisualStudio>
- <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" />
+ <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" />
</VisualStudio>
</ProjectExtensions>
</Project> \ No newline at end of file
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs
index 8a4d20b76..eeb11ffab 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs
@@ -63,6 +63,7 @@ namespace Tango.PPC.UI.ViewModels
base.OnApplicationReady();
MachineProvider.MachineOperator.CartridgeValidationRequestReceived += MachineOperator_CartridgeValidationRequestReceived;
MachineProvider.MachineOperator.PowerUpStarted += MachineOperator_PowerUpStarted;
+ MachineProvider.MachineOperator.ThreadLoadingConfirmationRequired += MachineOperator_ThreadLoadingConfirmationRequired;
}
#region Event Handlers
@@ -120,7 +121,7 @@ namespace Tango.PPC.UI.ViewModels
rmls = await new RmlsCollectionBuilder(db).SetAll().WithSite(MachineProvider.Machine.SiteGuid).BuildListAsync();
}
- var selectedRml = rmls.SingleOrDefault(x => x.Guid == Settings.LastPowerUpSelectedRmlGuid);
+ var selectedRml = rmls.SingleOrDefault(x => x.Guid == Settings.LoadedRmlGuid);
vm = new PowerUpViewVM();
vm.Rmls = rmls;
@@ -165,7 +166,7 @@ namespace Tango.PPC.UI.ViewModels
LogManager.Log("Uploading process parameters...");
var r = MachineProvider.MachineOperator.UploadProcessParameters(processToLoad).Result;
- Settings.LastPowerUpSelectedRmlGuid = vm.IsSelectedRml ? vm.SelectedRml.Guid : null;
+ Settings.LoadedRmlGuid = vm.IsSelectedRml ? vm.SelectedRml.Guid : null;
Settings.Save();
}
}
@@ -177,6 +178,77 @@ namespace Tango.PPC.UI.ViewModels
});
}
+ private async void MachineOperator_ThreadLoadingConfirmationRequired(object sender, ThreadLoadingConfirmationRequiredEventArgs e)
+ {
+ LogManager.Log("Thread loading confirmation detected, showing thread loading screen...");
+
+ if (!Settings.DisplayAutomaticThreadLoadingScreen)
+ {
+ LogManager.Log("Thread loading screen disabled. skipping...");
+ return;
+ }
+
+ ThreadLoadingViewVM vm;
+
+ try
+ {
+ LogManager.Log("Loading site rmls...");
+
+ List<Rml> rmls = new List<Rml>();
+
+ using (ObservablesContext db = ObservablesContext.CreateDefault())
+ {
+ rmls = await new RmlsCollectionBuilder(db).SetAll().WithSite(MachineProvider.Machine.SiteGuid).WithActiveParametersGroup().BuildListAsync();
+ }
+
+ var selectedRml = rmls.SingleOrDefault(x => x.Guid == Settings.LoadedRmlGuid);
+
+ vm = new ThreadLoadingViewVM(MachineProvider, e);
+ vm.Rmls = rmls;
+ vm.SelectedRml = selectedRml != null ? selectedRml : rmls.FirstOrDefault();
+ }
+ catch (Exception ex)
+ {
+ LogManager.Log(ex, "Error initializing thread loading screen.");
+ return;
+ }
+
+ InvokeUI(async () =>
+ {
+ await NotificationProvider.ShowDialog<ThreadLoadingViewVM>(vm);
+
+ LogManager.Log("Thread loading screen closed.");
+
+ if (!vm.DialogResult)
+ {
+ LogManager.Log("Thread loading screen aborted by user. No operation was performed.");
+ return;
+ }
+
+ try
+ {
+ if (vm.Result.IsCompleted)
+ {
+ await NotificationProvider.ShowSuccess("Thread loading completed successfully.");
+ }
+ else
+ {
+ await NotificationProvider.ShowError($"Thread loading failed due to the following reason:\n{vm.Result.FailedException.FlattenException()}");
+ }
+
+ if (vm.SelectedRml != null)
+ {
+ Settings.LoadedRmlGuid = vm.SelectedRml.Guid;
+ Settings.Save();
+ }
+ }
+ catch (Exception ex)
+ {
+ LogManager.Log(ex, "Error occurred after thread loading screen closed.");
+ }
+ });
+ }
+
#endregion
}
}
diff --git a/Software/Visual_Studio/Tango.BL/Entities/ProcessParametersTable.cs b/Software/Visual_Studio/Tango.BL/Entities/ProcessParametersTable.cs
index a0df58c08..729d01951 100644
--- a/Software/Visual_Studio/Tango.BL/Entities/ProcessParametersTable.cs
+++ b/Software/Visual_Studio/Tango.BL/Entities/ProcessParametersTable.cs
@@ -5,6 +5,7 @@ using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using Tango.Core.ExtensionMethods;
namespace Tango.BL.Entities
{
@@ -58,5 +59,12 @@ namespace Tango.BL.Entities
return heaters.Average();
}
+
+ public PMR.Printing.ProcessParameters ToProcessParametersPMR()
+ {
+ PMR.Printing.ProcessParameters p = new PMR.Printing.ProcessParameters();
+ this.MapPrimitivesTo(p);
+ return p;
+ }
}
}
diff --git a/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs b/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs
index e4b081e9e..7537e4676 100644
--- a/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs
+++ b/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs
@@ -33,6 +33,7 @@ using System.Diagnostics;
using Tango.Core.ExtensionMethods;
using Tango.PMR.MachineStatus;
using Tango.PMR.Power;
+using Tango.PMR.ThreadLoading;
namespace Tango.Emulations.Emulators
{
@@ -51,6 +52,7 @@ namespace Tango.Emulations.Emulators
}
private const int MAX_CHUNK_LENGTH = 4000;
+ private static Random _rnd = new Random();
private StartDiagnosticsRequest _diagnosticsRequest;
private bool _cancelJob;
private List<PMR.Hardware.HardwareMotorType> _motorJoggingRequestTypes;
@@ -76,6 +78,8 @@ namespace Tango.Emulations.Emulators
private FileUploadRequest _lastFileUploadRequest;
private bool _isAfterReset;
private bool _abortPowerDown;
+ private bool _isThreadLoadingStarted;
+ private String _threadLoadingToken;
#region Properties
@@ -405,6 +409,12 @@ namespace Tango.Emulations.Emulators
case MessageType.AbortPowerDownRequest:
HandleAbortPowerDownRequest(MessageFactory.ParseTangoMessageFromContainer<AbortPowerDownRequest>(container));
break;
+ case MessageType.StartThreadLoadingRequest:
+ HandleStartThreadLoadingRequest(MessageFactory.ParseTangoMessageFromContainer<StartThreadLoadingRequest>(container));
+ break;
+ case MessageType.ContinueThreadLoadingRequest:
+ HandleContinueThreadLoadingRequest(MessageFactory.ParseTangoMessageFromContainer<ContinueThreadLoadingRequest>(container));
+ break;
}
}
@@ -1383,7 +1393,7 @@ namespace Tango.Emulations.Emulators
{
ProgressPercentage = 100,
Message = "Machine is turned off",
- State = PowerDownState.Completed
+ State = PowerDownState.PowerOffCompleted
}, request.Container.Token, true);
});
}
@@ -1395,6 +1405,38 @@ namespace Tango.Emulations.Emulators
await Transporter.SendResponse<AbortPowerDownResponse>(new AbortPowerDownResponse(), request.Container.Token);
}
+ private async void HandleStartThreadLoadingRequest(TangoMessage<StartThreadLoadingRequest> request)
+ {
+ _isThreadLoadingStarted = true;
+ _threadLoadingToken = request.Container.Token;
+ await Transporter.SendResponse<StartThreadLoadingResponse>(new StartThreadLoadingResponse(), request.Container.Token);
+ }
+
+ private async void HandleContinueThreadLoadingRequest(TangoMessage<ContinueThreadLoadingRequest> request)
+ {
+ if (_threadLoadingToken != null)
+ {
+ await Transporter.SendResponse<ContinueThreadLoadingResponse>(new ContinueThreadLoadingResponse(), request.Container.Token);
+
+ await Task.Delay(1000);
+ await Transporter.SendResponse<StartThreadLoadingResponse>(new StartThreadLoadingResponse() { State = ThreadLoadingState.Finalizing }, _threadLoadingToken);
+ await Task.Delay(8000);
+
+ if (_rnd.Next(0, 100) > 50)
+ {
+ await Transporter.SendResponse<StartThreadLoadingResponse>(new StartThreadLoadingResponse() { State = ThreadLoadingState.Completed }, _threadLoadingToken);
+ }
+ else
+ {
+ await Transporter.SendResponse<StartThreadLoadingResponse>(new StartThreadLoadingResponse() { State = ThreadLoadingState.FinalizationError, ErrorReason = "Emulator random error." }, _threadLoadingToken);
+ }
+ }
+ else
+ {
+ await Transporter.SendResponse<ContinueThreadLoadingResponse>(new ContinueThreadLoadingResponse(), request.Container.Token, null, ErrorCode.GeneralError, "StartThreadLoadingRequest was never sent.");
+ }
+ }
+
#endregion
#region Public Methods
@@ -1410,6 +1452,26 @@ namespace Tango.Emulations.Emulators
return response.Message.Index;
}
+ public async void StartThreadLoading()
+ {
+ await Transporter.SendResponse<StartThreadLoadingResponse>(new StartThreadLoadingResponse() { State = ThreadLoadingState.ReadyForLoading }, _threadLoadingToken);
+ }
+
+ public async void FinalizeThreadLoading()
+ {
+ await Transporter.SendResponse<StartThreadLoadingResponse>(new StartThreadLoadingResponse() { State = ThreadLoadingState.Finalizing }, _threadLoadingToken);
+ await Task.Delay(3000);
+
+ if (_rnd.Next(0, 100) > 50)
+ {
+ await Transporter.SendResponse<StartThreadLoadingResponse>(new StartThreadLoadingResponse() { State = ThreadLoadingState.Completed }, _threadLoadingToken);
+ }
+ else
+ {
+ await Transporter.SendResponse<StartThreadLoadingResponse>(new StartThreadLoadingResponse() { State = ThreadLoadingState.FinalizationError, ErrorReason = "Emulator random error." }, _threadLoadingToken);
+ }
+ }
+
#endregion
}
}
diff --git a/Software/Visual_Studio/Tango.Emulations/ExternalBridge/EmulatorExternalBridge.cs b/Software/Visual_Studio/Tango.Emulations/ExternalBridge/EmulatorExternalBridge.cs
index c1aaa3cd6..1fba528f8 100644
--- a/Software/Visual_Studio/Tango.Emulations/ExternalBridge/EmulatorExternalBridge.cs
+++ b/Software/Visual_Studio/Tango.Emulations/ExternalBridge/EmulatorExternalBridge.cs
@@ -44,6 +44,7 @@ namespace Tango.Emulations.ExternalBridge
EnableDiagnostics = true;
EnableEmbeddedDebugging = true;
EnableEventsNotification = true;
+ EnableAutomaticThreadLoading = true;
String address = new string(Guid.NewGuid().ToString().Replace("-", "").TakeLast(4).ToArray());
diff --git a/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeTcpClient.cs b/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeTcpClient.cs
index 3bbef3eb6..d3344aa16 100644
--- a/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeTcpClient.cs
+++ b/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeTcpClient.cs
@@ -133,6 +133,7 @@ namespace Tango.Integration.ExternalBridge
OnEnableEventsNotification(EnableEventsNotification);
OnEnableApplicationLogsChanged(EnableApplicationLogs);
OnEnableMachineStatusUpdatesChanged(EnableMachineStatusUpdates);
+ OnEnableAutomaticThreadLoadingChanged(EnableAutomaticThreadLoading);
}
}
diff --git a/Software/Visual_Studio/Tango.Integration/Operation/IMachineOperator.cs b/Software/Visual_Studio/Tango.Integration/Operation/IMachineOperator.cs
index b5b7b7393..8156ef8c7 100644
--- a/Software/Visual_Studio/Tango.Integration/Operation/IMachineOperator.cs
+++ b/Software/Visual_Studio/Tango.Integration/Operation/IMachineOperator.cs
@@ -23,6 +23,7 @@ using Tango.PMR.FirmwareUpgrade;
using Tango.Integration.JobRuns;
using Tango.Integration.Emergency;
using Tango.PMR.MachineStatus;
+using Tango.PMR.ThreadLoading;
namespace Tango.Integration.Operation
{
@@ -64,6 +65,11 @@ namespace Tango.Integration.Operation
MachineStatus MachineStatus { get; }
/// <summary>
+ /// Gets the current thread loading status.
+ /// </summary>
+ StartThreadLoadingResponse ThreadLoadingStatus { get; }
+
+ /// <summary>
/// Gets or sets the firmware upgrade mode.
/// </summary>
FirmwareUpgradeModes FirmwareUpgradeMode { get; set; }
@@ -199,6 +205,26 @@ namespace Tango.Integration.Operation
event EventHandler<PowerDownStartedEventArgs> PowerDownStarted;
/// <summary>
+ /// Occurs when the thread loading status has changed.
+ /// </summary>
+ event EventHandler<StartThreadLoadingResponse> ThreadLoadingStatusChanged;
+
+ /// <summary>
+ /// Occurs when a thread loading confirmation is required.
+ /// </summary>
+ event EventHandler<ThreadLoadingConfirmationRequiredEventArgs> ThreadLoadingConfirmationRequired;
+
+ /// <summary>
+ /// Occurs when thread loading has completed.
+ /// </summary>
+ event EventHandler<StartThreadLoadingResponse> ThreadLoadingCompleted;
+
+ /// <summary>
+ /// Occurs when thread loading has failed.
+ /// </summary>
+ event EventHandler<StartThreadLoadingResponse> ThreadLoadingFailed;
+
+ /// <summary>
/// Gets or sets a value indicating whether direct the embedded device to send diagnostics messages.
/// </summary>
bool EnableDiagnostics { get; set; }
@@ -224,6 +250,11 @@ namespace Tango.Integration.Operation
bool EnableMachineStatusUpdates { get; set; }
/// <summary>
+ /// Gets or sets a value indicating whether to enable automatic thread loading support.
+ /// </summary>
+ bool EnableAutomaticThreadLoading { get; set; }
+
+ /// <summary>
/// Gets the last process parameters table sent to the embedded device.
/// </summary>
ProcessParametersTable CurrentProcessParameters { get; }
diff --git a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs
index e142066b6..74c64930b 100644
--- a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs
+++ b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs
@@ -42,6 +42,7 @@ using Newtonsoft.Json;
using Tango.PMR.Integration;
using System.Globalization;
using Tango.PMR.Power;
+using Tango.PMR.ThreadLoading;
namespace Tango.Integration.Operation
{
@@ -68,6 +69,7 @@ namespace Tango.Integration.Operation
private bool _eventsSent;
private bool _debugSent;
private bool _machineStatusSent;
+ private bool _threadLoadingSent;
private EmbeddedLogItem _last_embedded_debug_log;
private static RunningJobStatus _last_job_status;
private bool _isPowerDownRequestInProgress;
@@ -224,6 +226,26 @@ namespace Tango.Integration.Operation
/// </summary>
public event EventHandler<PowerDownStartedEventArgs> PowerDownStarted;
+ /// <summary>
+ /// Occurs when the thread loading status has changed.
+ /// </summary>
+ public event EventHandler<StartThreadLoadingResponse> ThreadLoadingStatusChanged;
+
+ /// <summary>
+ /// Occurs when a thread loading confirmation is required.
+ /// </summary>
+ public event EventHandler<ThreadLoadingConfirmationRequiredEventArgs> ThreadLoadingConfirmationRequired;
+
+ /// <summary>
+ /// Occurs when thread loading has completed.
+ /// </summary>
+ public event EventHandler<StartThreadLoadingResponse> ThreadLoadingCompleted;
+
+ /// <summary>
+ /// Occurs when thread loading has failed.
+ /// </summary>
+ public event EventHandler<StartThreadLoadingResponse> ThreadLoadingFailed;
+
#endregion
#region Properties
@@ -271,7 +293,17 @@ namespace Tango.Integration.Operation
public MachineStatus MachineStatus
{
get { return _machineStatus; }
- set { _machineStatus = value; RaisePropertyChangedAuto(); }
+ private set { _machineStatus = value; RaisePropertyChangedAuto(); }
+ }
+
+ private StartThreadLoadingResponse _threadLoadingStatus;
+ /// <summary>
+ /// Gets the current thread loading status.
+ /// </summary>
+ public StartThreadLoadingResponse ThreadLoadingStatus
+ {
+ get { return _threadLoadingStatus; }
+ private set { _threadLoadingStatus = value; RaisePropertyChangedAuto(); }
}
/// <summary>
@@ -409,6 +441,21 @@ namespace Tango.Integration.Operation
}
}
+ private bool _enableAutomaticThreadLoading;
+ /// <summary>
+ /// Gets or sets a value indicating whether to enable automatic thread loading support.
+ /// </summary>
+ public bool EnableAutomaticThreadLoading
+ {
+ get { return _enableAutomaticThreadLoading; }
+ set
+ {
+ _enableAutomaticThreadLoading = value;
+ RaisePropertyChangedAuto();
+ OnEnableAutomaticThreadLoadingChanged(value);
+ }
+ }
+
private bool _enableJobResume;
/// <summary>
/// Gets or sets a value indicating whether to check whether a job is in progress after connection was successful.
@@ -745,6 +792,65 @@ namespace Tango.Integration.Operation
}
}
+ protected virtual async void OnEnableAutomaticThreadLoadingChanged(bool value)
+ {
+ if (value && State == TransportComponentState.Connected && !_threadLoadingSent)
+ {
+ var request = new StartThreadLoadingRequest();
+
+ bool responseLogged = false;
+ _threadLoadingSent = true;
+
+ SendContinuousRequest<StartThreadLoadingRequest, StartThreadLoadingResponse>(request).ObserveOn(new NewThreadScheduler()).Subscribe(
+ (response) =>
+ {
+ OnThreadLoadingStatusChanged(response);
+
+ if (!responseLogged)
+ {
+ LogResponseReceived(response.Message);
+ responseLogged = true;
+ }
+ },
+ (ex) =>
+ {
+ _threadLoadingSent = false;
+
+ if (!(ex is ContinuousResponseAbortedException))
+ {
+ LogRequestFailed(request, ex);
+ }
+ },
+ () =>
+ {
+ _threadLoadingSent = false;
+ LogManager.Log("Thread loading response completed!?", LogCategory.Warning);
+ });
+
+ LogRequestSent(request);
+ }
+ else if (_threadLoadingSent)
+ {
+ _threadLoadingSent = false;
+
+ if (State == TransportComponentState.Connected)
+ {
+ var req = new StopThreadLoadingRequest();
+
+ try
+ {
+ LogRequestSent(req);
+ var res = await SendRequest<StopThreadLoadingRequest, StopThreadLoadingResponse>(req);
+ LogResponseReceived(res.Message);
+ }
+ catch (Exception ex)
+ {
+ LogRequestFailed(req, ex);
+ }
+ }
+ }
+ }
+
/// <summary>
/// Invokes the <see cref="DiagnosticsDataAvailable"/> event.
/// </summary>
@@ -797,7 +903,7 @@ namespace Tango.Integration.Operation
}
/// <summary>
- /// Called when the machine status has been update
+ /// Called when the machine status has been updated.
/// </summary>
/// <param name="response">The response.</param>
protected async virtual void OnMachineStatusChanged(StartMachineStatusUpdateResponse response)
@@ -824,9 +930,9 @@ namespace Tango.Integration.Operation
case MachineState.Ready:
Status = MachineStatuses.ReadyToDye;
break;
- //case MachineState.Sleep:
- // Status = MachineStatuses.Standby;
- // break;
+ case MachineState.Sleep:
+ Status = MachineStatuses.Standby;
+ break;
case MachineState.PowerOff:
Status = MachineStatuses.ShuttingDown;
if (!_isPowerDownRequestInProgress)
@@ -846,6 +952,59 @@ namespace Tango.Integration.Operation
}
/// <summary>
+ /// Called when the thread loading status has been changed.
+ /// </summary>
+ /// <param name="response">The response.</param>
+ protected virtual void OnThreadLoadingStatusChanged(StartThreadLoadingResponse response)
+ {
+ bool changed = (ThreadLoadingStatus == null || response.State != ThreadLoadingStatus.State || response.ErrorReason != ThreadLoadingStatus.ErrorReason);
+
+ if (changed)
+ {
+ ThreadLoadingStatus = response;
+ ThreadLoadingStatusChanged?.Invoke(this, response);
+
+ LogManager.Log($"Thread Loading Status Changed: {ThreadLoadingStatus.State}.");
+
+ switch (ThreadLoadingStatus.State)
+ {
+ case ThreadLoadingState.ReadyForLoading:
+
+ LogManager.Log("Thread loading is ready for loading. Invoking confirmation event...");
+
+ ThreadLoadingConfirmationRequired?.Invoke(this, new ThreadLoadingConfirmationRequiredEventArgs((processTable) =>
+ {
+ //Confirm Action
+ try
+ {
+ var process = processTable.ToProcessParametersPMR();
+ LogManager.Log($"Thread loading confirmation received with process parameters:\n{process.ToJsonString()}");
+ LogManager.Log("Sending continue thread loading request...");
+ var r = SendRequest<ContinueThreadLoadingRequest, ContinueThreadLoadingResponse>(new ContinueThreadLoadingRequest()
+ {
+ ProcessParameters = process,
+ }).Result;
+ }
+ catch (Exception ex)
+ {
+ LogManager.Log(ex, "Error confirming thread loading sequence.");
+ }
+ })
+ {
+ Status = ThreadLoadingStatus,
+ });
+ break;
+ case ThreadLoadingState.Completed:
+ ThreadLoadingCompleted?.Invoke(this, ThreadLoadingStatus);
+ break;
+ case ThreadLoadingState.FinalizationError:
+ ThreadLoadingFailed?.Invoke(this, ThreadLoadingStatus);
+ break;
+ }
+ }
+ }
+
+ /// <summary>
/// Called when the request has been sent
/// </summary>
/// <param name="response">The request.</param>
@@ -1065,6 +1224,7 @@ namespace Tango.Integration.Operation
OnEnableEmbeddedDebuggingChanged(EnableEmbeddedDebugging);
OnEnableEventsNotification(EnableEventsNotification);
OnEnableMachineStatusUpdatesChanged(EnableMachineStatusUpdates);
+ OnEnableAutomaticThreadLoadingChanged(EnableAutomaticThreadLoading);
if (EnableJobResume)
{
diff --git a/Software/Visual_Studio/Tango.Integration/Operation/ThreadLoadingConfirmationRequiredEventArgs.cs b/Software/Visual_Studio/Tango.Integration/Operation/ThreadLoadingConfirmationRequiredEventArgs.cs
new file mode 100644
index 000000000..e5594dd01
--- /dev/null
+++ b/Software/Visual_Studio/Tango.Integration/Operation/ThreadLoadingConfirmationRequiredEventArgs.cs
@@ -0,0 +1,27 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.BL.Entities;
+using Tango.PMR.ThreadLoading;
+
+namespace Tango.Integration.Operation
+{
+ public class ThreadLoadingConfirmationRequiredEventArgs : EventArgs
+ {
+ private Action<ProcessParametersTable> _confirm;
+
+ public StartThreadLoadingResponse Status { get; set; }
+
+ internal ThreadLoadingConfirmationRequiredEventArgs(Action<ProcessParametersTable> confirm)
+ {
+ _confirm = confirm;
+ }
+
+ public void Confirm(ProcessParametersTable processTable)
+ {
+ _confirm.Invoke(processTable);
+ }
+ }
+}
diff --git a/Software/Visual_Studio/Tango.Integration/Tango.Integration.csproj b/Software/Visual_Studio/Tango.Integration/Tango.Integration.csproj
index 5a4fcadf1..a3feac546 100644
--- a/Software/Visual_Studio/Tango.Integration/Tango.Integration.csproj
+++ b/Software/Visual_Studio/Tango.Integration/Tango.Integration.csproj
@@ -112,6 +112,7 @@
<Compile Include="Operation\PowerDownStatusChangedEventArgs.cs" />
<Compile Include="Operation\PreparingJobProgressEventArgs.cs" />
<Compile Include="Operation\SpoolChangeRequiredEventArgs.cs" />
+ <Compile Include="Operation\ThreadLoadingConfirmationRequiredEventArgs.cs" />
<Compile Include="Upgrade\FirmwareUpgradeHandler.cs" />
<Compile Include="Upgrade\FirmwareUpgradeModes.cs" />
<Compile Include="Upgrade\FirmwareUpgradeProgressEventArgs.cs" />
@@ -198,7 +199,7 @@
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<ProjectExtensions>
<VisualStudio>
- <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" />
+ <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" />
</VisualStudio>
</ProjectExtensions>
</Project> \ No newline at end of file
diff --git a/Software/Visual_Studio/Tango.PMR/Common/MessageType.cs b/Software/Visual_Studio/Tango.PMR/Common/MessageType.cs
index 77ebbef51..d50803fed 100644
--- a/Software/Visual_Studio/Tango.PMR/Common/MessageType.cs
+++ b/Software/Visual_Studio/Tango.PMR/Common/MessageType.cs
@@ -22,7 +22,7 @@ namespace Tango.PMR.Common {
static MessageTypeReflection() {
byte[] descriptorData = global::System.Convert.FromBase64String(
string.Concat(
- "ChFNZXNzYWdlVHlwZS5wcm90bxIQVGFuZ28uUE1SLkNvbW1vbiqwNgoLTWVz",
+ "ChFNZXNzYWdlVHlwZS5wcm90bxIQVGFuZ28uUE1SLkNvbW1vbirvNgoLTWVz",
"c2FnZVR5cGUSCAoETm9uZRAAEhEKDUVycm9yUmVzcG9uc2UQARIUChBDYWxj",
"dWxhdGVSZXF1ZXN0EAMSFQoRQ2FsY3VsYXRlUmVzcG9uc2UQBBITCg9Qcm9n",
"cmVzc1JlcXVlc3QQBRIUChBQcm9ncmVzc1Jlc3BvbnNlEAYSHAoYU3R1YkNh",
@@ -177,8 +177,9 @@ namespace Tango.PMR.Common {
"Ym9ydFBvd2VyRG93blJlc3BvbnNlEJNOEh4KGVN0YXJ0VGhyZWFkTG9hZGlu",
"Z1JlcXVlc3QQ+FUSHwoaU3RhcnRUaHJlYWRMb2FkaW5nUmVzcG9uc2UQ+VUS",
"IQocQ29udGludWVUaHJlYWRMb2FkaW5nUmVxdWVzdBD6VRIiCh1Db250aW51",
- "ZVRocmVhZExvYWRpbmdSZXNwb25zZRD7VUIcChpjb20udHdpbmUudGFuZ28u",
- "cG1yLmNvbW1vbmIGcHJvdG8z"));
+ "ZVRocmVhZExvYWRpbmdSZXNwb25zZRD7VRIdChhTdG9wVGhyZWFkTG9hZGlu",
+ "Z1JlcXVlc3QQ/FUSHgoZU3RvcFRocmVhZExvYWRpbmdSZXNwb25zZRD9VUIc",
+ "Chpjb20udHdpbmUudGFuZ28ucG1yLmNvbW1vbmIGcHJvdG8z"));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
new pbr::FileDescriptor[] { },
new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Tango.PMR.Common.MessageType), }, null));
@@ -470,6 +471,8 @@ namespace Tango.PMR.Common {
[pbr::OriginalName("StartThreadLoadingResponse")] StartThreadLoadingResponse = 11001,
[pbr::OriginalName("ContinueThreadLoadingRequest")] ContinueThreadLoadingRequest = 11002,
[pbr::OriginalName("ContinueThreadLoadingResponse")] ContinueThreadLoadingResponse = 11003,
+ [pbr::OriginalName("StopThreadLoadingRequest")] StopThreadLoadingRequest = 11004,
+ [pbr::OriginalName("StopThreadLoadingResponse")] StopThreadLoadingResponse = 11005,
}
#endregion
diff --git a/Software/Visual_Studio/Tango.PMR/Power/PowerDownState.cs b/Software/Visual_Studio/Tango.PMR/Power/PowerDownState.cs
index 92ac94dc2..2d0396ddc 100644
--- a/Software/Visual_Studio/Tango.PMR/Power/PowerDownState.cs
+++ b/Software/Visual_Studio/Tango.PMR/Power/PowerDownState.cs
@@ -22,9 +22,15 @@ namespace Tango.PMR.Power {
static PowerDownStateReflection() {
byte[] descriptorData = global::System.Convert.FromBase64String(
string.Concat(
- "ChRQb3dlckRvd25TdGF0ZS5wcm90bxIPVGFuZ28uUE1SLlBvd2VyKikKDlBv",
- "d2VyRG93blN0YXRlEggKBE5vbmUQABINCglDb21wbGV0ZWQQAUIbChljb20u",
- "dHdpbmUudGFuZ28ucG1yLnBvd2VyYgZwcm90bzM="));
+ "ChRQb3dlckRvd25TdGF0ZS5wcm90bxIPVGFuZ28uUE1SLlBvd2VyKqYCCg5Q",
+ "b3dlckRvd25TdGF0ZRIICgROb25lEAASCAoESW5pdBABEhIKDlN0b3BSdW5u",
+ "aW5nSm9iEAISDQoJSGVhZENsZWFuEAMSDgoKTWl4ZXJGbHVzaBAEEg4KCkhl",
+ "YXRlcnNPZmYQBRINCglTdG9yZURhdGEQBhIUChBTZXRWYWx2ZVBvc2l0aW9u",
+ "EAcSFgoSV2FpdEZvclRlbXBlcmF0dXJlEAgSFAoQV2FpdEZvclByb2Nlc3Nl",
+ "cxAJEhMKD1R1cm5PZmZEcnllckZhbhAKEhEKDVR1cm5PZmZDb29sZXIQCxIR",
+ "Cg1UdXJuT2ZmQmxvd2VyEAwSFQoRUG93ZXJPZmZDb21wbGV0ZWQQDRIJCgVF",
+ "cnJvchAOEg0KCUNhbmNlbGxlZBAPQhsKGWNvbS50d2luZS50YW5nby5wbXIu",
+ "cG93ZXJiBnByb3RvMw=="));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
new pbr::FileDescriptor[] { },
new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Tango.PMR.Power.PowerDownState), }, null));
@@ -38,7 +44,21 @@ namespace Tango.PMR.Power {
///Fill the states.
/// </summary>
[pbr::OriginalName("None")] None = 0,
- [pbr::OriginalName("Completed")] Completed = 1,
+ [pbr::OriginalName("Init")] Init = 1,
+ [pbr::OriginalName("StopRunningJob")] StopRunningJob = 2,
+ [pbr::OriginalName("HeadClean")] HeadClean = 3,
+ [pbr::OriginalName("MixerFlush")] MixerFlush = 4,
+ [pbr::OriginalName("HeatersOff")] HeatersOff = 5,
+ [pbr::OriginalName("StoreData")] StoreData = 6,
+ [pbr::OriginalName("SetValvePosition")] SetValvePosition = 7,
+ [pbr::OriginalName("WaitForTemperature")] WaitForTemperature = 8,
+ [pbr::OriginalName("WaitForProcesses")] WaitForProcesses = 9,
+ [pbr::OriginalName("TurnOffDryerFan")] TurnOffDryerFan = 10,
+ [pbr::OriginalName("TurnOffCooler")] TurnOffCooler = 11,
+ [pbr::OriginalName("TurnOffBlower")] TurnOffBlower = 12,
+ [pbr::OriginalName("PowerOffCompleted")] PowerOffCompleted = 13,
+ [pbr::OriginalName("Error")] Error = 14,
+ [pbr::OriginalName("Cancelled")] Cancelled = 15,
}
#endregion
diff --git a/Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj b/Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj
index c725a3121..02b8552ad 100644
--- a/Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj
+++ b/Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj
@@ -301,6 +301,8 @@
<Compile Include="ThreadLoading\ContinueThreadLoadingResponse.cs" />
<Compile Include="ThreadLoading\StartThreadLoadingRequest.cs" />
<Compile Include="ThreadLoading\StartThreadLoadingResponse.cs" />
+ <Compile Include="ThreadLoading\StopThreadLoadingRequest.cs" />
+ <Compile Include="ThreadLoading\StopThreadLoadingResponse.cs" />
<Compile Include="ThreadLoading\ThreadLoadingState.cs" />
</ItemGroup>
<ItemGroup>
@@ -319,7 +321,7 @@
</PropertyGroup>
<ProjectExtensions>
<VisualStudio>
- <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" />
+ <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" />
</VisualStudio>
</ProjectExtensions>
</Project> \ No newline at end of file
diff --git a/Software/Visual_Studio/Tango.PMR/ThreadLoading/StopThreadLoadingRequest.cs b/Software/Visual_Studio/Tango.PMR/ThreadLoading/StopThreadLoadingRequest.cs
new file mode 100644
index 000000000..10fe59a73
--- /dev/null
+++ b/Software/Visual_Studio/Tango.PMR/ThreadLoading/StopThreadLoadingRequest.cs
@@ -0,0 +1,131 @@
+// Generated by the protocol buffer compiler. DO NOT EDIT!
+// source: StopThreadLoadingRequest.proto
+#pragma warning disable 1591, 0612, 3021
+#region Designer generated code
+
+using pb = global::Google.Protobuf;
+using pbc = global::Google.Protobuf.Collections;
+using pbr = global::Google.Protobuf.Reflection;
+using scg = global::System.Collections.Generic;
+namespace Tango.PMR.ThreadLoading {
+
+ /// <summary>Holder for reflection information generated from StopThreadLoadingRequest.proto</summary>
+ public static partial class StopThreadLoadingRequestReflection {
+
+ #region Descriptor
+ /// <summary>File descriptor for StopThreadLoadingRequest.proto</summary>
+ public static pbr::FileDescriptor Descriptor {
+ get { return descriptor; }
+ }
+ private static pbr::FileDescriptor descriptor;
+
+ static StopThreadLoadingRequestReflection() {
+ byte[] descriptorData = global::System.Convert.FromBase64String(
+ string.Concat(
+ "Ch5TdG9wVGhyZWFkTG9hZGluZ1JlcXVlc3QucHJvdG8SF1RhbmdvLlBNUi5U",
+ "aHJlYWRMb2FkaW5nIhoKGFN0b3BUaHJlYWRMb2FkaW5nUmVxdWVzdEIjCiFj",
+ "b20udHdpbmUudGFuZ28ucG1yLnRocmVhZGxvYWRpbmdiBnByb3RvMw=="));
+ descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
+ new pbr::FileDescriptor[] { },
+ new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] {
+ new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.ThreadLoading.StopThreadLoadingRequest), global::Tango.PMR.ThreadLoading.StopThreadLoadingRequest.Parser, null, null, null, null)
+ }));
+ }
+ #endregion
+
+ }
+ #region Messages
+ public sealed partial class StopThreadLoadingRequest : pb::IMessage<StopThreadLoadingRequest> {
+ private static readonly pb::MessageParser<StopThreadLoadingRequest> _parser = new pb::MessageParser<StopThreadLoadingRequest>(() => new StopThreadLoadingRequest());
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public static pb::MessageParser<StopThreadLoadingRequest> Parser { get { return _parser; } }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public static pbr::MessageDescriptor Descriptor {
+ get { return global::Tango.PMR.ThreadLoading.StopThreadLoadingRequestReflection.Descriptor.MessageTypes[0]; }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ pbr::MessageDescriptor pb::IMessage.Descriptor {
+ get { return Descriptor; }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public StopThreadLoadingRequest() {
+ OnConstruction();
+ }
+
+ partial void OnConstruction();
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public StopThreadLoadingRequest(StopThreadLoadingRequest other) : this() {
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public StopThreadLoadingRequest Clone() {
+ return new StopThreadLoadingRequest(this);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public override bool Equals(object other) {
+ return Equals(other as StopThreadLoadingRequest);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public bool Equals(StopThreadLoadingRequest other) {
+ if (ReferenceEquals(other, null)) {
+ return false;
+ }
+ if (ReferenceEquals(other, this)) {
+ return true;
+ }
+ return true;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public override int GetHashCode() {
+ int hash = 1;
+ return hash;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public override string ToString() {
+ return pb::JsonFormatter.ToDiagnosticString(this);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public void WriteTo(pb::CodedOutputStream output) {
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public int CalculateSize() {
+ int size = 0;
+ return size;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public void MergeFrom(StopThreadLoadingRequest other) {
+ if (other == null) {
+ return;
+ }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public void MergeFrom(pb::CodedInputStream input) {
+ uint tag;
+ while ((tag = input.ReadTag()) != 0) {
+ switch(tag) {
+ default:
+ input.SkipLastField();
+ break;
+ }
+ }
+ }
+
+ }
+
+ #endregion
+
+}
+
+#endregion Designer generated code
diff --git a/Software/Visual_Studio/Tango.PMR/ThreadLoading/StopThreadLoadingResponse.cs b/Software/Visual_Studio/Tango.PMR/ThreadLoading/StopThreadLoadingResponse.cs
new file mode 100644
index 000000000..e25210ceb
--- /dev/null
+++ b/Software/Visual_Studio/Tango.PMR/ThreadLoading/StopThreadLoadingResponse.cs
@@ -0,0 +1,131 @@
+// Generated by the protocol buffer compiler. DO NOT EDIT!
+// source: StopThreadLoadingResponse.proto
+#pragma warning disable 1591, 0612, 3021
+#region Designer generated code
+
+using pb = global::Google.Protobuf;
+using pbc = global::Google.Protobuf.Collections;
+using pbr = global::Google.Protobuf.Reflection;
+using scg = global::System.Collections.Generic;
+namespace Tango.PMR.ThreadLoading {
+
+ /// <summary>Holder for reflection information generated from StopThreadLoadingResponse.proto</summary>
+ public static partial class StopThreadLoadingResponseReflection {
+
+ #region Descriptor
+ /// <summary>File descriptor for StopThreadLoadingResponse.proto</summary>
+ public static pbr::FileDescriptor Descriptor {
+ get { return descriptor; }
+ }
+ private static pbr::FileDescriptor descriptor;
+
+ static StopThreadLoadingResponseReflection() {
+ byte[] descriptorData = global::System.Convert.FromBase64String(
+ string.Concat(
+ "Ch9TdG9wVGhyZWFkTG9hZGluZ1Jlc3BvbnNlLnByb3RvEhdUYW5nby5QTVIu",
+ "VGhyZWFkTG9hZGluZyIbChlTdG9wVGhyZWFkTG9hZGluZ1Jlc3BvbnNlQiMK",
+ "IWNvbS50d2luZS50YW5nby5wbXIudGhyZWFkbG9hZGluZ2IGcHJvdG8z"));
+ descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
+ new pbr::FileDescriptor[] { },
+ new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] {
+ new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.ThreadLoading.StopThreadLoadingResponse), global::Tango.PMR.ThreadLoading.StopThreadLoadingResponse.Parser, null, null, null, null)
+ }));
+ }
+ #endregion
+
+ }
+ #region Messages
+ public sealed partial class StopThreadLoadingResponse : pb::IMessage<StopThreadLoadingResponse> {
+ private static readonly pb::MessageParser<StopThreadLoadingResponse> _parser = new pb::MessageParser<StopThreadLoadingResponse>(() => new StopThreadLoadingResponse());
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public static pb::MessageParser<StopThreadLoadingResponse> Parser { get { return _parser; } }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public static pbr::MessageDescriptor Descriptor {
+ get { return global::Tango.PMR.ThreadLoading.StopThreadLoadingResponseReflection.Descriptor.MessageTypes[0]; }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ pbr::MessageDescriptor pb::IMessage.Descriptor {
+ get { return Descriptor; }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public StopThreadLoadingResponse() {
+ OnConstruction();
+ }
+
+ partial void OnConstruction();
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public StopThreadLoadingResponse(StopThreadLoadingResponse other) : this() {
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public StopThreadLoadingResponse Clone() {
+ return new StopThreadLoadingResponse(this);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public override bool Equals(object other) {
+ return Equals(other as StopThreadLoadingResponse);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public bool Equals(StopThreadLoadingResponse other) {
+ if (ReferenceEquals(other, null)) {
+ return false;
+ }
+ if (ReferenceEquals(other, this)) {
+ return true;
+ }
+ return true;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public override int GetHashCode() {
+ int hash = 1;
+ return hash;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public override string ToString() {
+ return pb::JsonFormatter.ToDiagnosticString(this);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public void WriteTo(pb::CodedOutputStream output) {
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public int CalculateSize() {
+ int size = 0;
+ return size;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public void MergeFrom(StopThreadLoadingResponse other) {
+ if (other == null) {
+ return;
+ }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public void MergeFrom(pb::CodedInputStream input) {
+ uint tag;
+ while ((tag = input.ReadTag()) != 0) {
+ switch(tag) {
+ default:
+ input.SkipLastField();
+ break;
+ }
+ }
+ }
+
+ }
+
+ #endregion
+
+}
+
+#endregion Designer generated code
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>