Change episode default sorting to SeriesOrder descending
This commit is contained in:
parent
8a1b375f0d
commit
af8e1cd5ef
8 changed files with 26 additions and 23 deletions
|
|
@ -1,5 +1,4 @@
|
|||
using ApplicationServices;
|
||||
using Dinah.Core.DataBinding;
|
||||
using LibationUiBase.GridView;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
|
@ -25,6 +24,8 @@ namespace LibationWinForms.GridView
|
|||
public GridEntryBindingList(IEnumerable<IGridEntry> enumeration) : base(new List<IGridEntry>(enumeration))
|
||||
{
|
||||
SearchEngineCommands.SearchEngineUpdated += SearchEngineCommands_SearchEngineUpdated;
|
||||
|
||||
refreshEntries();
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -216,9 +217,7 @@ namespace LibationWinForms.GridView
|
|||
{
|
||||
var itemsList = (List<IGridEntry>)Items;
|
||||
//User Order/OrderDescending and replace items in list instead of using List.Sort() to achieve stable sorting.
|
||||
var sortedItems
|
||||
= Comparer.SortOrder == ListSortDirection.Ascending ? itemsList.Order(Comparer).ToList()
|
||||
: itemsList.OrderDescending(Comparer).ToList();
|
||||
var sortedItems = Comparer.OrderEntries(itemsList).ToList();
|
||||
|
||||
itemsList.Clear();
|
||||
itemsList.AddRange(sortedItems);
|
||||
|
|
|
|||
|
|
@ -181,7 +181,7 @@ namespace LibationWinForms.GridView
|
|||
geList.AddRange(seriesEntry.Children);
|
||||
}
|
||||
|
||||
bindingList = new GridEntryBindingList(geList.OrderByDescending(e => e.DateAdded));
|
||||
bindingList = new GridEntryBindingList(geList);
|
||||
bindingList.CollapseAll();
|
||||
syncBindingSource.DataSource = bindingList;
|
||||
VisibleCountChanged?.Invoke(this, bindingList.GetFilteredInItems().Count());
|
||||
|
|
|
|||
|
|
@ -1,12 +1,20 @@
|
|||
using LibationUiBase.GridView;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
|
||||
namespace LibationWinForms.GridView
|
||||
{
|
||||
internal class RowComparer : RowComparerBase
|
||||
{
|
||||
public ListSortDirection? SortOrder { get; set; }
|
||||
public override string PropertyName { get; set; }
|
||||
protected override ListSortDirection? GetSortOrder() => SortOrder;
|
||||
public ListSortDirection SortOrder { get; set; } = ListSortDirection.Descending;
|
||||
public override string PropertyName { get; set; } = nameof(IGridEntry.DateAdded);
|
||||
protected override ListSortDirection GetSortOrder() => SortOrder;
|
||||
|
||||
/// <summary>
|
||||
/// Helper method for ordering grid entries
|
||||
/// </summary>
|
||||
public IOrderedEnumerable<IGridEntry> OrderEntries(IEnumerable<IGridEntry> entries)
|
||||
=> SortOrder is ListSortDirection.Descending ? entries.OrderDescending(this) : entries.Order(this);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue