PalacePal/Pal.Client/Scheduled/QueuedConfigUpdate.cs

38 lines
1.3 KiB
C#

using Pal.Client.Configuration;
using Pal.Client.DependencyInjection;
namespace Pal.Client.Scheduled
{
internal sealed class QueuedConfigUpdate : IQueueOnFrameworkThread
{
internal sealed class Handler : IQueueOnFrameworkThread.Handler<QueuedConfigUpdate>
{
private readonly IPalacePalConfiguration _configuration;
private readonly FloorService _floorService;
private readonly TerritoryState _territoryState;
public Handler(IPalacePalConfiguration configuration, FloorService floorService,
TerritoryState territoryState)
{
_configuration = configuration;
_floorService = floorService;
_territoryState = territoryState;
}
protected override void Run(QueuedConfigUpdate queued, ref bool recreateLayout, ref bool saveMarkers)
{
if (_configuration.Mode == EMode.Offline)
{
LocalState.UpdateAll();
_floorService.FloorMarkers.Clear();
_floorService.EphemeralMarkers.Clear();
_territoryState.LastTerritory = 0;
recreateLayout = true;
saveMarkers = true;
}
}
}
}
}