PalacePal/Pal.Client/Scheduled/QueuedUndoImport.cs

42 lines
1.1 KiB
C#
Raw Normal View History

2023-02-15 22:17:19 +00:00
using System;
using System.Collections.Generic;
using Microsoft.Extensions.Logging;
using Pal.Client.Configuration;
using Pal.Client.DependencyInjection;
2023-02-18 20:12:36 +00:00
using Pal.Client.Floors;
2023-02-16 18:51:54 +00:00
using Pal.Client.Windows;
using Pal.Common;
2022-12-24 09:27:59 +00:00
2023-03-30 20:01:43 +00:00
namespace Pal.Client.Scheduled;
internal sealed class QueuedUndoImport : IQueueOnFrameworkThread
2022-12-24 09:27:59 +00:00
{
2023-03-30 20:01:43 +00:00
public QueuedUndoImport(Guid exportId)
2022-12-24 09:27:59 +00:00
{
2023-03-30 20:01:43 +00:00
ExportId = exportId;
}
2022-12-24 09:27:59 +00:00
2023-03-30 20:01:43 +00:00
private Guid ExportId { get; }
2023-03-30 20:01:43 +00:00
internal sealed class Handler : IQueueOnFrameworkThread.Handler<QueuedUndoImport>
{
private readonly ImportService _importService;
private readonly ConfigWindow _configWindow;
2023-03-30 20:01:43 +00:00
public Handler(ILogger<Handler> logger, ImportService importService, ConfigWindow configWindow)
: base(logger)
{
_importService = importService;
_configWindow = configWindow;
}
2023-03-30 20:01:43 +00:00
protected override void Run(QueuedUndoImport queued, ref bool recreateLayout)
{
recreateLayout = true;
2023-03-30 20:01:43 +00:00
_importService.RemoveById(queued.ExportId);
_configWindow.UpdateLastImport();
}
2022-12-24 09:27:59 +00:00
}
}