Change episode default sorting to SeriesOrder descending

This commit is contained in:
Mbucari 2023-04-10 15:50:19 -06:00
parent 8a1b375f0d
commit af8e1cd5ef
8 changed files with 26 additions and 23 deletions

View file

@ -118,7 +118,7 @@ namespace LibationAvalonia.ViewModels
//Create the filtered-in list before adding entries to avoid a refresh
FilteredInGridEntries = geList.Union(geList.OfType<ISeriesEntry>().SelectMany(s => s.Children)).FilterEntries(FilterString);
SOURCE.AddRange(geList.OrderByDescending(e => e.DateAdded));
SOURCE.AddRange(geList.OrderDescending(new RowComparer(null)));
//Add all children beneath their parent
foreach (var series in SOURCE.OfType<ISeriesEntry>().ToList())

View file

@ -16,11 +16,13 @@ namespace LibationAvalonia.ViewModels
public RowComparer(DataGridColumn column)
{
Column = column;
PropertyName = Column.SortMemberPath;
PropertyName = Column?.SortMemberPath ?? nameof(IGridEntry.DateAdded);
}
//Avalonia doesn't expose the column's CurrentSortingState, so we must get it through reflection
protected override ListSortDirection? GetSortOrder()
=> CurrentSortingStatePi.GetValue(HeaderCellPi.GetValue(Column)) as ListSortDirection?;
protected override ListSortDirection GetSortOrder()
=> Column is null ? ListSortDirection.Descending
: CurrentSortingStatePi.GetValue(HeaderCellPi.GetValue(Column)) is ListSortDirection lsd ? lsd
: ListSortDirection.Descending;
}
}