PalacePal/Pal.Client/Scheduled/QueuedUndoImport.cs

36 lines
990 B
C#
Raw Normal View History

2022-12-24 09:27:59 +00:00
using ECommons.Configuration;
using Pal.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Pal.Client.Scheduled
{
internal class QueuedUndoImport : IQueueOnFrameworkThread
{
private readonly Guid _exportId;
public QueuedUndoImport(Guid exportId)
{
_exportId = exportId;
}
public void Run(Plugin plugin, ref bool recreateLayout, ref bool saveMarkers)
{
recreateLayout = true;
saveMarkers = true;
foreach (ETerritoryType territoryType in typeof(ETerritoryType).GetEnumValues())
{
var localState = plugin.GetFloorMarkers((ushort)territoryType);
localState.UndoImport(new List<Guid> { _exportId });
localState.Save();
}
Service.Configuration.ImportHistory.RemoveAll(hist => hist.Id == _exportId);
}
}
}