Files: added sorting by origin room

This commit is contained in:
Maksim Chegulov 2023-02-08 13:19:16 +03:00
parent b63bfc4de5
commit 91d1b4e422
2 changed files with 24 additions and 1 deletions

View File

@ -37,7 +37,8 @@ public enum SortedByType
New,
DateAndTimeCreation,
RoomType,
Tags
Tags,
Room
}
[DebuggerDisplay("{SortedBy} {IsAsc}")]

View File

@ -943,6 +943,28 @@ public class EntryManager
return c * (isNewSortResult == 0 ? DateTime.Compare(x.ModifiedOn, y.ModifiedOn) : isNewSortResult);
}
,
SortedByType.Room => (x, y) =>
{
var x1 = ((FileEntry<T>)x).OriginRoomTitle;
var x2 = ((FileEntry<T>)y).OriginRoomTitle;
if (x1 == null && x2 == null)
{
return 0;
}
if (x1 == null)
{
return c * 1;
}
if (x2 == null)
{
return c * -1;
}
return c * x1.EnumerableComparer(x2);
},
_ => (x, y) => c * x.Title.EnumerableComparer(y.Title),
};