using System.Threading; using System.Threading.Tasks; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; using Squirrowse.Client.Service; using Squirrowse.Core.Models; using Squirrowse.Core.Services; namespace Squirrowse.Client { public class Worker : IHostedService { private readonly IConnectionManager _connectionManager; private readonly ICameraService camera; private readonly ILogger logger; public Worker(ILogger logger, IConnectionManager connectionManager, ICameraService camera) { this.logger = logger; _connectionManager = connectionManager; this.camera = camera; } public async Task StartAsync(CancellationToken cancellationToken) { for (var i = 0; i < 100; i++) await _connectionManager.InitConnection(ConnectionType.Client); } public async Task StopAsync(CancellationToken cancellationToken) { await _connectionManager.Disconnect(); } } }