public CloseAsyncResult(WindowsStreamSecurityUpgradeInitiator parent, TimeSpan timeout,
                                        AsyncCallback callback, object state)
                    : base(callback, state)
                {
                    this.parent        = parent;
                    this.timeoutHelper = new TimeoutHelper(timeout);

                    // since we're at channel.Open and not per-message, minimize our statics overhead and leverage GC for our callback
                    this.onBaseClose          = Fx.ThunkCallback(new AsyncCallback(OnBaseClose));
                    this.onCloseTokenProvider = Fx.ThunkCallback(new AsyncCallback(OnCloseTokenProvider));
                    IAsyncResult result = parent.BaseBeginClose(timeoutHelper.RemainingTime(), onBaseClose, this);

                    if (!result.CompletedSynchronously)
                    {
                        return;
                    }

                    if (HandleBaseCloseComplete(result))
                    {
                        base.Complete(true);
                    }
                }
                public CloseAsyncResult(WindowsStreamSecurityUpgradeInitiator parent, TimeSpan timeout,
                    AsyncCallback callback, object state)
                    : base(callback, state)
                {
                    this.parent = parent;
                    this.timeoutHelper = new TimeoutHelper(timeout);

                    // since we're at channel.Open and not per-message, minimize our statics overhead and leverage GC for our callback
                    this.onBaseClose = Fx.ThunkCallback(new AsyncCallback(OnBaseClose));
                    this.onCloseTokenProvider = Fx.ThunkCallback(new AsyncCallback(OnCloseTokenProvider));
                    IAsyncResult result = parent.BaseBeginClose(timeoutHelper.RemainingTime(), onBaseClose, this);

                    if (!result.CompletedSynchronously)
                    {
                        return;
                    }

                    if (HandleBaseCloseComplete(result))
                    {
                        base.Complete(true);
                    }
                }
 public InitiateUpgradeAsyncResult(WindowsStreamSecurityUpgradeInitiator initiator,
                                   AsyncCallback callback, object state)
     : base(callback, state)
 {
     this.initiator = initiator;
 }
 public InitiateUpgradeAsyncResult(WindowsStreamSecurityUpgradeInitiator initiator,
     AsyncCallback callback, object state)
     : base(callback, state)
 {
     this.initiator = initiator;
 }