/// <summary> /// Constructor which creates a new adapter using the given ConnectionMonitor. /// </summary> /// <param name="monitor">ConnectionMonitor to be engaged.</param> public ConnectionMonitorAdapter(ConnectionMonitor.ConnectionMonitor monitor) { Guard.ArgumentNotNull(monitor, "monitor"); this.monitor = monitor; this.monitor.Connections.ConnectionStatusChanged += new EventHandler <ConnectionEventArgs>(OnConnectionStatusChanged); this.monitor.Networks.NetworkConnectionStatusChanged += new EventHandler <NetworkConnectionStatusChangedEventArgs>( OnNetworkConnectionStatusChanged); }
private static RequestManager InitializeManager(SmartClientDatabase db) { DatabaseRequestQueue requestQueue = new DatabaseRequestQueue(db, "Requests"); DatabaseRequestQueue deadLetterQueue = new DatabaseRequestQueue(db, "DeadLetter"); ConnectionMonitor.ConnectionMonitor monitor = ConnectionMonitorFactory.CreateFromConfiguration(); ConnectionMonitorAdapter monitorAdapter = new ConnectionMonitorAdapter(monitor); IEndpointCatalog endpointCatalog = new EndpointCatalogFactory("Endpoints").CreateCatalog(); // nothing is defined in config. Create an empty catalog if (endpointCatalog == null) { endpointCatalog = new EndpointCatalog.EndpointCatalog(); } RequestManager manager = RequestManager.Instance; manager.Initialize(requestQueue, deadLetterQueue, monitorAdapter, endpointCatalog); return(manager); }