示例#1
0
        public CloudProxy(IClient client,
                          IMessageConverterProvider messageConverterProvider,
                          string clientId,
                          Action <string, CloudConnectionStatus> connectionStatusChangedHandler,
                          ICloudListener cloudListener)
        {
            this.client = Preconditions.CheckNotNull(client, nameof(client));
            this.messageConverterProvider = Preconditions.CheckNotNull(messageConverterProvider, nameof(messageConverterProvider));
            this.clientId      = Preconditions.CheckNonWhiteSpace(clientId, nameof(clientId));
            this.cloudReceiver = new CloudReceiver(this, Preconditions.CheckNotNull(cloudListener, nameof(cloudListener)));

            if (connectionStatusChangedHandler != null)
            {
                this.connectionStatusChangedHandler = connectionStatusChangedHandler;
            }
        }
示例#2
0
 public CloudProxy(IClient client,
                   IMessageConverterProvider messageConverterProvider,
                   string clientId,
                   Action <string, CloudConnectionStatus> connectionStatusChangedHandler,
                   ICloudListener cloudListener,
                   TimeSpan idleTimeout)
 {
     this.client = Preconditions.CheckNotNull(client, nameof(client));
     this.messageConverterProvider = Preconditions.CheckNotNull(messageConverterProvider, nameof(messageConverterProvider));
     this.clientId       = Preconditions.CheckNonWhiteSpace(clientId, nameof(clientId));
     this.cloudReceiver  = new CloudReceiver(this, Preconditions.CheckNotNull(cloudListener, nameof(cloudListener)));
     this.timer          = new Timer(idleTimeout.TotalMilliseconds);
     this.timer.Elapsed += this.HandleIdleTimeout;
     this.timer.Start();
     if (connectionStatusChangedHandler != null)
     {
         this.connectionStatusChangedHandler = connectionStatusChangedHandler;
     }
 }
示例#3
0
 public CloudProxy(IClient client,
                   IMessageConverterProvider messageConverterProvider,
                   string clientId,
                   Action <string, CloudConnectionStatus> connectionStatusChangedHandler,
                   ICloudListener cloudListener,
                   TimeSpan idleTimeout,
                   bool closeOnIdleTimeout)
 {
     this.client = Preconditions.CheckNotNull(client, nameof(client));
     this.messageConverterProvider = Preconditions.CheckNotNull(messageConverterProvider, nameof(messageConverterProvider));
     this.clientId      = Preconditions.CheckNonWhiteSpace(clientId, nameof(clientId));
     this.cloudReceiver = new CloudReceiver(this, Preconditions.CheckNotNull(cloudListener, nameof(cloudListener)));
     this.timer         = new ResettableTimer(this.HandleIdleTimeout, idleTimeout, Events.Log, true);
     this.timer.Start();
     this.closeOnIdleTimeout = closeOnIdleTimeout;
     if (connectionStatusChangedHandler != null)
     {
         this.connectionStatusChangedHandler = connectionStatusChangedHandler;
     }
     Events.Initialized(this);
 }
示例#4
0
 public void BindCloudListener(ICloudListener cloudListener)
 {
     this.cloudReceiver = new CloudReceiver(this, cloudListener);
     Events.BindCloudListener(this);
 }