diff options
| author | Roy <Roy.mail.net@gmail.com> | 2023-02-20 02:28:15 +0200 |
|---|---|---|
| committer | Roy <Roy.mail.net@gmail.com> | 2023-02-20 02:28:15 +0200 |
| commit | 795f3ab6ea36551281ec6442aa16b9547af96adc (patch) | |
| tree | 4b1af0d700014054ff7d0ac01e381bbd25699e59 /Software/Visual_Studio/Tango.SharedUI/Converters | |
| parent | ba39c2e2a012953f2f9633fa7df59b49cf3fd4c7 (diff) | |
| download | Tango-795f3ab6ea36551281ec6442aa16b9547af96adc.tar.gz Tango-795f3ab6ea36551281ec6442aa16b9547af96adc.zip | |
Incorporated machine type into machine creation and management + job runs.
Diffstat (limited to 'Software/Visual_Studio/Tango.SharedUI/Converters')
| -rw-r--r-- | Software/Visual_Studio/Tango.SharedUI/Converters/IsNullToVisibilityInverseConverter.cs | 24 | ||||
| -rw-r--r-- | Software/Visual_Studio/Tango.SharedUI/Converters/NullObjectToBooleanInverseConverter.cs | 45 |
2 files changed, 69 insertions, 0 deletions
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 +{ + /// <summary> + /// Represents a binding converter for returning true for valid object instances and false for null object reference. + /// </summary> + public class NullObjectToBooleanInverseConverter : IValueConverter + { + /// <summary> + /// Converts a value. + /// </summary> + /// <param name="value">The value produced by the binding source.</param> + /// <param name="targetType">The type of the binding target property.</param> + /// <param name="parameter">The converter parameter to use.</param> + /// <param name="culture">The culture to use in the converter.</param> + /// <returns> + /// A converted value. If the method returns null, the valid null value is used. + /// </returns> + public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) + { + return (value == null); + } + + /// <summary> + /// Converts a value. + /// </summary> + /// <param name="value">The value that is produced by the binding target.</param> + /// <param name="targetType">The type to convert to.</param> + /// <param name="parameter">The converter parameter to use.</param> + /// <param name="culture">The culture to use in the converter.</param> + /// <returns> + /// A converted value. If the method returns null, the valid null value is used. + /// </returns> + public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) + { + return value; + } + } +} |
