public static IDisposable WhenViewModelAnyValue(this IViewFor view, Action <CompositeDisposable> block) { return(view.WhenActivated(disposable => { view.WhenAnyValue(x => x.ViewModel).Where(x => x != null).Subscribe(_ => block.Invoke(disposable)).DisposeWith(disposable); })); }
public static IDisposable WhenActivated(this IViewFor This, Action <Action <IDisposable> > block) { return(This.WhenActivated(() => { var ret = new List <IDisposable>(); block(ret.Add); return ret; })); }