fix disposes and add TextureWrapIconSource

This commit is contained in:
Soreepeong 2024-02-26 04:16:36 +09:00
parent 9644dd9922
commit 42b6f8fd4b
10 changed files with 187 additions and 81 deletions

View file

@ -56,11 +56,6 @@ public interface IActiveNotification : INotification
/// <inheritdoc cref="INotification.Type"/>
new NotificationType Type { get; set; }
/// <summary>Gets or sets the icon source.</summary>
/// <remarks>Setting a new value to this property does not change the icon. Use <see cref="UpdateIcon"/> to do so.
/// </remarks>
new INotificationIconSource? IconSource { get; set; }
/// <inheritdoc cref="INotification.Expiry"/>
new DateTime Expiry { get; set; }
@ -86,25 +81,19 @@ public interface IActiveNotification : INotification
/// <remarks>This includes when the hide animation is being played.</remarks>
bool IsDismissed { get; }
/// <summary>Clones this notification as a <see cref="Notification"/>.</summary>
/// <returns>A new instance of <see cref="Notification"/>.</returns>
Notification CloneNotification();
/// <summary>Dismisses this notification.</summary>
void DismissNow();
/// <summary>Updates the notification data.</summary>
/// <remarks>
/// Call <see cref="UpdateIcon"/> to update the icon using the new <see cref="INotification.IconSource"/>.
/// If <see cref="IsDismissed"/> is <c>true</c>, then this function is a no-op.
/// </remarks>
/// <param name="newNotification">The new notification entry.</param>
void Update(INotification newNotification);
/// <summary>Loads the icon again using <see cref="INotification.IconSource"/>.</summary>
/// <summary>Loads the icon again using the same <see cref="INotification.IconSource"/>.</summary>
/// <remarks>If <see cref="IsDismissed"/> is <c>true</c>, then this function is a no-op.</remarks>
void UpdateIcon();
/// <summary>Disposes the previous icon source, take ownership of the new icon source,
/// and calls <see cref="UpdateIcon"/>.</summary>
/// <param name="newIconSource">Thew new icon source.</param>
/// <remarks>If <see cref="IsDismissed"/> is <c>true</c>, then this function is a no-op.</remarks>
void UpdateIconSource(INotificationIconSource? newIconSource);
/// <summary>Generates a new value to use for <see cref="Id"/>.</summary>
/// <returns>The new value.</returns>
internal static long CreateNewId() => Interlocked.Increment(ref idCounter);