Ejemplo n.º 1
0
        public static IEnumerable <ILogical> GetSelfAndLogicalAncestors(this ILogical logical)
        {
            yield return(logical);

            foreach (var ancestor in logical.GetLogicalAncestors())
            {
                yield return(ancestor);
            }
        }
Ejemplo n.º 2
0
 public static IObservable <ILogical> Track(ILogical relativeTo, int ancestorLevel, Type ancestorType = null)
 {
     return(TrackAttachmentToTree(relativeTo).Select(isAttachedToTree =>
     {
         if (isAttachedToTree)
         {
             return relativeTo.GetLogicalAncestors()
             .Where(x => ancestorType?.GetTypeInfo().IsAssignableFrom(x.GetType().GetTypeInfo()) ?? true)
             .ElementAtOrDefault(ancestorLevel);
         }
         else
         {
             return null;
         }
     }));
 }
Ejemplo n.º 3
0
 private void Update()
 {
     _value = _relativeTo.GetLogicalAncestors()
              .Where(x => _ancestorType?.IsAssignableFrom(x.GetType()) ?? true)
              .ElementAtOrDefault(_ancestorLevel);
 }
Ejemplo n.º 4
0
 public static bool IsLogicalParentOf(this ILogical logical, ILogical target)
 {
     return(target.GetLogicalAncestors().Any(x => x == logical));
 }