You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
760 B
28 lines
760 B
using Avalonia; |
|
using Avalonia.Controls; |
|
using Avalonia.Controls.Notifications; |
|
|
|
namespace StabilityMatrix.Avalonia.Services; |
|
|
|
public class NotificationService : INotificationService |
|
{ |
|
private WindowNotificationManager? notificationManager; |
|
|
|
public void Initialize( |
|
Visual? visual, |
|
NotificationPosition position = NotificationPosition.BottomRight, |
|
int maxItems = 3) |
|
{ |
|
if (notificationManager is not null) return; |
|
notificationManager = new WindowNotificationManager(TopLevel.GetTopLevel(visual)) |
|
{ |
|
Position = position, |
|
MaxItems = maxItems |
|
}; |
|
} |
|
|
|
public void Show(INotification notification) |
|
{ |
|
notificationManager?.Show(notification); |
|
} |
|
}
|
|
|