Exemple #1
0
 protected internal override async Task OnOpenAsync(TimeSpan timeout)
 {
     if (_innerFactory != null)
     {
         IAsyncChannelFactory asyncFactory = _innerFactory as IAsyncChannelFactory;
         if (asyncFactory != null)
         {
             await asyncFactory.OpenAsync(timeout);
         }
         else
         {
             _innerFactory.Open(timeout);
         }
     }
 }
            private new async Task OnCloseAsyncInternal(TimeSpan timeout)
            {
                await base.OnCloseAsync(timeout);

                IAsyncChannelFactory asyncChannelFactory = _innerChannelFactory as IAsyncChannelFactory;

                if (asyncChannelFactory != null)
                {
                    await asyncChannelFactory.CloseAsync(timeout);
                }
                else
                {
                    await Task.Factory.FromAsync(_innerChannelFactory.BeginClose, _innerChannelFactory.EndClose, TaskCreationOptions.None);
                }
            }