Exemple #1
0
        public string StringValForCol(Object o)
        {
            var casted = Convert.ChangeType(o, SourceType);

            if (casted is string)
            {
                return(LongStringBehaviour.ProcessString(casted as string));
            }
            else
            {
                var ToStringMethod = SourceType.GetTypeInfo().DeclaredMethods.FirstOrDefault(m =>
                                                                                             m.Name == "ToString" &&
                                                                                             m.IsPublic &&
                                                                                             m.ReturnType == typeof(string) &&
                                                                                             m.GetParameters().Count() == 1 &&
                                                                                             m.GetParameters()[0].ParameterType == typeof(string));

                if (ToStringMethod == null)
                {
                    return(casted.ToString());
                }
                else
                {
                    return((string)ToStringMethod.Invoke(o, new object[] { FormatString }));
                }
            }
        }
Exemple #2
0
 private static string WrapString(string input, string ellipsis, int width)
 {
     if (input.Length <= width)
     {
         return(input);
     }
     return(LongStringBehaviour.WordWrap(input, width));
 }
Exemple #3
0
        public string StringValForCol(Object o)
        {
            var casted = Convert.ChangeType(o, SourceType);

            if (casted is string)
            {
                return(LongStringBehaviour.ProcessString(casted as string));
            }
            else
            {
                if (toStringMethod == null)
                {
                    return((casted ?? string.Empty).ToString());
                }
                else
                {
                    return((string)toStringMethod.Invoke(o, new object[] { FormatString }));
                }
            }
        }