Files
TheXamlGuy bc55c4649b tidy
2024-04-26 23:05:36 +01:00

23 lines
493 B
C#

using Avalonia.Threading;
namespace Toolkit.UI.Controls.Avalonia;
public class ScopedBatchHelper
{
private DispatcherTimer? timer;
public Action? Completed { get; set; }
public void Start(TimeSpan duration)
{
timer ??= new DispatcherTimer(duration, DispatcherPriority.Background, Tick);
timer.Start();
}
private void Tick(object? sender, EventArgs args)
{
timer?.Stop();
Completed?.Invoke();
Completed = null;
}
}