aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC
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/PPC
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/PPC')
-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
11 files changed, 397 insertions, 13 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
}
}