public static void SubscribeOnceOnlyOnBeforeProcessStarted(string api, Action <ApiInfo> action) { IDisposable rSubscription = null; rSubscription = new SingleApiBeforeProcessStartedSubscription(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(); })); }