From c7d64d00156d6a20415d841855f5c073f421bcde Mon Sep 17 00:00:00 2001 From: Andrei Zavatski Date: Tue, 18 Feb 2020 13:37:59 +0300 Subject: [PATCH] Update BindableList usage in DrawableComment --- osu.Game/Overlays/Comments/DrawableComment.cs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Comments/DrawableComment.cs b/osu.Game/Overlays/Comments/DrawableComment.cs index 7774921f00..cb9e32f1ad 100644 --- a/osu.Game/Overlays/Comments/DrawableComment.cs +++ b/osu.Game/Overlays/Comments/DrawableComment.cs @@ -21,6 +21,7 @@ using System.Collections.Generic; using System; using osu.Framework.Graphics.Shapes; using osu.Framework.Extensions.IEnumerableExtensions; +using System.Collections.Specialized; namespace osu.Game.Overlays.Comments { @@ -269,10 +270,21 @@ namespace osu.Game.Overlays.Comments }); } - Replies.ItemsAdded += onRepliesAdded; - if (Replies.Any()) onRepliesAdded(Replies); + + Replies.CollectionChanged += (_, args) => + { + switch (args.Action) + { + case NotifyCollectionChangedAction.Add: + onRepliesAdded(args.NewItems.Cast()); + break; + + default: + throw new NotSupportedException(@"You can only add replies to this list. Other actions are not supported."); + } + }; } protected override void LoadComplete()