| 1234567891011121314151617181920212223242526272829303132333435 | #nullable enableusing System;using System.ComponentModel;using System.Globalization;using InABox.Core;using JetBrains.Annotations;using Xamarin.Forms;namespace InABox.Mobile{        public abstract class AbstractConverter<TIn, TOut> : BindableObject, IValueConverter    {                protected abstract TOut? Convert(TIn? value, object? parameter = null);        protected virtual TIn? Deconvert(TOut? value, object? parameter = null)        {            return default;        }                public object? Convert(object value, Type targetType, object parameter, CultureInfo culture)        {            var typed = value is TIn tin ? tin : default;            return Convert(typed, parameter);        }        public object? ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)        {            var typed = value is TOut tout ? tout : default;            return Deconvert(typed, parameter);        }            }}
 |