mirror of
https://github.com/jayfunc/BetterLyrics.git
synced 2026-01-12 10:54:55 +08:00
24 lines
877 B
C#
24 lines
877 B
C#
using BetterLyrics.WinUI3.Services.LocalizationService;
|
|
using CommunityToolkit.Mvvm.DependencyInjection;
|
|
using Microsoft.UI.Xaml.Controls;
|
|
using Microsoft.Windows.AppNotifications;
|
|
using Microsoft.Windows.AppNotifications.Builder;
|
|
|
|
namespace BetterLyrics.WinUI3.Helper
|
|
{
|
|
public class ToastHelper
|
|
{
|
|
private static readonly ILocalizationService _localizationService = Ioc.Default.GetRequiredService<ILocalizationService>();
|
|
|
|
public static void ShowToast(string localizedTitleKey, string? description, InfoBarSeverity severity)
|
|
{
|
|
AppNotification notification = new AppNotificationBuilder()
|
|
.AddText(_localizationService.GetLocalizedString(localizedTitleKey))
|
|
.AddText(description)
|
|
.BuildNotification();
|
|
|
|
AppNotificationManager.Default.Show(notification);
|
|
}
|
|
}
|
|
}
|