Пример #1
0
 private void OnValueChanged(IControl next)
 {
     if (next == null || _ancestorType.IsAssignableFrom(next.GetType().GetTypeInfo()))
         _subject.OnNext(next);
     else
     {
         _child?.Dispose();
         _child = new FinderNode(next, _ancestorType);
         _child.Observable.Subscribe(OnChildValueChanged);
         _child.Init();
     }
 }
Пример #2
0
 /// <summary>
 /// Delegate called on value changes.
 /// </summary>
 /// <param name="next">The next control.</param>
 private void OnValueChanged(IControl next)
 {
     if (next == null || _ancestorType.IsAssignableFrom(next.GetType().GetTypeInfo()))
     {
         _subject.OnNext(next);
     }
     else
     {
         _child?.Dispose();
         _child = new FinderNode(next, _ancestorType);
         _child.Observable.Subscribe(OnChildValueChanged);
         _child.Init();
     }
 }
Пример #3
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();
                });
            }));
        }
Пример #4
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();
                });
            });


        }