Exemplo n.º 1
0
        public SyncThingManager(
            ISyncThingProcessRunner processRunner,
            ISyncThingApiClientFactory apiClientFactory,
            ISyncThingEventWatcherFactory eventWatcherFactory,
            ISyncThingConnectionsWatcherFactory connectionsWatcherFactory,
            IFreePortFinder freePortFinder)
        {
            this.StartedTime = DateTime.MinValue;
            this.LastConnectivityEventTime = DateTime.MinValue;

            this.eventDispatcher  = new SynchronizedEventDispatcher(this);
            this.processRunner    = processRunner;
            this.apiClientFactory = apiClientFactory;
            this.freePortFinder   = freePortFinder;

            this.apiClient = new SynchronizedTransientWrapper <ISyncThingApiClient>(this.apiClientsLock);

            this.eventWatcher = eventWatcherFactory.CreateEventWatcher(this.apiClient);
            this.eventWatcher.DeviceConnected    += (o, e) => this.OnDeviceConnected(e);
            this.eventWatcher.DeviceDisconnected += (o, e) => this.OnDeviceDisconnected(e);
            this.eventWatcher.ConfigSaved        += (o, e) => this.ReloadConfigDataAsync();
            this.eventWatcher.EventsSkipped      += (o, e) => this.ReloadConfigDataAsync();

            this.connectionsWatcher = connectionsWatcherFactory.CreateConnectionsWatcher(this.apiClient);
            this.connectionsWatcher.TotalConnectionStatsChanged += (o, e) => this.OnTotalConnectionStatsChanged(e.TotalConnectionStats);

            this._folders         = new SyncThingFolderManager(this.apiClient, this.eventWatcher, TimeSpan.FromMinutes(10));
            this._transferHistory = new SyncThingTransferHistory(this.eventWatcher, this._folders);

            this.processRunner.ProcessStopped   += (o, e) => this.ProcessStopped(e.ExitStatus);
            this.processRunner.MessageLogged    += (o, e) => this.OnMessageLogged(e.LogMessage);
            this.processRunner.ProcessRestarted += (o, e) => this.ProcessRestarted();
            this.processRunner.Starting         += (o, e) => this.ProcessStarting();
        }
Exemplo n.º 2
0
        public SyncThingManager(
            ISyncThingProcessRunner processRunner,
            ISyncThingApiClientFactory apiClientFactory,
            ISyncThingEventWatcherFactory eventWatcherFactory,
            ISyncThingConnectionsWatcherFactory connectionsWatcherFactory)
        {
            this.StartedTime = DateTime.MinValue;
            this.LastConnectivityEventTime = DateTime.MinValue;

            this.eventDispatcher           = new SynchronizedEventDispatcher(this);
            this.processRunner             = processRunner;
            this.apiClientFactory          = apiClientFactory;
            this.eventWatcherFactory       = eventWatcherFactory;
            this.connectionsWatcherFactory = connectionsWatcherFactory;

            this.processRunner.ProcessStopped   += (o, e) => this.ProcessStopped(e.ExitStatus);
            this.processRunner.MessageLogged    += (o, e) => this.OnMessageLogged(e.LogMessage);
            this.processRunner.ProcessRestarted += (o, e) => this.ProcessRestarted();
            this.processRunner.Starting         += (o, e) => this.ProcessStarting();
        }
Exemplo n.º 3
0
        public SyncThingManager(
            ISyncThingProcessRunner processRunner,
            ISyncThingApiClientFactory apiClientFactory,
            ISyncThingEventWatcherFactory eventWatcherFactory,
            ISyncThingConnectionsWatcherFactory connectionsWatcherFactory,
            IFreePortFinder freePortFinder)
        {
            this.StartedTime = DateTime.MinValue;
            this.LastConnectivityEventTime = DateTime.MinValue;

            this.eventDispatcher = new SynchronizedEventDispatcher(this);
            this.processRunner = processRunner;
            this.apiClientFactory = apiClientFactory;
            this.freePortFinder = freePortFinder;

            this.apiClient = new SynchronizedTransientWrapper<ISyncThingApiClient>(this.apiClientsLock);

            this.eventWatcher = eventWatcherFactory.CreateEventWatcher(this.apiClient);
            this.eventWatcher.DeviceConnected += (o, e) => this.OnDeviceConnected(e);
            this.eventWatcher.DeviceDisconnected += (o, e) => this.OnDeviceDisconnected(e);
            this.eventWatcher.ConfigSaved += (o, e) => this.ReloadConfigDataAsync();
            this.eventWatcher.EventsSkipped += (o, e) => this.ReloadConfigDataAsync();

            this.connectionsWatcher = connectionsWatcherFactory.CreateConnectionsWatcher(this.apiClient);
            this.connectionsWatcher.TotalConnectionStatsChanged += (o, e) => this.OnTotalConnectionStatsChanged(e.TotalConnectionStats);

            this._folders = new SyncThingFolderManager(this.apiClient, this.eventWatcher, TimeSpan.FromMinutes(10));
            this._transferHistory = new SyncThingTransferHistory(this.eventWatcher, this._folders);

            this.processRunner.ProcessStopped += (o, e) => this.ProcessStopped(e.ExitStatus);
            this.processRunner.MessageLogged += (o, e) => this.OnMessageLogged(e.LogMessage);
            this.processRunner.ProcessRestarted += (o, e) => this.ProcessRestarted();
            this.processRunner.Starting += (o, e) => this.ProcessStarting();
        }