コード例 #1
0
 private void CreateConnectionMonitor(NetMQSocket socket, NetMQPoller poller)
 {
     _connectionMonitor                 = new ConnectionMonitor(socket, poller);
     _connectionMonitor.Connected      += ConnectionMonitor_Connected;
     _connectionMonitor.ConnectRetried += ConnectionMonitor_ConnectRetried;
     _connectionMonitor.Disconnected   += ConnectionMonitor_Disconnected;
 }
コード例 #2
0
 private void DisposeConnectionMonitor()
 {
     _connectionMonitor.Connected      -= ConnectionMonitor_Disconnected;
     _connectionMonitor.ConnectRetried -= ConnectionMonitor_ConnectRetried;
     _connectionMonitor.Disconnected   -= ConnectionMonitor_Disconnected;
     _connectionMonitor.Dispose();
     _connectionMonitor = null;
 }
コード例 #3
0
ファイル: RequestManager.cs プロジェクト: yovannyr/scsf2019
 /// <summary>
 /// This method initializes the RequestManager for request dispatching with all the configurable elements.
 /// </summary>
 /// <param name="theRequestQueue">Queue for the pending requests.</param>
 /// <param name="theDeadLetterQueue">Queue for the failures.</param>
 /// <param name="theConnectionMonitor">IConnectionMonitor for connectivity events and info.</param>
 /// <param name="theEndpointCatalog">Catalog to get the Endpoint especific information for the dispatching.</param>
 public void Initialize(
     IRequestQueue theRequestQueue,
     IRequestQueue theDeadLetterQueue,
     IConnectionMonitor theConnectionMonitor,
     IEndpointCatalog theEndpointCatalog)
 {
     Initialize <RequestDispatcher>(theRequestQueue, theDeadLetterQueue, theConnectionMonitor,
                                    theEndpointCatalog);
 }
コード例 #4
0
ファイル: RequestManager.cs プロジェクト: yovannyr/scsf2019
 /// <summary>
 /// This method initializes the RequestManager for request dispatching.
 /// </summary>
 /// <typeparam name="TRequestDispatcher">The concrete type of an <see cref="IRequestDispatcher"/>.</typeparam>
 /// <param name="theRequestQueue">Queue for the pending requests.</param>
 /// <param name="theDeadLetterQueue">Queue for the failures.</param>
 /// <param name="theConnectionMonitor">IConnectionMonitor for connectivity events and info.</param>
 /// <param name="theEndpointCatalog">Catalog to get the Endpoint especific information for the dispatching.</param>
 public void Initialize <TRequestDispatcher>(
     IRequestQueue theRequestQueue,
     IRequestQueue theDeadLetterQueue,
     IConnectionMonitor theConnectionMonitor,
     IEndpointCatalog theEndpointCatalog) where TRequestDispatcher : IRequestDispatcher, new()
 {
     Initialize(theRequestQueue, theDeadLetterQueue, theConnectionMonitor, new TRequestDispatcher(),
                theEndpointCatalog);
 }
コード例 #5
0
 public void Connect()
 {
     _socket  = new RequestSocket();
     _monitor = new DefaultConnectionMonitor();
     if (!_monitor.TryConnectAndMonitorSocket(_socket, _address))
     {
         throw new ApplicationException($"Couldn't connect to snapshot address {_address} within timeout {_timeout}");
     }
 }
コード例 #6
0
        public RestaurantsViewPresenter(Agent restaurantService, IConnectionMonitor connectionMonitor, IEventAggregator eventAggregator)
        {
            _connectionMonitor = connectionMonitor;
            _restaurantService = restaurantService;
            _eventAggregator = eventAggregator;

            // Subscribe to the service agent callback events
            Callback.GetRestaurantsReturn += GetRestaurantsReturn;
            Callback.GetRestaurantsException += GetRestaurantsException;
        }
コード例 #7
0
 private void OnConnectionStateChanged(IConnectionMonitor source, bool state)
 {
     if (state)
     {
         foreach (var synchronizer in _synchronizers)
         {
             synchronizer.Init();
         }
     }
 }
コード例 #8
0
        public DeploymentTargetsManagerLinux()
        {
            ConnectionMonitor = new ConnectionMonitorUdev(true);

            ConnectionMonitor.DeviceNew     += DeviceNew;
            ConnectionMonitor.DeviceRemoved += DeviceRemoved;

            foreach (Connection connection in ConnectionMonitor.GetDeviceList())
            {
                InitalizeMeadow(connection);
            }
        }
コード例 #9
0
        public DataUpdater(IProjectRepository projectRepository, IActivityRepository activityRepository, IConnectionMonitor connectionMonitor, IEncryptor encryptor)
        {
            this.projectRepository  = projectRepository;
            this.encryptor          = encryptor;
            this.connectionMonitor  = connectionMonitor;
            this.activityRepository = activityRepository;

            SetUpTimer();

            this.connectionMonitor.ConnectionStatusChangedEvent += ConnectionMonitorConnectionStatusChangedEvent;
            IsConnected = this.connectionMonitor.IsConnected;
        }
