diff --git a/Source/LibationWinForms/AvaloniaUI/ViewModels/GridEntry2.cs b/Source/LibationWinForms/AvaloniaUI/ViewModels/GridEntry2.cs
index 2b85abd6..e04f7205 100644
--- a/Source/LibationWinForms/AvaloniaUI/ViewModels/GridEntry2.cs
+++ b/Source/LibationWinForms/AvaloniaUI/ViewModels/GridEntry2.cs
@@ -55,6 +55,7 @@ namespace LibationWinForms.AvaloniaUI.ViewModels
public abstract bool IsSeries { get; }
public abstract bool IsEpisode { get; }
public abstract bool IsBook { get; }
+ public IBrush BackgroundBrush => IsEpisode ? App.SeriesEntryGridBackgroundBrush : null;
#endregion
diff --git a/Source/LibationWinForms/AvaloniaUI/ViewModels/MainWindowViewModel.cs b/Source/LibationWinForms/AvaloniaUI/ViewModels/MainWindowViewModel.cs
index 3c2ed52b..918a9019 100644
--- a/Source/LibationWinForms/AvaloniaUI/ViewModels/MainWindowViewModel.cs
+++ b/Source/LibationWinForms/AvaloniaUI/ViewModels/MainWindowViewModel.cs
@@ -9,6 +9,7 @@ namespace LibationWinForms.AvaloniaUI.ViewModels
{
private string _filterString;
private string _removeBooksButtonText = "Remove # Books from Libation";
+ private bool _removeBooksButtonEnabled = true;
private bool _autoScanChecked = true;
private bool _firstFilterIsDefault = true;
private bool _removeButtonsVisible = true;
@@ -31,6 +32,10 @@ namespace LibationWinForms.AvaloniaUI.ViewModels
public string RemoveBooksButtonText { get => _removeBooksButtonText; set => this.RaiseAndSetIfChanged(ref _removeBooksButtonText, value); }
+ /// Indicates if the "Remove # Books from Libation" button is enabled
+ public bool RemoveBooksButtonEnabled { get => _removeBooksButtonEnabled; set { this.RaiseAndSetIfChanged(ref _removeBooksButtonEnabled, value); } }
+
+
/// Auto scanning accounts is enables
public bool AutoScanChecked
{
@@ -44,7 +49,7 @@ namespace LibationWinForms.AvaloniaUI.ViewModels
}
- /// Indicates that the first quick filter is the default filter
+ /// Indicates if the first quick filter is the default filter
public bool FirstFilterIsDefault
{
get => _firstFilterIsDefault;
@@ -57,7 +62,7 @@ namespace LibationWinForms.AvaloniaUI.ViewModels
}
- /// Indicates if the "Remove # Books from Libation" and "Done Removing" buttons shouls be visible
+ /// Indicates if the "Remove # Books from Libation" and "Done Removing" buttons should be visible
public bool RemoveButtonsVisible
{
get => _removeButtonsVisible;
@@ -70,6 +75,7 @@ namespace LibationWinForms.AvaloniaUI.ViewModels
+
/// The number of accounts currently being scanned
public int NumAccountsScanning
{
@@ -83,7 +89,7 @@ namespace LibationWinForms.AvaloniaUI.ViewModels
}
}
- /// Indicates that Libation is currently scanning account(s)
+ /// Indicates if Libation is currently scanning account(s)
public bool ActivelyScanning => _numAccountsScanning > 0;
/// Indicates if the "Remove Books" menu items are enabled
public bool RemoveMenuItemsEnabled => !RemoveButtonsVisible && !ActivelyScanning;
@@ -183,16 +189,12 @@ namespace LibationWinForms.AvaloniaUI.ViewModels
? $"Begin _PDF Only Backups: {LibraryStats.pdfsNotDownloaded} remaining"
: "All PDFs have been downloaded";
-
- this.RaisePropertyChanged(nameof(HasBookResults));
this.RaisePropertyChanged(nameof(StatusCountText));
this.RaisePropertyChanged(nameof(BookBackupsToolStripText));
this.RaisePropertyChanged(nameof(PdfBackupsToolStripText));
}
}
- /// Indicates whether the library contains any books
- public bool HasBookResults => LibraryStats?.HasBookResults ?? false;
/// Bottom-left library statistics display text
public string StatusCountText { get; private set; } = "[Calculating backed up book quantities] | [Calculating backed up PDFs]";
/// The "Begin Book and PDF Backup" menu item header text
diff --git a/Source/LibationWinForms/AvaloniaUI/Views/MainWindow/MainWindow.RemoveBooks.axaml.cs b/Source/LibationWinForms/AvaloniaUI/Views/MainWindow/MainWindow.RemoveBooks.axaml.cs
index 756e1098..8100245d 100644
--- a/Source/LibationWinForms/AvaloniaUI/Views/MainWindow/MainWindow.RemoveBooks.axaml.cs
+++ b/Source/LibationWinForms/AvaloniaUI/Views/MainWindow/MainWindow.RemoveBooks.axaml.cs
@@ -61,6 +61,7 @@ namespace LibationWinForms.AvaloniaUI.Views
productsDisplay.Filter(null);
+ _viewModel.RemoveBooksButtonEnabled = true;
_viewModel.RemoveButtonsVisible = true;
await productsDisplay.ScanAndRemoveBooksAsync(accounts);
@@ -68,7 +69,9 @@ namespace LibationWinForms.AvaloniaUI.Views
public async void removeBooksBtn_Click(object sender, Avalonia.Interactivity.RoutedEventArgs e)
{
+ _viewModel.RemoveBooksButtonEnabled = false;
await productsDisplay.RemoveCheckedBooksAsync();
+ _viewModel.RemoveBooksButtonEnabled = true;
}
public async void doneRemovingBtn_Click(object sender, Avalonia.Interactivity.RoutedEventArgs e)
diff --git a/Source/LibationWinForms/AvaloniaUI/Views/MainWindow/MainWindow.axaml b/Source/LibationWinForms/AvaloniaUI/Views/MainWindow/MainWindow.axaml
index 22be4f5a..cef046e9 100644
--- a/Source/LibationWinForms/AvaloniaUI/Views/MainWindow/MainWindow.axaml
+++ b/Source/LibationWinForms/AvaloniaUI/Views/MainWindow/MainWindow.axaml
@@ -41,11 +41,13 @@
+
+
@@ -77,7 +79,7 @@
-
+
@@ -149,7 +151,7 @@
-
+
diff --git a/Source/LibationWinForms/AvaloniaUI/Views/ProductsGrid/ProductsDisplay2.Display.xaml.cs b/Source/LibationWinForms/AvaloniaUI/Views/ProductsGrid/ProductsDisplay2.Display.xaml.cs
index b81267f8..80f59ac0 100644
--- a/Source/LibationWinForms/AvaloniaUI/Views/ProductsGrid/ProductsDisplay2.Display.xaml.cs
+++ b/Source/LibationWinForms/AvaloniaUI/Views/ProductsGrid/ProductsDisplay2.Display.xaml.cs
@@ -53,7 +53,7 @@ namespace LibationWinForms.AvaloniaUI.Views.ProductsGrid
string existingFilter = _viewModel?.GridEntries?.Filter;
var newEntries = ProductsDisplayViewModel.CreateGridEntries(dbBooks);
- var existingSeriesEntries = bindingList.InternalList.SeriesEntries().ToList();
+ var existingSeriesEntries = bindingList.AllItems().SeriesEntries().ToList();
await Dispatcher.UIThread.InvokeAsync(() => bindingList.ReplaceList(newEntries));
@@ -65,9 +65,11 @@ namespace LibationWinForms.AvaloniaUI.Views.ProductsGrid
if (sEntry is SeriesEntrys2 se && !series.Liberate.Expanded)
await Dispatcher.UIThread.InvokeAsync(() => bindingList.CollapseItem(se));
}
-
- bindingList.Filter = existingFilter;
- ReSort();
+ await Dispatcher.UIThread.InvokeAsync(() =>
+ {
+ bindingList.Filter = existingFilter;
+ ReSort();
+ });
}
}
catch (Exception ex)
diff --git a/Source/LibationWinForms/AvaloniaUI/Views/ProductsGrid/ProductsDisplay2.ScanAndRemove.xaml.cs b/Source/LibationWinForms/AvaloniaUI/Views/ProductsGrid/ProductsDisplay2.ScanAndRemove.xaml.cs
index 5b559956..1783a360 100644
--- a/Source/LibationWinForms/AvaloniaUI/Views/ProductsGrid/ProductsDisplay2.ScanAndRemove.xaml.cs
+++ b/Source/LibationWinForms/AvaloniaUI/Views/ProductsGrid/ProductsDisplay2.ScanAndRemove.xaml.cs
@@ -91,6 +91,9 @@ namespace LibationWinForms.AvaloniaUI.Views.ProductsGrid
RemovableCountChanged?.Invoke(this, 0);
removeGVColumn.IsVisible = true;
+ foreach (var item in bindingList.AllItems())
+ item.PropertyChanged += Item_PropertyChanged;
+
try
{
if (accounts is null || accounts.Length == 0)
@@ -111,11 +114,6 @@ namespace LibationWinForms.AvaloniaUI.Views.ProductsGrid
foreach (var r in removable)
r.Remove = true;
-
- RemovableCountChanged?.Invoke(this, GetAllBookEntries().Count(lbe => lbe.Remove is true));
-
- foreach (var item in bindingList.AllItems())
- item.PropertyChanged += Item_PropertyChanged;
}
catch (Exception ex)
{
diff --git a/Source/LibationWinForms/AvaloniaUI/Views/ProductsGrid/ProductsDisplay2.axaml b/Source/LibationWinForms/AvaloniaUI/Views/ProductsGrid/ProductsDisplay2.axaml
index a8089730..2753d657 100644
--- a/Source/LibationWinForms/AvaloniaUI/Views/ProductsGrid/ProductsDisplay2.axaml
+++ b/Source/LibationWinForms/AvaloniaUI/Views/ProductsGrid/ProductsDisplay2.axaml
@@ -8,16 +8,16 @@
x:Class="LibationWinForms.AvaloniaUI.Views.ProductsGrid.ProductsDisplay2">
-
+
-
-
-
+
+
+
@@ -29,122 +29,144 @@
-
+
-
+
-
+
-
-
-
+
+
+
+
+
-
+
-
-
-
+
+
+
+
+
-
+
-
-
-
+
+
+
+
+
-
+
-
-
-
+
+
+
+
+
-
+
-
-
-
+
+
+
+
+
-
+
-
-
-
+
+
+
+
+
-
+
-
-
-
+
+
+
+
+
-
+
-
-
-
+
+
+
+
+
-
+
-
-
-
+
+
+
+
+
-
+
-
-
-
+
+
+
+
+
-
+
-
-
-
+
+
+
+
+
@@ -166,6 +188,6 @@
-
+
diff --git a/Source/LibationWinForms/AvaloniaUI/Views/ProductsGrid/ProductsDisplay2.axaml.cs b/Source/LibationWinForms/AvaloniaUI/Views/ProductsGrid/ProductsDisplay2.axaml.cs
index 284f50f9..90402d54 100644
--- a/Source/LibationWinForms/AvaloniaUI/Views/ProductsGrid/ProductsDisplay2.axaml.cs
+++ b/Source/LibationWinForms/AvaloniaUI/Views/ProductsGrid/ProductsDisplay2.axaml.cs
@@ -66,31 +66,8 @@ namespace LibationWinForms.AvaloniaUI.Views.ProductsGrid
productsGrid = this.FindControl(nameof(productsGrid));
productsGrid.Sorting += ProductsGrid_Sorting;
productsGrid.CanUserSortColumns = true;
- productsGrid.LoadingRow += ProductsGrid_LoadingRow;
removeGVColumn = productsGrid.Columns[0];
}
-
- private static object tagObj = new();
- private void ProductsGrid_LoadingRow(object sender, DataGridRowEventArgs e)
- {
- if (e.Row.Tag == tagObj)
- return;
- e.Row.Tag = tagObj;
-
- static IBrush GetRowColor(DataGridRow row)
- => row.DataContext is GridEntry2 gEntry
- && gEntry is LibraryBookEntry2 lbEntry
- && lbEntry.Parent is not null
- ? App.SeriesEntryGridBackgroundBrush
- : null;
-
- e.Row.Background = GetRowColor(e.Row);
- e.Row.DataContextChanged += (sender, e) =>
- {
- var row = sender as DataGridRow;
- row.Background = GetRowColor(row);
- };
- }
}
}
diff --git a/Source/LibationWinForms/Program.cs b/Source/LibationWinForms/Program.cs
index 8a5b6f62..e9046391 100644
--- a/Source/LibationWinForms/Program.cs
+++ b/Source/LibationWinForms/Program.cs
@@ -53,7 +53,7 @@ namespace LibationWinForms
Min 1492 2316
Q1 1562 2358
Med 1567 2379
- Q2 1567 2379
+ Q2 1600 2418
Max 2837 5835
*/