Exemplo n.º 1
0
 //where TSourceType : IGraphItem
 public NodeConfigSection<TNode> ReferenceSection<TSourceType, TReferenceItem>(string header,
     Func<TNode, IEnumerable<TSourceType>> selector,
     bool manual = false,
     bool allowDuplicates = false)
     where TReferenceItem : GenericReferenceItem
 {
     //Container.RegisterGraphItem<TReferenceItem, ScaffoldNodeChildItem<TReferenceItem>.ViewModel, ScaffoldNodeChildItem<TReferenceItem>.Drawer>();
     var section = new NodeConfigSection<TNode>()
     {
         SourceType = typeof(TReferenceItem),
         Name = header,
         AllowAdding = manual,
         ReferenceType = typeof(TSourceType),
         AllowDuplicates = allowDuplicates
     };
     if (selector != null)
     {
         section.Selector = p => selector(p).Cast<IGraphItem>();
     }
     else
     {
         throw new Exception("Reference Section must have a selector");
     }
     GraphItemConfigurations.Add(section);
     return section;
 }
Exemplo n.º 2
0
 public NodeConfigSection<TNode> Proxy<TChildItem>(string header, Func<TNode, IEnumerable<TChildItem>> selector = null)
 {
     var section = new NodeConfigSection<TNode>()
     {
         SourceType = typeof(TChildItem),
         Name = header,
         IsProxy = true,
         AllowAdding = false
     };
     if (selector != null)
     {
         section.Selector = p => selector(p).Cast<IGraphItem>();
     }
     GraphItemConfigurations.Add(section);
     return section;
 }