public static void SubscribeOnce(string api, Action<ApiInfo> action) { IDisposable rSubscription = null; rSubscription = new SingleApiAfterProcessCompletedSubscription(api, r => { action(r); rSubscription.Dispose(); }); }
public static IDisposable Subscribe(string api, Action<ApiInfo> onStarted, Action<ApiInfo> onCompleted) { var rBpsSubscription = new SingleApiBeforeProcessStartedSubscription(api, onStarted); var rApcSubscription = new SingleApiAfterProcessCompletedSubscription(api, onCompleted); return Disposable.Create(() => { rBpsSubscription.Dispose(); rApcSubscription.Dispose(); }); }