コード例 #10
0
        public MenuItemsViewPresenter
        (
            [ServiceDependency] Agent restaurantService,
            [ServiceDependency] IConnectionMonitor connectionMonitor
        )
        {
            _connectionMonitor = connectionMonitor;
            _restaurantService = restaurantService;

            // Subscribe to the service agent callback events
            Callback.GetMenuItemsReturn    += new EventHandler <EventArgs <MenuItem[]> >(GetMenuItemsReturn);
            Callback.GetMenuItemsException += new EventHandler <EventArgs <Exception> >(GetMenuItemsException);
        }
コード例 #11
0
        public MenuItemsViewPresenter(Agent restaurantService, IConnectionMonitor connectionMonitor, IEventAggregator eventAggregator)
        {
            _restaurantService = restaurantService;
            _connectionMonitor = connectionMonitor;
            _eventAggregator = eventAggregator;

            RestaurantSelectedEvent restaurantSelectedEvent = _eventAggregator.GetEvent<RestaurantSelectedEvent>();
            restaurantSelectedEvent.Subscribe(RestaurantSelected, ThreadOption.UIThread, true);

            // Subscribe to the service agent callback events
            Callback.GetMenuItemsReturn += GetMenuItemsReturn;
            Callback.GetMenuItemsException += GetMenuItemsException;
        }
コード例 #12
0
 public PublicationDomainService(IPublicationAccess publicationAccess,
                                 IConnectionMonitor connectionMonitor,
                                 IDeliveryService deliveryService,
                                 IAnnotationAccess annotationAccess,
                                 INetwork networkService,
                                 IPackageAccess packageAccess)
 {
     this.publicationAccess = publicationAccess;
     this.connectionMonitor = connectionMonitor;
     this.deliveryService   = deliveryService;
     this.annotationAccess  = annotationAccess;
     this.networkService    = networkService;
     this.packageAccess     = packageAccess;
 }
コード例 #13
0
 public AnnotationSyncService(ISyncService syncService, IAnnotationAccess annotationAccess, IPublicationAccess publicationAccess, IConnectionMonitor connectionMonitor)
 {
     annotationSyncQueue    = new Queue <IAnnotationSyncTask>();
     this.syncService       = syncService;
     this.annotationAccess  = annotationAccess;
     this.publicationAccess = publicationAccess;
     this.connectionMonitor = connectionMonitor;
     actions = new List <ISyncAction>
     {
         //SyncActionFactory.CreateSyncActionBy(SyncActionName.AnnCategoryTagSyncAction)
         //,
         //SyncActionFactory.CreateSyncActionBy(SyncActionName.AnnotationDownloadAction),
         //SyncActionFactory.CreateSyncActionBy(SyncActionName.AnnotationUploadAction)
     };
 }
コード例 #14
0
        public void Initialize(ObservableQueue <T> queue, IRequestDispatcher dispatcher, IConnectionMonitor connectionManager, IQueueRepository <T> queueRepository)
        {
            pendingData                 = queue;
            requestDispatcher           = dispatcher;
            connectionMonitor           = connectionManager;
            this.queueRepository        = queueRepository;
            pendingData.ItemAddedEvent += PendingDataItemAddedEvent;

            connectionManager.ConnectionStatusChangedEvent += ConnectionManagerConnectionStatusChangedEvent;
            SetUpBackgroundWorker();
            if ((connectionManager.IsConnected) && (!backgroundWorker.IsBusy) && ((PendingData.Count > 0)))
            {
                backgroundWorker.RunWorkerAsync();
            }
        }
コード例 #15
0
        public ShellPresenter(IShell shell, IEventAggregator eventAggregator, IConnectionMonitor connectionMonitor)
        {
            Shell = shell;

            StatusUpdateEvent statusUpdateEvent = eventAggregator.GetEvent<StatusUpdateEvent>();
            statusUpdateEvent.Subscribe(StatusUpdate, ThreadOption.UIThread, true);

            ProcessingEvent processingEvent = eventAggregator.GetEvent<ProcessingEvent>();
            processingEvent.Subscribe(ShowProcessing, ThreadOption.UIThread, true);

            // Monitor network status changes.
            _connectionMonitor = connectionMonitor;
            _connectionMonitor.ConnectionStatusChanged += new EventHandler(OnConnectionStatusChanged);

            // Show current connectivity state.
            UpdateConnectivityStatusLabel(_connectionMonitor.IsConnected);
        }
