From abbd444ced688cd04967ec0cd74bcd12b6a77fc7 Mon Sep 17 00:00:00 2001 From: Christopher Winland Date: Tue, 24 Oct 2023 07:17:18 -0400 Subject: [PATCH] Fix overloaded notification methods --- .../Notification/Notification.xaml.cs | 5 --- .../Notification/NotificationHeader.xaml.cs | 7 +++- .../NotificationCenter.xaml.cs | 2 - .../Services/IWpfNotificationService.cs | 39 ++++++++++++++++--- .../Services/WpfNotificationService.cs | 16 ++++---- 5 files changed, 48 insertions(+), 21 deletions(-) diff --git a/Wpf.NotificationCenter/Notification/Notification.xaml.cs b/Wpf.NotificationCenter/Notification/Notification.xaml.cs index cee90bb..99a8206 100644 --- a/Wpf.NotificationCenter/Notification/Notification.xaml.cs +++ b/Wpf.NotificationCenter/Notification/Notification.xaml.cs @@ -15,11 +15,6 @@ public partial class Notification : INotifyPropertyChanged { #region Events - /// - /// Occurs when content is clicked. - /// - public event EventHandler? OnClicked; - /// public event PropertyChangedEventHandler? PropertyChanged; diff --git a/Wpf.NotificationCenter/Notification/NotificationHeader.xaml.cs b/Wpf.NotificationCenter/Notification/NotificationHeader.xaml.cs index 2d30e8f..80fbaa0 100644 --- a/Wpf.NotificationCenter/Notification/NotificationHeader.xaml.cs +++ b/Wpf.NotificationCenter/Notification/NotificationHeader.xaml.cs @@ -2,11 +2,16 @@ namespace Wpf.NotificationCenter.Notification { + /// /// - /// Interaction logic for NotificationHeader.xaml + /// Interaction logic for NotificationHeader.xaml /// public partial class NotificationHeader : UserControl { + /// + /// + /// Initializes a new instance of the class. + /// public NotificationHeader() => InitializeComponent(); } } diff --git a/Wpf.NotificationCenter/NotificationCenter.xaml.cs b/Wpf.NotificationCenter/NotificationCenter.xaml.cs index 69d0f3d..aa80dd5 100644 --- a/Wpf.NotificationCenter/NotificationCenter.xaml.cs +++ b/Wpf.NotificationCenter/NotificationCenter.xaml.cs @@ -532,8 +532,6 @@ internal Note CreateNotificationPopup(Note notification) Dispatcher.CurrentDispatcher ); - newNote.OnClicked += TimerCallback; - timer.Start(); void TimerCallback(object? sender, EventArgs? args) diff --git a/Wpf.NotificationCenter/Services/IWpfNotificationService.cs b/Wpf.NotificationCenter/Services/IWpfNotificationService.cs index 86a814c..64dde65 100644 --- a/Wpf.NotificationCenter/Services/IWpfNotificationService.cs +++ b/Wpf.NotificationCenter/Services/IWpfNotificationService.cs @@ -61,14 +61,20 @@ Note CreateToastNotification(string title, string text, /// Alert Center Notification. Note Error(string title, string text, string? notificationCenterName = null, AlertType alertType = AlertType.All); - Note Error(string text, string? notificationCenterName = null, AlertType alertType = AlertType.All); + /// + /// Errors the specified text. + /// + /// The text. + /// Type of the alert. + /// Errors. + Note Error(string text, AlertType alertType = AlertType.All); /// /// Gets the last alert center notification. /// /// Name of the notification center. /// Notification ofNotification of the last alert center notification. - Notification.Notification GetLastAlertCenterNotification(string? notificationCenterName = null); + Note GetLastAlertCenterNotification(string? notificationCenterName = null); /// /// Gets the last toast notification. @@ -86,7 +92,15 @@ Note CreateToastNotification(string title, string text, /// Type of the alert. /// Alert Center Notification. Note Information(string title, string text, string? notificationCenterName = null, AlertType alertType = AlertType.All); - Note Information(string text, string? notificationCenterName = null, AlertType alertType = AlertType.All); + + /// + /// Informations the specified text. + /// + /// The text. + /// Type of the alert. + /// Informations. + Note Information(string text, AlertType alertType = AlertType.All); + /// /// Creates the success notification(s). /// @@ -96,7 +110,15 @@ Note CreateToastNotification(string title, string text, /// Type of the alert. /// Alert Center Notification. Note Success(string title, string text, string? notificationCenterName = null, AlertType alertType = AlertType.All); - Note Success(string text, string? notificationCenterName = null, AlertType alertType = AlertType.All); + + /// + /// Successes the specified text. + /// + /// The text. + /// Type of the alert. + /// Successes. + Note Success(string text, AlertType alertType = AlertType.All); + /// /// Creates the warning notification(s). /// @@ -106,6 +128,13 @@ Note CreateToastNotification(string title, string text, /// Type of the alert. /// Alert Center Notification. Note Warning(string title, string text, string? notificationCenterName = null, AlertType alertType = AlertType.All); - Note Warning(string text, string? notificationCenterName = null, AlertType alertType = AlertType.All); + + /// + /// Warnings the specified text. + /// + /// The text. + /// Type of the alert. + /// Warnings. + Note Warning(string text, AlertType alertType = AlertType.All); } } diff --git a/Wpf.NotificationCenter/Services/WpfNotificationService.cs b/Wpf.NotificationCenter/Services/WpfNotificationService.cs index 1e8f1b4..c61391c 100644 --- a/Wpf.NotificationCenter/Services/WpfNotificationService.cs +++ b/Wpf.NotificationCenter/Services/WpfNotificationService.cs @@ -136,8 +136,8 @@ public Note Error(string title, string text, string? notificationCenterName = nu Create(title, text, NotificationType.Error, notificationCenterName, alertType); /// - 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); /// public Note GetLastAlertCenterNotification(string? notificationCenterName = null) => @@ -152,24 +152,24 @@ public Note Information(string title, string text, string? notificationCenterNam AlertType alertType = AlertType.All) => Create(title, text, NotificationType.Information, notificationCenterName, alertType); /// - 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); /// public Note Success(string title, string text, string? notificationCenterName = null, AlertType alertType = AlertType.All) => Create(title, text, NotificationType.Success, notificationCenterName, alertType); /// - 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); /// public Note Warning(string title, string text, string? notificationCenterName = null, AlertType alertType = AlertType.All) => Create(title, text, NotificationType.Warning, notificationCenterName, alertType); /// - 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 }