remove appsettings
This commit is contained in:
@ -5,7 +5,6 @@ using Barcode.Host.Shared.KeyboardMouse;
|
||||
using Barcode.Host.Shared.Models;
|
||||
using Barcode.Host.Shared.Models.Stateless;
|
||||
using Microsoft.AspNetCore.SignalR;
|
||||
using Serilog.Context;
|
||||
using System.Globalization;
|
||||
|
||||
namespace Barcode.Host.Server.HostedService;
|
||||
@ -65,12 +64,9 @@ public class TimedHostedService : IHostedService, IAggregateInputReader, IDispos
|
||||
|
||||
public Task StartAsync(CancellationToken stoppingToken)
|
||||
{
|
||||
string? methodName = IMethodName.GetActualAsyncMethodName();
|
||||
using (LogContext.PushProperty("MethodName", methodName))
|
||||
{
|
||||
_Logger.LogInformation($"Timed Hosted Service: {_AppSettings.BuildSourceVersion}:{Environment.ProcessId} running.");
|
||||
if (!string.IsNullOrEmpty(_AppSettings.SerialPortName))
|
||||
_SerialService.Open();
|
||||
_Logger.LogInformation("Timed Hosted Service: {BuildSourceVersion}:{ProcessId} running.", _AppSettings.BuildSourceVersion, Environment.ProcessId);
|
||||
if (!string.IsNullOrEmpty(_AppSettings.SerialPortName))
|
||||
_SerialService.Open();
|
||||
#if Linux
|
||||
if (!_LinuxGroupManager.IsInInputGroup().WaitAsync(stoppingToken).Result)
|
||||
{
|
||||
@ -80,32 +76,29 @@ public class TimedHostedService : IHostedService, IAggregateInputReader, IDispos
|
||||
_ = _LinuxGroupManager.RebootSystem(_AppSettings.RootPassword);
|
||||
}
|
||||
#endif
|
||||
List<(EventCode, char)> collection = _LastScanService.IncludeEventCodes();
|
||||
foreach ((EventCode eventCode, char @char) in collection)
|
||||
_CharToEventCodes.Add(eventCode, @char);
|
||||
int dueTime = 0;
|
||||
foreach ((string _, Timer timer) in _Timers)
|
||||
{
|
||||
dueTime += 300;
|
||||
_ = timer.Change(dueTime, Timeout.Infinite);
|
||||
}
|
||||
List<(EventCode, char)> collection = _LastScanService.IncludeEventCodes();
|
||||
foreach ((EventCode eventCode, char @char) in collection)
|
||||
_CharToEventCodes.Add(eventCode, @char);
|
||||
int dueTime = 0;
|
||||
foreach ((string _, Timer timer) in _Timers)
|
||||
{
|
||||
dueTime += 300;
|
||||
_ = timer.Change(dueTime, Timeout.Infinite);
|
||||
}
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public Task StopAsync(CancellationToken stoppingToken)
|
||||
{
|
||||
string? methodName = IMethodName.GetActualAsyncMethodName();
|
||||
using (LogContext.PushProperty("MethodName", methodName))
|
||||
_Logger.LogInformation("Timed Hosted Service: {BuildSourceVersion}:{ProcessId} is stopping.", _AppSettings.BuildSourceVersion, Environment.ProcessId);
|
||||
for (short i = 0; i < short.MaxValue; i++)
|
||||
{
|
||||
_Logger.LogInformation($"Timed Hosted Service: {_AppSettings.BuildSourceVersion}:{Environment.ProcessId} is stopping.");
|
||||
for (short i = 0; i < short.MaxValue; i++)
|
||||
{
|
||||
Thread.Sleep(500);
|
||||
if (_ExecutionCount == 0)
|
||||
break;
|
||||
}
|
||||
Thread.Sleep(500);
|
||||
if (_ExecutionCount == 0)
|
||||
break;
|
||||
}
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user