Skip to content

Commit

Permalink
Fix overloaded notification methods
Browse files Browse the repository at this point in the history
  • Loading branch information
cwinland committed Oct 24, 2023
1 parent e089543 commit abbd444
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 21 deletions.
5 changes: 0 additions & 5 deletions Wpf.NotificationCenter/Notification/Notification.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@ public partial class Notification : INotifyPropertyChanged
{
#region Events

/// <summary>
/// Occurs when content is clicked.
/// </summary>
public event EventHandler? OnClicked;

/// <inheritdoc />
public event PropertyChangedEventHandler? PropertyChanged;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,16 @@

namespace Wpf.NotificationCenter.Notification
{
/// <inheritdoc cref="UserControl" />
/// <summary>
/// Interaction logic for NotificationHeader.xaml
/// Interaction logic for NotificationHeader.xaml
/// </summary>
public partial class NotificationHeader : UserControl
{
/// <inheritdoc />
/// <summary>
/// Initializes a new instance of the <see cref="T:Wpf.NotificationCenter.Notification.NotificationHeader" /> class.
/// </summary>
public NotificationHeader() => InitializeComponent();
}
}
2 changes: 0 additions & 2 deletions Wpf.NotificationCenter/NotificationCenter.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -532,8 +532,6 @@ internal Note CreateNotificationPopup(Note notification)
Dispatcher.CurrentDispatcher
);

newNote.OnClicked += TimerCallback;

timer.Start();

void TimerCallback(object? sender, EventArgs? args)
Expand Down
39 changes: 34 additions & 5 deletions Wpf.NotificationCenter/Services/IWpfNotificationService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,20 @@ 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>
/// Errors the specified text.
/// </summary>
/// <param name="text">The text.</param>
/// <param name="alertType">Type of the alert.</param>
/// <returns>Errors.</returns>
Note Error(string text, AlertType alertType = AlertType.All);

/// <summary>
/// Gets the last alert center notification.
/// </summary>
/// <param name="notificationCenterName">Name of the notification center.</param>
/// <returns>Notification ofNotification of the last alert center notification.</returns>
Notification.Notification GetLastAlertCenterNotification(string? notificationCenterName = null);
Note GetLastAlertCenterNotification(string? notificationCenterName = null);

/// <summary>
/// Gets the last toast notification.
Expand All @@ -86,7 +92,15 @@ Note CreateToastNotification(string title, string text,
/// <param name="alertType">Type of the alert.</param>
/// <returns>Alert Center Notification.</returns>
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>
/// Informations the specified text.
/// </summary>
/// <param name="text">The text.</param>
/// <param name="alertType">Type of the alert.</param>
/// <returns>Informations.</returns>
Note Information(string text, AlertType alertType = AlertType.All);

/// <summary>
/// Creates the success notification(s).
/// </summary>
Expand All @@ -96,7 +110,15 @@ 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>
/// Successes the specified text.
/// </summary>
/// <param name="text">The text.</param>
/// <param name="alertType">Type of the alert.</param>
/// <returns>Successes.</returns>
Note Success(string text, AlertType alertType = AlertType.All);

/// <summary>
/// Creates the warning notification(s).
/// </summary>
Expand All @@ -106,6 +128,13 @@ 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);

/// <summary>
/// Warnings the specified text.
/// </summary>
/// <param name="text">The text.</param>
/// <param name="alertType">Type of the alert.</param>
/// <returns>Warnings.</returns>
Note Warning(string text, AlertType alertType = AlertType.All);
}
}
16 changes: 8 additions & 8 deletions Wpf.NotificationCenter/Services/WpfNotificationService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ public Note Error(string title, string text, string? notificationCenterName = nu
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);
public Note Error(string text, AlertType alertType = AlertType.All) =>
Error("Error", text, null, alertType);

/// <inheritdoc />
public Note GetLastAlertCenterNotification(string? notificationCenterName = null) =>
Expand All @@ -152,24 +152,24 @@ public Note Information(string title, string text, string? notificationCenterNam
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);
public Note Information(string text, AlertType alertType = AlertType.All) =>
Information("Information", text, null, 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);
public Note Success(string text, AlertType alertType = AlertType.All) =>
Success("Success", text, null, 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);
public Note Warning(string text, AlertType alertType = AlertType.All) =>
Warning("Warning", text, null, alertType);

#endregion
}
Expand Down

0 comments on commit abbd444

Please sign in to comment.