aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Tango.PPC.UI
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2019-09-23 18:22:32 +0300
committerRoy Ben-Shabat <Roy@Twine-s.com>2019-09-23 18:22:32 +0300
commitb5c5758e431077d84fb53a3ff62f8e751fca2731 (patch)
treeb866fcbb29e2346f121455f503bde63071c2af5e /Software/Visual_Studio/PPC/Tango.PPC.UI
parentd6974df76b1401f101ca3c7fc3182f73e493ca51 (diff)
downloadTango-b5c5758e431077d84fb53a3ff62f8e751fca2731.tar.gz
Tango-b5c5758e431077d84fb53a3ff62f8e751fca2731.zip
Implemented Insufficient liquid levels !!!
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI')
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/InsufficientLiquidQuantityView.xaml78
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/InsufficientLiquidQuantityView.xaml.cs54
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/InsufficientLiquidQuantityViewVM.cs20
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/Printing/DefaultPrintingManager.cs17
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj10
5 files changed, 176 insertions, 3 deletions
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/InsufficientLiquidQuantityView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/InsufficientLiquidQuantityView.xaml
new file mode 100644
index 000000000..f3c471954
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/InsufficientLiquidQuantityView.xaml
@@ -0,0 +1,78 @@
+<UserControl x:Class="Tango.PPC.UI.Dialogs.InsufficientLiquidQuantityView"
+ 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}" Width="700" Height="800" d:DataContext="{d:DesignInstance Type=local:InsufficientLiquidQuantityViewVM, IsDesignTimeCreatable=False}">
+ <Grid Margin="20">
+ <DockPanel>
+ <Grid DockPanel.Dock="Bottom">
+ <touch:TouchButton HorizontalAlignment="Right" CornerRadius="25" Command="{Binding OKCommand}" Style="{StaticResource TangoHollowButton}" Width="150" Height="50" VerticalAlignment="Bottom">CLOSE</touch:TouchButton>
+ </Grid>
+ <StackPanel DockPanel.Dock="Top">
+ <Image Source="/Images/cartridge_validation.png" RenderOptions.BitmapScalingMode="Fant" Stretch="Uniform" Height="120"></Image>
+ <TextBlock HorizontalAlignment="Center" Margin="0 20 0 0" FontSize="{StaticResource TangoHeaderFontSize}">Insufficient Ink Level</TextBlock>
+ <TextBlock Margin="20 10" HorizontalAlignment="Center" TextWrapping="Wrap" TextAlignment="Center">
+ <Run>There seems to be an insufficient ink levels in one or more of the following dispensers.</Run>
+ <Run>The job cannot be completed.</Run>
+ </TextBlock>
+ </StackPanel>
+ <Grid>
+ <ItemsControl ItemsSource="{Binding Exception.IdsPackLevels}">
+ <ItemsControl.ItemsPanel>
+ <ItemsPanelTemplate>
+ <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Orientation="Horizontal" IsItemsHost="True"></StackPanel>
+ </ItemsPanelTemplate>
+ </ItemsControl.ItemsPanel>
+ <ItemsControl.ItemTemplate>
+ <DataTemplate>
+ <StackPanel Margin="15 0" Width="60">
+ <TextBlock HorizontalAlignment="Center" Text="{Binding IdsPack.LiquidType.Name}" Margin="-20 0 -20 0" TextTrimming="CharacterEllipsis"></TextBlock>
+ <Border Margin="0 5 0 0" Height="150" Width="50" CornerRadius="3" BorderThickness="1" BorderBrush="{StaticResource TangoLightBorderBrush}">
+ <Grid>
+ <Border CornerRadius="3" VerticalAlignment="Bottom" Loaded="IdsPackLoaded" MinHeight="5">
+ <Border.Background>
+ <LinearGradientBrush>
+ <GradientStop Offset="0" Color="#4DFFFFFF" />
+ <GradientStop Offset="0.5" Color="{Binding IdsPack.LiquidType.LiquidTypeColor}" />
+ </LinearGradientBrush>
+ </Border.Background>
+ </Border>
+ <Rectangle Loaded="Limit_Loaded" Stroke="Red" StrokeThickness="2" VerticalAlignment="Bottom">
+ <Rectangle.Style>
+ <Style TargetType="Rectangle">
+ <Style.Triggers>
+ <EventTrigger RoutedEvent="Loaded">
+ <EventTrigger.Actions>
+ <BeginStoryboard Name="str">
+ <Storyboard>
+ <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Duration="00:00:01" RepeatBehavior="Forever">
+ <DiscreteDoubleKeyFrame KeyTime="00:00:00" Value="1" />
+ <DiscreteDoubleKeyFrame KeyTime="00:00:0.5" Value="0" />
+ </DoubleAnimationUsingKeyFrames>
+ </Storyboard>
+ </BeginStoryboard>
+ </EventTrigger.Actions>
+ </EventTrigger>
+ <EventTrigger RoutedEvent="Unloaded">
+ <EventTrigger.Actions>
+ <RemoveStoryboard BeginStoryboardName="str" />
+ </EventTrigger.Actions>
+ </EventTrigger>
+ </Style.Triggers>
+ </Style>
+ </Rectangle.Style>
+ </Rectangle>
+ </Grid>
+ </Border>
+ </StackPanel>
+ </DataTemplate>
+ </ItemsControl.ItemTemplate>
+ </ItemsControl>
+ </Grid>
+ </DockPanel>
+ </Grid>
+</UserControl>
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/InsufficientLiquidQuantityView.xaml.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/InsufficientLiquidQuantityView.xaml.cs
new file mode 100644
index 000000000..9ec1eec0e
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/InsufficientLiquidQuantityView.xaml.cs
@@ -0,0 +1,54 @@
+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;
+using Tango.Integration.Operation;
+using static Tango.Integration.Operation.InsufficientLiquidQuantityException;
+
+namespace Tango.PPC.UI.Dialogs
+{
+ /// <summary>
+ /// Interaction logic for InsufficientLiquidQuantityView.xaml
+ /// </summary>
+ public partial class InsufficientLiquidQuantityView : UserControl
+ {
+ public InsufficientLiquidQuantityView()
+ {
+ InitializeComponent();
+ }
+
+ private void IdsPackLoaded(object sender, RoutedEventArgs e)
+ {
+ Border border = sender as Border;
+ Grid parent = border.Parent as Grid;
+ IDSPackLevel packLevel = border.DataContext as IDSPackLevel;
+
+ border.Height = ((double)packLevel.Current / (double)MachineOperator.MAX_DISPENSER_NANOLITER) * parent.ActualHeight;
+ }
+
+ private void Limit_Loaded(object sender, RoutedEventArgs e)
+ {
+ Rectangle rect = sender as Rectangle;
+ Grid parent = rect.Parent as Grid;
+ IDSPackLevel packLevel = rect.DataContext as IDSPackLevel;
+
+ var top = ((double)packLevel.Required / (double)MachineOperator.MAX_DISPENSER_NANOLITER) * parent.ActualHeight;
+ rect.Margin = new Thickness(0, 0, 0, top);
+
+ if (packLevel.IsValid)
+ {
+ rect.Visibility = Visibility.Hidden;
+ }
+ }
+ }
+}
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/InsufficientLiquidQuantityViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/InsufficientLiquidQuantityViewVM.cs
new file mode 100644
index 000000000..8b15d2e00
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/InsufficientLiquidQuantityViewVM.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.Integration.Operation;
+using Tango.SharedUI;
+
+namespace Tango.PPC.UI.Dialogs
+{
+ public class InsufficientLiquidQuantityViewVM : DialogViewVM
+ {
+ public InsufficientLiquidQuantityException Exception { get; set; }
+
+ public InsufficientLiquidQuantityViewVM(InsufficientLiquidQuantityException ex)
+ {
+ Exception = ex;
+ }
+ }
+}
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Printing/DefaultPrintingManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Printing/DefaultPrintingManager.cs
index 41a231932..56ec2fa7e 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Printing/DefaultPrintingManager.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Printing/DefaultPrintingManager.cs
@@ -13,8 +13,10 @@ using Tango.PPC.Common.Connection;
using Tango.PPC.Common.Messages;
using Tango.PPC.Common.Models;
using Tango.PPC.Common.Navigation;
+using Tango.PPC.Common.Notifications;
using Tango.PPC.Common.Printing;
using Tango.PPC.Jobs.Messages;
+using Tango.PPC.UI.Dialogs;
namespace Tango.PPC.UI.Printing
{
@@ -26,14 +28,16 @@ namespace Tango.PPC.UI.Printing
public class DefaultPrintingManager : ExtendedObject, IPrintingManager
{
private IMachineProvider _machineProvider;
+ private INotificationProvider _notificationProvider;
/// <summary>
/// Initializes a new instance of the <see cref="DefaultPrintingManager"/> class.
/// </summary>
/// <param name="machineProvider">The machine provider.</param>
- public DefaultPrintingManager(IMachineProvider machineProvider)
+ public DefaultPrintingManager(IMachineProvider machineProvider, INotificationProvider notificationProvider)
{
_machineProvider = machineProvider;
+ _notificationProvider = notificationProvider;
}
/// <summary>
@@ -52,7 +56,16 @@ namespace Tango.PPC.UI.Printing
#if STUBPRINT
handler = await _machineProvider.MachineOperator.PrintStub(job);
#else
- handler = await _machineProvider.MachineOperator.Print(job);
+ try
+ {
+ handler = await _machineProvider.MachineOperator.Print(job);
+ }
+ catch (InsufficientLiquidQuantityException ex)
+ {
+ LogManager.Log(ex);
+ await _notificationProvider.ShowDialog(new InsufficientLiquidQuantityViewVM(ex));
+ throw ex;
+ }
#endif
handler.Completed += async (x, e) =>
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 b32ee0339..40afab3de 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
@@ -125,6 +125,10 @@
<Compile Include="Dialogs\CartridgeValidationView.xaml.cs">
<DependentUpon>CartridgeValidationView.xaml</DependentUpon>
</Compile>
+ <Compile Include="Dialogs\InsufficientLiquidQuantityView.xaml.cs">
+ <DependentUpon>InsufficientLiquidQuantityView.xaml</DependentUpon>
+ </Compile>
+ <Compile Include="Dialogs\InsufficientLiquidQuantityViewVM.cs" />
<Compile Include="Dialogs\ScreenLockView.xaml.cs">
<DependentUpon>ScreenLockView.xaml</DependentUpon>
</Compile>
@@ -202,6 +206,10 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
+ <Page Include="Dialogs\InsufficientLiquidQuantityView.xaml">
+ <SubType>Designer</SubType>
+ <Generator>MSBuild:Compile</Generator>
+ </Page>
<Page Include="Dialogs\ScreenLockView.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
@@ -569,7 +577,7 @@ if $(ConfigurationName) == Release del *.xml</PostBuildEvent>
</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