Skip to content

Commit

Permalink
Add Notification Options without title
Browse files Browse the repository at this point in the history
  • Loading branch information
cwinland committed Oct 23, 2023
1 parent a6e781e commit 737f926
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 5 deletions.
9 changes: 6 additions & 3 deletions Wpf.NotificationCenter/Services/IWpfNotificationService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ Note CreateToastNotification(string title, string text,
/// <returns>Alert Center Notification.</returns>
Note Error(string title, string text, string? notificationCenterName = null, AlertType alertType = AlertType.All);

Note Error(string text, string? notificationCenterName = null, AlertType alertType = AlertType.All);

/// <summary>
/// Gets the last alert center notification.
/// </summary>
Expand All @@ -83,8 +85,8 @@ Note CreateToastNotification(string title, string text,
/// <param name="notificationCenterName">Name of the notification center.</param>
/// <param name="alertType">Type of the alert.</param>
/// <returns>Alert Center Notification.</returns>
Notification.Notification Information(string title, string text, string? notificationCenterName = null, AlertType alertType = AlertType.All);

Note Information(string title, string text, string? notificationCenterName = null, AlertType alertType = AlertType.All);
Note Information(string text, string? notificationCenterName = null, AlertType alertType = AlertType.All);
/// <summary>
/// Creates the success notification(s).
/// </summary>
Expand All @@ -94,7 +96,7 @@ Note CreateToastNotification(string title, string text,
/// <param name="alertType">Type of the alert.</param>
/// <returns>Alert Center Notification.</returns>
Note Success(string title, string text, string? notificationCenterName = null, AlertType alertType = AlertType.All);

Note Success(string text, string? notificationCenterName = null, AlertType alertType = AlertType.All);
/// <summary>
/// Creates the warning notification(s).
/// </summary>
Expand All @@ -104,5 +106,6 @@ Note CreateToastNotification(string title, string text,
/// <param name="alertType">Type of the alert.</param>
/// <returns>Alert Center Notification.</returns>
Note Warning(string title, string text, string? notificationCenterName = null, AlertType alertType = AlertType.All);
Note Warning(string text, string? notificationCenterName = null, AlertType alertType = AlertType.All);
}
}
20 changes: 18 additions & 2 deletions Wpf.NotificationCenter/Services/WpfNotificationService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ namespace Wpf.NotificationCenter.Services
/// notificationService.Warning(title, text, AlertType.NotificationPopup);
/// ]]>
/// </code>
/// Get the last toast or alert center notification:
/// <code>
/// Get the last toast or alert center notification:
/// <code>
/// <![CDATA[
/// var toast = notificationService.GetLastToastNotification();
/// var alert = notificationService.GetLastAlertCenterNotification();
Expand Down Expand Up @@ -135,6 +135,10 @@ public Note Error(string title, string text, string? notificationCenterName = nu
AlertType alertType = AlertType.All) =>
Create(title, text, NotificationType.Error, notificationCenterName, alertType);

/// <inheritdoc />
public Note Error(string text, string? notificationCenterName = null, AlertType alertType = AlertType.All) =>
Error("Error", text, notificationCenterName, alertType);

/// <inheritdoc />
public Note GetLastAlertCenterNotification(string? notificationCenterName = null) =>
GetNotificationCenter(notificationCenterName).DisplayNotes.Last();
Expand All @@ -147,14 +151,26 @@ public Note GetLastToastNotification(string? notificationCenterName = null) =>
public Note Information(string title, string text, string? notificationCenterName = null,
AlertType alertType = AlertType.All) => Create(title, text, NotificationType.Information, notificationCenterName, alertType);

/// <inheritdoc />
public Note Information(string text, string? notificationCenterName = null, AlertType alertType = AlertType.All) =>
Information("Information", text, notificationCenterName, alertType);

/// <inheritdoc />
public Note Success(string title, string text, string? notificationCenterName = null,
AlertType alertType = AlertType.All) => Create(title, text, NotificationType.Success, notificationCenterName, alertType);

/// <inheritdoc />
public Note Success(string text, string? notificationCenterName = null, AlertType alertType = AlertType.All) =>
Success("Success", text, notificationCenterName, alertType);

/// <inheritdoc />
public Note Warning(string title, string text, string? notificationCenterName = null,
AlertType alertType = AlertType.All) => Create(title, text, NotificationType.Warning, notificationCenterName, alertType);

/// <inheritdoc />
public Note Warning(string text, string? notificationCenterName = null, AlertType alertType = AlertType.All) =>
Warning("Warning", text, notificationCenterName, alertType);

#endregion
}
}

0 comments on commit 737f926

Please sign in to comment.