1 files changed, 16 insertions, 2 deletions
diff --git a/ModerationClient/Models/SpaceTreeNodes/SpaceNode.cs b/ModerationClient/Models/SpaceTreeNodes/SpaceNode.cs
index b8042ae..781e974 100644
--- a/ModerationClient/Models/SpaceTreeNodes/SpaceNode.cs
+++ b/ModerationClient/Models/SpaceTreeNodes/SpaceNode.cs
@@ -1,4 +1,7 @@
+using System;
+using System.Collections.Generic;
using System.Collections.ObjectModel;
+using System.Linq;
namespace ModerationClient.Models.SpaceTreeNodes;
@@ -6,10 +9,21 @@ public class SpaceNode : RoomNode {
private bool _isExpanded = false;
public SpaceNode(bool includeSelf = true) {
- if(includeSelf)
+ if (includeSelf)
ChildRooms = [this];
+
+ ChildRooms.CollectionChanged += (_, _) => ChildRoomsByActivity = ChildRooms.OrderByDescending(x=>x.LastActivity).ToArray();
}
public ObservableCollection<SpaceNode> ChildSpaces { get; set; } = [];
- public ObservableCollection<RoomNode> ChildRooms { get; set; } = [];
+
+ public ObservableCollection<RoomNode> ChildRooms {
+ get;
+ set => SetField(ref field, value);
+ } = [];
+
+ public RoomNode[] ChildRoomsByActivity {
+ get;
+ set => SetField(ref field, value);
+ } = [];
}
\ No newline at end of file
|