Toolkit.UI.Controls.Avalonia
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,22 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user