|
|
|
@ -1,4 +1,7 @@ |
|
|
|
using System; |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.ComponentModel; |
|
|
|
using System.Runtime.CompilerServices; |
|
|
|
|
|
|
|
namespace Avalonia.Controls.Notifications |
|
|
|
{ |
|
|
|
@ -9,8 +12,10 @@ namespace Avalonia.Controls.Notifications |
|
|
|
/// This class represents a notification that can be displayed either in a window using
|
|
|
|
/// <see cref="WindowNotificationManager"/> or by the host operating system (to be implemented).
|
|
|
|
/// </remarks>
|
|
|
|
public class Notification : INotification |
|
|
|
public class Notification : INotification, INotifyPropertyChanged |
|
|
|
{ |
|
|
|
private string? _title, _message; |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Initializes a new instance of the <see cref="Notification"/> class.
|
|
|
|
/// </summary>
|
|
|
|
@ -35,23 +40,59 @@ namespace Avalonia.Controls.Notifications |
|
|
|
OnClick = onClick; |
|
|
|
OnClose = onClose; |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Initializes a new instance of the <see cref="Notification"/> class.
|
|
|
|
/// </summary>
|
|
|
|
public Notification() : this(null, null) |
|
|
|
{ |
|
|
|
} |
|
|
|
|
|
|
|
/// <inheritdoc/>
|
|
|
|
public string? Title { get; private set; } |
|
|
|
public string? Title |
|
|
|
{ |
|
|
|
get => _title; |
|
|
|
set |
|
|
|
{ |
|
|
|
if (_title != value) |
|
|
|
{ |
|
|
|
_title = value; |
|
|
|
OnPropertyChanged(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/// <inheritdoc/>
|
|
|
|
public string? Message { get; private set; } |
|
|
|
public string? Message |
|
|
|
{ |
|
|
|
get => _message; |
|
|
|
set |
|
|
|
{ |
|
|
|
if (_message != value) |
|
|
|
{ |
|
|
|
_message = value; |
|
|
|
OnPropertyChanged(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/// <inheritdoc/>
|
|
|
|
public NotificationType Type { get; private set; } |
|
|
|
public NotificationType Type { get; set; } |
|
|
|
|
|
|
|
/// <inheritdoc/>
|
|
|
|
public TimeSpan Expiration { get; private set; } |
|
|
|
public TimeSpan Expiration { get; set; } |
|
|
|
|
|
|
|
/// <inheritdoc/>
|
|
|
|
public Action? OnClick { get; private set; } |
|
|
|
public Action? OnClick { get; set; } |
|
|
|
|
|
|
|
/// <inheritdoc/>
|
|
|
|
public Action? OnClose { get; private set; } |
|
|
|
public Action? OnClose { get; set; } |
|
|
|
|
|
|
|
public event PropertyChangedEventHandler? PropertyChanged; |
|
|
|
|
|
|
|
protected virtual void OnPropertyChanged([CallerMemberName] string? propertyName = null) |
|
|
|
{ |
|
|
|
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|