예제 #1
0
        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendFormat("\t{0}\n", GetType().ToString());
            sb.AppendFormat("\t\t{0}\n", Condition.ToString());
            sb.AppendFormat("\t\t{0}\n", OnTrue.ToString());
            sb.AppendFormat("\t\t{0}", OnFalse.ToString());
            return(sb.ToString());
        }
예제 #2
0
        public object?ConvertBack(object?value, Type?targetType, object?parameter, CultureInfo culture)
        {
            if (value == OnNull)
            {
                return(Default(targetType));
            }
            if (value == OnFalse)
            {
                return(false);
            }
            if (value == OnTrue)
            {
                return(true);
            }
            if (value is null)
            {
                return(null);
            }

            if (OnNull is not null &&
                string.Equals(value.ToString(), OnNull.ToString(), StringComparison.CurrentCultureIgnoreCase))
            {
                return(Default(targetType));
            }

            if (OnFalse is not null &&
                string.Equals(value.ToString(), OnFalse.ToString(), StringComparison.CurrentCultureIgnoreCase))
            {
                return(false);
            }

            if (OnTrue is not null &&
                string.Equals(value.ToString(), OnTrue.ToString(), StringComparison.CurrentCultureIgnoreCase))
            {
                return(true);
            }

            return(null);
        }