コード例 #16
0
ファイル: RequestManager.cs プロジェクト: yovannyr/scsf2019
        /// <summary>
        /// This method initializes the RequestManager for request dispatching with all the configurable elements.
        /// </summary>
        /// <param name="theRequestQueue">Queue for the pending requests.</param>
        /// <param name="theDeadLetterQueue">Queue for the failures.</param>
        /// <param name="theConnectionMonitor">IConnectionMonitor for connectivity events and info.</param>
        /// <param name="theRequestDispatcher">Dispatcher to be used by the manager.</param>
        /// <param name="theEndpointCatalog">Catalog to get the Endpoint especific information for the dispatching.</param>
        private void Initialize(
            IRequestQueue theRequestQueue,
            IRequestQueue theDeadLetterQueue,
            IConnectionMonitor theConnectionMonitor,
            IRequestDispatcher theRequestDispatcher,
            IEndpointCatalog theEndpointCatalog)
        {
            Guard.ArgumentNotNull(theRequestQueue, "requestQueue");
            Guard.ArgumentNotNull(theDeadLetterQueue, "deadLetterQueue");
            Guard.ArgumentNotNull(theConnectionMonitor, "connectionMonitor");
            Guard.ArgumentNotNull(theRequestDispatcher, "requestDispatcher");
            Guard.ArgumentNotNull(theEndpointCatalog, "endpointCatalog");

            requestQueue      = theRequestQueue;
            requestDispatcher = theRequestDispatcher;
            endpointCatalog   = theEndpointCatalog;
            deadLetterQueue   = theDeadLetterQueue;
            connectionMonitor = theConnectionMonitor;
            dispatchCommands  = new Queue <Command>();
            dispatcherRunning = false;
        }
コード例 #17
0
        private void AddServices()
        {
            // Set up request manager
            RequestManager requestManager = DatabaseRequestManagerIntializer.Initialize();

            requestManager.StartAutomaticDispatch();

            // Monitor network status changes
            _connectionMonitor = requestManager.ConnectionMonitor;
            _connectionMonitor.ConnectionStatusChanged += new EventHandler(connectionMonitor_ConnectionStatusChanged);

            // Show current connectivity state
            UpdateConnectivityStatusLabel(_connectionMonitor.IsConnected);

            // Add the request queue to the Root WorkItem. This queue will be used
            // by service agents to enqueue requests.
            WorkItem.RootWorkItem.Services.Add(requestManager.RequestQueue);

            // Add the connection monitor to the Root WorkItem. It will be used
            // to determine connectivity status and provide feedback to the user
            // accordingly.
            WorkItem.RootWorkItem.Services.Add(_connectionMonitor);
        }
コード例 #18
0
 public LoginDomainService(IUserAccess userAccess, IConnectionMonitor connectionMonitor, IAuthenticationService authenticationService)
 {
     this.userAccess            = userAccess;
     this.connectionMonitor     = connectionMonitor;
     this.authenticationService = authenticationService;
 }
コード例 #19
0
 /// <summary>
 /// Creates a ConnectionStatusChangedEventArgs object.
 /// </summary>
 /// <param name="connection"></param>
 public ConnectionStatusChangedEventArgs(IConnectionMonitor connection)
 {
     this.connection = connection;
 }
コード例 #20
0
 public LoginUtil(IConnectionMonitor connectionMonitor, ILoginDomainService loginDomainService, ICryptogram cryptogram)
 {
     this.connectionMonitor  = connectionMonitor;
     this.loginDomainService = loginDomainService;
     this.cryptogram         = cryptogram;
 }
コード例 #21
0
 public LoginSuccessHandle(IAnnotationSyncService annotationSyncService, IConnectionMonitor connectionMonitor, ITagDomainService annCategoryTagDomainService)
 {
     this.annotationSyncService       = annotationSyncService;
     this.connectionMonitor           = connectionMonitor;
     this.annCategoryTagDomainService = annCategoryTagDomainService;
 }
コード例 #22
0
 public NetMqSubscriber(string address, IConnectionMonitor connectionMonitor = null)
 {
     Address            = address;
     _connectionMonitor = connectionMonitor ?? new DefaultConnectionMonitor();
 }
コード例 #23
0
 private void OnConnectionStateChanged(IConnectionMonitor source, bool state)
 {
     if (state)
     {
         foreach (var synchronizer in _synchronizers)
             synchronizer.Init();
     }
 }
コード例 #24
0
 public void SetConnectionMonitor(IConnectionMonitor monitor)
 {
     logger.Debug("Add connection monitor: {0}", monitor.GetType().Name);
     _connMon = monitor;
 }
コード例 #25
0
 private void OnConnectionStateChanged(IConnectionMonitor source, bool state)
 {
     _connectionStateAction(state);
 }
コード例 #26
0
 public PublicationOpeningEventHandle(IConnectionMonitor connection, IPackageAccess packageAccess, IPublicationAccess publicationAccess)
 {
     this.connectionMonitor = connection;
     this.packageAccess     = packageAccess;
     this.publicationAccess = publicationAccess;
 }