public OpenOnceManagerAsyncResult(OpenOnceManager openOnceManager, TimeSpan openTimeout, AsyncCallback callback, object state, Func <AsyncCallback, object, IAsyncResult> beginOperation, OpenOnceManager.EndOperation <T> endOperation) : base(callback, state) { this.transaction = Transaction.Current; this.openOnceManager = openOnceManager; this.beginOperation = beginOperation; this.endOperation = endOperation; if (openOnceManager.ShouldOpen) { if (base.SyncContinue(this.openOnceManager.BeginOpen(openTimeout, base.PrepareAsyncCompletion(OpenOnceManager.OpenOnceManagerAsyncResult <T> .openComplete), this))) { base.Complete(true); return; } } else if (this.BeginOperation()) { base.Complete(true); } }
public IAsyncResult Begin <T>(AsyncCallback callback, object state, Func <AsyncCallback, object, IAsyncResult> beginOperation, OpenOnceManager.EndOperation <T> endOperation) { return(new OpenOnceManager.OpenOnceManagerAsyncResult <T>(this, this.openTimeout, callback, state, beginOperation, endOperation)); }