static async Task Main() { using var serviceProvider = GetServiceProvider(); InitializeServices(serviceProvider); await LoginAsync(serviceProvider); ConfigureShutDownBehaviour(); await ConnectToHubAsync(serviceProvider); while (!shutDownWasEmmited.WaitOne(0)) { if (reloginWasEmmited.WaitOne(0)) { Logger.StartNewSection(); await LoginAsync(serviceProvider); } IRoutine routine = GetRoutine(serviceProvider); await routine.RunAsync(); } DisposeResources(); }