20 lines
447 B
C#
20 lines
447 B
C#
|
using System;
|
|||
|
using Avalonia.Controls;
|
|||
|
using Avalonia.Threading;
|
|||
|
using DispenserCommon.Scheduler;
|
|||
|
|
|||
|
namespace DispenserUI.Views.Windows;
|
|||
|
|
|||
|
public class ToastWindow(int duration = 3000) : Window
|
|||
|
{
|
|||
|
protected override void OnOpened(EventArgs e)
|
|||
|
{
|
|||
|
base.OnOpened(e);
|
|||
|
DelayScheduler.Delay(ToClose, TimeSpan.FromMilliseconds(duration));
|
|||
|
}
|
|||
|
|
|||
|
protected void ToClose()
|
|||
|
{
|
|||
|
Dispatcher.UIThread.Invoke(Close);
|
|||
|
}
|
|||
|
}
|