Enterwell / Wpf.Notifications

WPF notifications UI controls (as seen in VS Code)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

API: `DismissDelayed` extension

AleksandarDev opened this issue · comments

NotificationMessageBuilder.DismissNotificationMessageButton needs to be refactored to NotificationMessageBuilder.DismissNotificationMessage

Implement following builder methods:

public static NotificationMessageBuilder Delayed(
        this NotificationMessageBuilder.DismissNotificationMessage dismiss,
        long delayMilliseconds,
        Action<INotificationMessage> callback = null)

public static NotificationMessageBuilder Delayed(
        this NotificationMessageBuilder.DismissNotificationMessage dismiss,
        TimeSpan delay,
        Action<INotificationMessage> callback = null)

Delay is required (no default), callback is optional.

Use case:

var builder = this.Manager
    .CreateMessage()
    .Accent("#E0A030")
    .Background("#333")
    .HasBadge("Warn")
    .HasMessage("Failed to retrieve data.")
    .WithButton("Try again", button => { })
    .Dismiss().Delayed(5000);

Should still support Dismiss().WithButton() API for backward-compatibility.