From 3f2420645f9c90c7b079c6cd372d413a6bb568a4 Mon Sep 17 00:00:00 2001 From: Victoria Plitt Date: Tue, 14 Jul 2020 11:14:48 +0300 Subject: PPC Refactoring. Undo last changes in StringToFirstLetterConverter. Added LiquidTypeToShortNameConverter. --- .../Converters/LiquidTypeToShortNameConverter.cs | 41 ++++++++++++++++++++++ .../Converters/StringToFirstLetterConverter.cs | 8 ----- .../Views/MaintenanceView.xaml | 3 +- 3 files changed, 43 insertions(+), 9 deletions(-) create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Converters/LiquidTypeToShortNameConverter.cs (limited to 'Software/Visual_Studio/PPC/Modules') 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 @@ +