Beispiel #1
0
 private void OnValueChanged(IStyledElement?next)
 {
     if (next == null || _ancestorType.IsAssignableFrom(next.GetType()))
     {
         _subject.OnNext(next);
     }
     else
     {
         _child?.Dispose();
         _child = new FinderNode(next, _ancestorType);
         _child.Observable.Subscribe(OnChildValueChanged);
         _child.Init();
     }
 }
Beispiel #2
0
        public static IObservable <IStyledElement?> Create(IStyledElement control, Type ancestorType)
        {
            return(new AnonymousObservable <IStyledElement?>(observer =>
            {
                var finder = new FinderNode(control, ancestorType);
                var subscription = finder.Observable.Subscribe(observer);
                finder.Init();

                return Disposable.Create(() =>
                {
                    subscription.Dispose();
                    finder.Dispose();
                });
            }));
        }
Beispiel #3
0
        public static IObservable<IControl> Create(IControl control, Type ancestorType)
        {
            return new AnonymousObservable<IControl>(observer =>
            {
                var finder = new FinderNode(control, ancestorType.GetTypeInfo());
                var subscription = finder.Observable.Subscribe(observer);
                finder.Init();

                return Disposable.Create(() =>
                {
                    subscription.Dispose();
                    finder.Dispose();
                });
            });


        }