diff --git a/LibationLauncher/LibationLauncher.csproj b/LibationLauncher/LibationLauncher.csproj
index b7551421..abb74248 100644
--- a/LibationLauncher/LibationLauncher.csproj
+++ b/LibationLauncher/LibationLauncher.csproj
@@ -13,7 +13,7 @@
win-x64
- 5.5.0.1
+ 5.5.0.9
diff --git a/LibationWinForms/Dialogs/RemoveBooksDialog.cs b/LibationWinForms/Dialogs/RemoveBooksDialog.cs
index 40457837..d7fb7c09 100644
--- a/LibationWinForms/Dialogs/RemoveBooksDialog.cs
+++ b/LibationWinForms/Dialogs/RemoveBooksDialog.cs
@@ -1,14 +1,15 @@
-using ApplicationServices;
-using DataLayer;
-using InternalUtilities;
-using LibationWinForms.Login;
-using System;
+using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Linq;
using System.Windows.Forms;
+using ApplicationServices;
+using DataLayer;
+using Dinah.Core.DataBinding;
+using InternalUtilities;
+using LibationWinForms.Login;
namespace LibationWinForms.Dialogs
{
@@ -18,7 +19,7 @@ namespace LibationWinForms.Dialogs
private Account[] _accounts { get; }
private readonly List _libraryBooks;
- private readonly SortableBindingList2 _removableGridEntries;
+ private readonly SortableBindingList _removableGridEntries;
private readonly string _labelFormat;
private int SelectedCount => SelectedEntries?.Count() ?? 0;
private IEnumerable SelectedEntries => _removableGridEntries?.Where(b => b.Remove);
@@ -40,7 +41,7 @@ namespace LibationWinForms.Dialogs
.OrderByDescending(ge => (DateTime)ge.GetMemberValue(nameof(ge.PurchaseDate)))
.ToList();
- _removableGridEntries = new SortableBindingList2(orderedGridEntries);
+ _removableGridEntries = new SortableBindingList(orderedGridEntries);
gridEntryBindingSource.DataSource = _removableGridEntries;
_dataGridView.Enabled = false;
diff --git a/LibationWinForms/GridEntry.cs b/LibationWinForms/GridEntry.cs
index 032828b9..d66b8a73 100644
--- a/LibationWinForms/GridEntry.cs
+++ b/LibationWinForms/GridEntry.cs
@@ -1,12 +1,13 @@
-using ApplicationServices;
-using DataLayer;
-using Dinah.Core.Drawing;
-using System;
+using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Linq;
+using ApplicationServices;
+using DataLayer;
+using Dinah.Core.DataBinding;
+using Dinah.Core.Drawing;
namespace LibationWinForms
{
diff --git a/LibationWinForms/IMemberComparable.cs b/LibationWinForms/IMemberComparable.cs
deleted file mode 100644
index bbc6471e..00000000
--- a/LibationWinForms/IMemberComparable.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-using System;
-using System.Collections;
-
-namespace LibationWinForms
-{
- internal interface IMemberComparable
- {
- IComparer GetMemberComparer(Type memberType);
- object GetMemberValue(string memberName);
- }
-}
diff --git a/LibationWinForms/MemberComparer.cs b/LibationWinForms/MemberComparer.cs
deleted file mode 100644
index 1bca2c82..00000000
--- a/LibationWinForms/MemberComparer.cs
+++ /dev/null
@@ -1,21 +0,0 @@
-using System.Collections.Generic;
-using System.ComponentModel;
-
-namespace LibationWinForms
-{
- internal class MemberComparer : IComparer where T : IMemberComparable
- {
- public ListSortDirection Direction { get; set; } = ListSortDirection.Ascending;
- public string PropertyName { get; set; }
-
- public int Compare(T x, T y)
- {
- var val1 = x.GetMemberValue(PropertyName);
- var val2 = y.GetMemberValue(PropertyName);
-
- return DirMult * x.GetMemberComparer(val1.GetType()).Compare(val1, val2);
- }
-
- private int DirMult => Direction == ListSortDirection.Descending ? -1 : 1;
- }
-}
diff --git a/LibationWinForms/ProductsGrid.cs b/LibationWinForms/ProductsGrid.cs
index 330e7ef1..a5182c9c 100644
--- a/LibationWinForms/ProductsGrid.cs
+++ b/LibationWinForms/ProductsGrid.cs
@@ -1,12 +1,13 @@
-using ApplicationServices;
-using DataLayer;
-using Dinah.Core;
-using Dinah.Core.Windows.Forms;
-using LibationWinForms.Dialogs;
-using System;
+using System;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
+using ApplicationServices;
+using DataLayer;
+using Dinah.Core;
+using Dinah.Core.DataBinding;
+using Dinah.Core.Windows.Forms;
+using LibationWinForms.Dialogs;
namespace LibationWinForms
{
@@ -138,7 +139,7 @@ namespace LibationWinForms
.ToList();
// BIND
- gridEntryBindingSource.DataSource = new SortableBindingList2(orderedGridEntries);
+ gridEntryBindingSource.DataSource = new SortableBindingList(orderedGridEntries);
// FILTER
Filter();
diff --git a/LibationWinForms/SortableBindingList2[T].cs b/LibationWinForms/SortableBindingList2[T].cs
deleted file mode 100644
index c29d1f65..00000000
--- a/LibationWinForms/SortableBindingList2[T].cs
+++ /dev/null
@@ -1,75 +0,0 @@
-using System;
-using System.Linq;
-using System.Collections.Generic;
-using System.ComponentModel;
-
-namespace LibationWinForms
-{
- internal class SortableBindingList2 : BindingList where T : IMemberComparable
- {
- private bool isSorted;
- private ListSortDirection listSortDirection;
- private PropertyDescriptor propertyDescriptor;
-
- public SortableBindingList2() : base(new List()) { }
- public SortableBindingList2(IEnumerable enumeration) : base(new List(enumeration)) { }
-
- private MemberComparer Comparer { get; } = new();
- protected override bool SupportsSortingCore => true;
- protected override bool SupportsSearchingCore => true;
- protected override bool IsSortedCore => isSorted;
- protected override PropertyDescriptor SortPropertyCore => propertyDescriptor;
- protected override ListSortDirection SortDirectionCore => listSortDirection;
-
- protected override void ApplySortCore(PropertyDescriptor property, ListSortDirection direction)
- {
- List itemsList = (List)Items;
-
- Comparer.PropertyName = property.Name;
- Comparer.Direction = direction;
-
- //Array.Sort() and List.Sort() are unstable sorts. OrderBy is stable.
- var sortedItems = itemsList.OrderBy((ge) => ge, Comparer).ToList();
-
- itemsList.Clear();
- itemsList.AddRange(sortedItems);
-
- propertyDescriptor = property;
- listSortDirection = direction;
- isSorted = true;
-
- OnListChanged(new ListChangedEventArgs(ListChangedType.Reset, -1));
- }
-
- protected override void RemoveSortCore()
- {
- isSorted = false;
- propertyDescriptor = base.SortPropertyCore;
- listSortDirection = base.SortDirectionCore;
-
- OnListChanged(new ListChangedEventArgs(ListChangedType.Reset, -1));
- }
- //NOTE: Libation does not currently use BindingSource.Find anywhere,
- //so this override may be removed (along with SupportsSearchingCore)
- protected override int FindCore(PropertyDescriptor property, object key)
- {
- int count = Count;
-
- System.Collections.IComparer valueComparer = null;
-
- for (int i = 0; i < count; ++i)
- {
- T element = this[i];
- var elemValue = element.GetMemberValue(property.Name);
- valueComparer ??= element.GetMemberComparer(elemValue.GetType());
-
- if (valueComparer.Compare(elemValue, key) == 0)
- {
- return i;
- }
- }
-
- return -1;
- }
- }
-}