aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance
diff options
context:
space:
mode:
authorVictoria Plitt <Victoria.Plitt@twine-s.com>2020-07-14 11:14:48 +0300
committerVictoria Plitt <Victoria.Plitt@twine-s.com>2020-07-14 11:14:48 +0300
commit3f2420645f9c90c7b079c6cd372d413a6bb568a4 (patch)
treec94684d60701b8b782b20a1d42ee67b164fd054f /Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance
parentebdba4dd5bb09f3bbefcd774931153346041dabc (diff)
downloadTango-3f2420645f9c90c7b079c6cd372d413a6bb568a4.tar.gz
Tango-3f2420645f9c90c7b079c6cd372d413a6bb568a4.zip
PPC Refactoring. Undo last changes in StringToFirstLetterConverter. Added LiquidTypeToShortNameConverter.
Diffstat (limited to 'Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance')
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Converters/LiquidTypeToShortNameConverter.cs41
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Converters/StringToFirstLetterConverter.cs8
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Views/MaintenanceView.xaml3
3 files changed, 43 insertions, 9 deletions
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Converters/LiquidTypeToShortNameConverter.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Converters/LiquidTypeToShortNameConverter.cs
new file mode 100644
index 000000000..15041bf17
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Converters/LiquidTypeToShortNameConverter.cs
@@ -0,0 +1,41 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Data;
+using Tango.BL.Entities;
+
+namespace Tango.PPC.Maintenance.Converters
+{
+ class LiquidTypeToShortNameConverter : IValueConverter
+ {
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ if (value is LiquidType)
+ {
+ LiquidType type = value as LiquidType;
+ switch (type.Type)
+ {
+ case BL.Enumerations.LiquidTypes.Cleaner:
+ return "CL";
+ case BL.Enumerations.LiquidTypes.TransparentInk:
+ return "TI";
+ case BL.Enumerations.LiquidTypes.Black:
+ return "K";
+ }
+ return type.Name.First().ToString();
+ }
+ else
+ {
+ return value;
+ }
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Converters/StringToFirstLetterConverter.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Converters/StringToFirstLetterConverter.cs
index 5418b5cf5..0922af78d 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Converters/StringToFirstLetterConverter.cs
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Converters/StringToFirstLetterConverter.cs
@@ -14,14 +14,6 @@ namespace Tango.PPC.Maintenance.Converters
{
if (value != null && value.ToString().Length > 1)
{
- if (value.ToString() == "Cleaner")
- return "CL";
- else if (value.ToString() == "Transparent Ink")
- return "TI";
- else if(value.ToString() == "Black")
- {
- return "K";
- }
return value.ToString().First().ToString();
}
else
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Views/MaintenanceView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Views/MaintenanceView.xaml
index 2216c47d8..d51f0eb38 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Views/MaintenanceView.xaml
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Views/MaintenanceView.xaml
@@ -18,6 +18,7 @@
<localConverters:StringToFirstLetterConverter x:Key="StringToFirstLetterConverter" />
<localConverters:MidTankLevelToElementHeightConverter x:Key="MidTankLevelToElementHeightConverter" />
<localConverters:LiquidTypeToBrushConverter x:Key="LiquidTypeToBrushConverter" />
+ <localConverters:LiquidTypeToShortNameConverter x:Key="LiquidTypeToShortNameConverter"/>
<Style TargetType="FrameworkElement" x:Key="Level1Container">
<Setter Property="Margin" Value="20 15 60 15"></Setter>
@@ -31,7 +32,7 @@
<DataTemplate x:Key="LiquidBox">
<DockPanel>
- <TextBlock DockPanel.Dock="Top" Text="{Binding IDSPack.LiquidType.Name,Converter={StaticResource StringToFirstLetterConverter}}" HorizontalAlignment="Center"></TextBlock>
+ <TextBlock DockPanel.Dock="Top" Text="{Binding IDSPack.LiquidType,Converter={StaticResource LiquidTypeToShortNameConverter}}" HorizontalAlignment="Center"></TextBlock>
<Grid MaxWidth="20" Margin="1 0">
<touch:TouchIcon Icon="MapMarkerSolid" Width="20" Height="20" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0 0 0 10" Foreground ="{Binding Path=IDSPack.LiquidType, Converter={StaticResource LiquidTypeToBrushConverter}}">
<touch:TouchIcon.Style>