Esempio n. 1
0
 /// <summary>
 /// Create a new Api client handler with specific input and output <see cref="Stream"/>s.
 /// </summary>
 /// <param name="input">the input <see cref="Stream"/> to use</param>
 /// <param name="output">the output <see cref="Stream"/> to use</param>
 public ApiClient(Stream input, Stream output)
     : base(input, output)
 {
     manager = new ClientMessageManager <T>();
     manager.EnqueueNewMessage      += Manager_EnqueueNewMessage;
     manager.NotifyRequestCancelled += Manager_NotifyRequestCancelled;
 }
Esempio n. 2
0
 protected internal ApiClient(Stream input, Stream output, ApiClient <T> oldClient)
     : base(input, output)
 {
     if (oldClient != null)
     {
         manager = oldClient.manager;
         manager.EnqueueNewMessage      += Manager_EnqueueNewMessage;
         manager.NotifyRequestCancelled += Manager_NotifyRequestCancelled;
         oldClient.DisconnectHook();
         PushMessage(oldClient.GetMessages());
         oldClient.manager = null;
         oldClient.Dispose();
     }
     else
     {
         manager = new ClientMessageManager <T>();
         manager.EnqueueNewMessage      += Manager_EnqueueNewMessage;
         manager.NotifyRequestCancelled += Manager_NotifyRequestCancelled;
     }
 }