コード例 #1
0
        private static int GetPropIndex(OperatinoEnum operatino, PropertyInfo prop, int columnIndex)
        {
            var proColumnIndex = Generics.GetColumnCustomProperty <int>(prop, 1);

            return(operatino == OperatinoEnum.Write ?
                   (proColumnIndex > -1 ? proColumnIndex : columnIndex) :
                   Generics.GetColumnCustomProperty <int>(prop, 1));
        }
コード例 #2
0
        internal static IList <ColumnInfo <T> > GetInfoColumns <T>(this IList <PropertyInfo> properties, OperatinoEnum operatino)
        {
            var result      = new List <ColumnInfo <T> >();
            int columnIndex = 1;

            foreach (var prop in properties)
            {
                columnIndex = GetPropIndex(operatino, prop, columnIndex);

                result.Add(new ColumnInfo <T>()
                {
                    Label                 = Generics.GetColumnCustomProperty <string>(prop, 0),
                    Index                 = columnIndex,
                    Type                  = GetTypeEnum(prop.PropertyType),
                    Name                  = prop.Name,
                    GetValueFunc          = Reflect.Getter(typeof(T), prop.Name),
                    SetValueFunc          = Reflect.Setter(typeof(T), prop.Name),
                    Mask                  = Generics.GetColumnCustomProperty <string>(prop, 2),
                    HeaderBackgroundColor = GetPropHeaderBackgroundColor(prop)
                });;

                columnIndex++;
            }
            return(result);
        }