From 795f3ab6ea36551281ec6442aa16b9547af96adc Mon Sep 17 00:00:00 2001 From: Roy Date: Mon, 20 Feb 2023 02:28:15 +0200 Subject: Incorporated machine type into machine creation and management + job runs. --- .../IsNullToVisibilityInverseConverter.cs | 24 ++++++++++++ .../NullObjectToBooleanInverseConverter.cs | 45 ++++++++++++++++++++++ .../Tango.SharedUI/Tango.SharedUI.csproj | 4 +- 3 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 Software/Visual_Studio/Tango.SharedUI/Converters/IsNullToVisibilityInverseConverter.cs create mode 100644 Software/Visual_Studio/Tango.SharedUI/Converters/NullObjectToBooleanInverseConverter.cs (limited to 'Software/Visual_Studio/Tango.SharedUI') diff --git a/Software/Visual_Studio/Tango.SharedUI/Converters/IsNullToVisibilityInverseConverter.cs b/Software/Visual_Studio/Tango.SharedUI/Converters/IsNullToVisibilityInverseConverter.cs new file mode 100644 index 000000000..ef284b12c --- /dev/null +++ b/Software/Visual_Studio/Tango.SharedUI/Converters/IsNullToVisibilityInverseConverter.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Data; + +namespace Tango.SharedUI.Converters +{ + public class IsNullToVisibilityInverseConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + return value == null ? Visibility.Visible : Visibility.Collapsed; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/Software/Visual_Studio/Tango.SharedUI/Converters/NullObjectToBooleanInverseConverter.cs b/Software/Visual_Studio/Tango.SharedUI/Converters/NullObjectToBooleanInverseConverter.cs new file mode 100644 index 000000000..73e41beea --- /dev/null +++ b/Software/Visual_Studio/Tango.SharedUI/Converters/NullObjectToBooleanInverseConverter.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Data; + +namespace Tango.SharedUI.Converters +{ + /// + /// Represents a binding converter for returning true for valid object instances and false for null object reference. + /// + public class NullObjectToBooleanInverseConverter : IValueConverter + { + /// + /// Converts a value. + /// + /// The value produced by the binding source. + /// The type of the binding target property. + /// The converter parameter to use. + /// The culture to use in the converter. + /// + /// A converted value. If the method returns null, the valid null value is used. + /// + public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) + { + return (value == null); + } + + /// + /// Converts a value. + /// + /// The value that is produced by the binding target. + /// The type to convert to. + /// The converter parameter to use. + /// The culture to use in the converter. + /// + /// A converted value. If the method returns null, the valid null value is used. + /// + public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) + { + return value; + } + } +} diff --git a/Software/Visual_Studio/Tango.SharedUI/Tango.SharedUI.csproj b/Software/Visual_Studio/Tango.SharedUI/Tango.SharedUI.csproj index c2071d296..c7eccab9f 100644 --- a/Software/Visual_Studio/Tango.SharedUI/Tango.SharedUI.csproj +++ b/Software/Visual_Studio/Tango.SharedUI/Tango.SharedUI.csproj @@ -119,12 +119,14 @@ + + @@ -262,7 +264,7 @@ - + \ No newline at end of file -- cgit v1.3.1