Ejemplo n.º 1
0
        ///selection parameter overrides the default
        public static ITable <T> WithCellFunction <T>(this ITable <T> table, Func <ITable <T>, ConfiguredCellFunction <T> > config,
                                                      SummaryFunctionSelection selection)
        {
            var func = config(table);

            return(table.WithCellFunction(func.Func, selection));
        }
Ejemplo n.º 2
0
 public ITable <TItem> WithCellFunction(Func <IEnumerable <TItem>, IEnumerable <TItem>, IEnumerable <TItem>, object> func,
                                        SummaryFunctionSelection selection)
 {
     if ((selection & SummaryFunctionSelection.Cell) != 0)
     {
         cellFunc = (row, col, cell) => formatter.Format(func(row, col, cell));
     }
     if ((selection & SummaryFunctionSelection.Row) != 0)
     {
         if (func == null)
         {
             rowFunc = null;
         }
         else
         {
             rowFunc = (row, all) => formatter.Format(func(row, all, row));
         }
     }
     if ((selection & SummaryFunctionSelection.Column) != 0)
     {
         if (func == null)
         {
             colFunc = null;
         }
         else
         {
             colFunc = (col, all) => formatter.Format(func(all, col, col));
         }
     }
     if ((selection & SummaryFunctionSelection.LowerRight) != 0)
     {
         if (func == null)
         {
             allFunc = null;
         }
         else
         {
             allFunc = (all) => formatter.Format(func(all, all, all));
         }
     }
     return(this);
 }
Ejemplo n.º 3
0
 public static ITable <T> WithCellFunction <T>(this ITable <T> table, Func <IEnumerable <T>, object> func,
                                               SummaryFunctionSelection selection = SummaryFunctionSelection.All)
 {
     return(table.WithCellFunction((row, col, cell) => func(cell), selection));
 }
Ejemplo n.º 4
0
 public ConfiguredCellFunction(Func <IEnumerable <T>, IEnumerable <T>, IEnumerable <T>, string> func, SummaryFunctionSelection defaultSelection)
 {
     Func             = func;
     DefaultSelection = defaultSelection;
 }