c#消息信息框, 可自动关闭. 类似web信息框,开源组件ToastNotifications
By
admin
at 2025-05-28 • 0人收藏 • 343人看过

开源地址: https://github.com/rafallopatka/ToastNotifications
using ToastNotifications;
using ToastNotifications.Lifetime;
using ToastNotifications.Position;
/* * */
Notifier notifier = new Notifier(cfg =>
{
cfg.PositionProvider = new WindowPositionProvider(
parentWindow: Application.Current.MainWindow,
corner: Corner.TopRight,
offsetX: 10,
offsetY: 10);
cfg.LifetimeSupervisor = new TimeAndCountBasedLifetimeSupervisor(
notificationLifetime: TimeSpan.FromSeconds(3),
maximumNotificationCount: MaximumNotificationCount.FromCount(5));
cfg.Dispatcher = Application.Current.Dispatcher;
});using ToastNotifications.Messages; /* * */ notifier.ShowInformation(message); notifier.ShowSuccess(message); notifier.ShowWarning(message); notifier.ShowError(message);
2 个回复 | 最后更新于 2025-05-30
zhlzhang
2025-05-29
#1





登录后方可回帖
