Beispiel #1
0
    public static IEnumerable <SelectionCommandViewModelBase> CreateColumnCommands(this IHasColumns page)
    {
        yield return(new DefaultColumnsCommandViewModel(page));

        yield return(new AllColumnsCommandViewModel(page));

        if (page is IHasColumnModes m)
        {
            foreach (var c in m.ModeCommands)
            {
                yield return(c);
            }
        }
        yield return(null);

        foreach (var kv in page.GetFlags())
        {
            var v = ((IConvertible)kv.Key).ToInt64(null);
            yield return(new FlagColumnCommandViewModel(
                             page,
                             v,
                             kv.Value,
                             isSelected: (page.Columns & v) == v));
        }
    }
Beispiel #2
0
 public DefaultColumnsCommandViewModel(IHasColumns page)
     : this(page, page.GetFlags().Aggregate(0L, (s, kv) => s | ((IConvertible)kv.Key).ToInt64(null)))
 {
 }