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(); } }
/// <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(); } }
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(); }); })); }
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(); }); }); }