Remain classes and fix adding row to EditTagsDialog

This commit is contained in:
Michael Bucari-Tovo 2022-07-17 00:59:26 -06:00
parent 4cfe72a63b
commit 51fee4ae24
22 changed files with 140 additions and 129 deletions

View File

@ -10,7 +10,7 @@ namespace LibationWinForms.AvaloniaUI.Controls
{ {
//Only SeriesEntry types have three-state checks, individual LibraryEntry books are binary. //Only SeriesEntry types have three-state checks, individual LibraryEntry books are binary.
var ele = base.GenerateEditingElementDirect(cell, dataItem) as CheckBox; var ele = base.GenerateEditingElementDirect(cell, dataItem) as CheckBox;
ele.IsThreeState = dataItem is SeriesEntrys2; ele.IsThreeState = dataItem is SeriesEntry;
return ele; return ele;
} }
} }

View File

@ -22,7 +22,7 @@ namespace LibationWinForms.AvaloniaUI.ViewModels
SomeRemoved SomeRemoved
} }
/// <summary>The View Model base for the DataGridView</summary> /// <summary>The View Model base for the DataGridView</summary>
public abstract class GridEntry2 : ViewModelBase public abstract class GridEntry : ViewModelBase
{ {
[Browsable(false)] public string AudibleProductId => Book.AudibleProductId; [Browsable(false)] public string AudibleProductId => Book.AudibleProductId;
[Browsable(false)] public LibraryBook LibraryBook { get; protected set; } [Browsable(false)] public LibraryBook LibraryBook { get; protected set; }
@ -50,7 +50,7 @@ namespace LibationWinForms.AvaloniaUI.ViewModels
protected bool? _remove = false; protected bool? _remove = false;
public abstract bool? Remove { get; set; } public abstract bool? Remove { get; set; }
public abstract LiberateButtonStatus2 Liberate { get; } public abstract LiberateButtonStatus Liberate { get; }
public abstract BookTags BookTags { get; } public abstract BookTags BookTags { get; }
public abstract bool IsSeries { get; } public abstract bool IsSeries { get; }
public abstract bool IsEpisode { get; } public abstract bool IsEpisode { get; }
@ -61,7 +61,7 @@ namespace LibationWinForms.AvaloniaUI.ViewModels
#region Sorting #region Sorting
public GridEntry2() => _memberValues = CreateMemberValueDictionary(); public GridEntry() => _memberValues = CreateMemberValueDictionary();
// These methods are implementation of Dinah.Core.DataBinding.IMemberComparable // These methods are implementation of Dinah.Core.DataBinding.IMemberComparable
// Used by GridEntryBindingList for all sorting // Used by GridEntryBindingList for all sorting
@ -79,7 +79,7 @@ namespace LibationWinForms.AvaloniaUI.ViewModels
{ typeof(float), new ObjectComparer<float>() }, { typeof(float), new ObjectComparer<float>() },
{ typeof(bool), new ObjectComparer<bool>() }, { typeof(bool), new ObjectComparer<bool>() },
{ typeof(DateTime), new ObjectComparer<DateTime>() }, { typeof(DateTime), new ObjectComparer<DateTime>() },
{ typeof(LiberateButtonStatus2), new ObjectComparer<LiberateButtonStatus2>() }, { typeof(LiberateButtonStatus), new ObjectComparer<LiberateButtonStatus>() },
}; };
#endregion #endregion
@ -113,7 +113,7 @@ namespace LibationWinForms.AvaloniaUI.ViewModels
#region Static library display functions #region Static library display functions
/// <summary>This information should not change during <see cref="GridEntry2"/> lifetime, so call only once.</summary> /// <summary>This information should not change during <see cref="GridEntry"/> lifetime, so call only once.</summary>
protected static string GetDescriptionDisplay(Book book) protected static string GetDescriptionDisplay(Book book)
{ {
var doc = new HtmlAgilityPack.HtmlDocument(); var doc = new HtmlAgilityPack.HtmlDocument();
@ -131,7 +131,7 @@ namespace LibationWinForms.AvaloniaUI.ViewModels
/// <summary> /// <summary>
/// This information should not change during <see cref="GridEntry2"/> lifetime, so call only once. /// This information should not change during <see cref="GridEntry"/> lifetime, so call only once.
/// Maximum of 5 text rows will fit in 80-pixel row height. /// Maximum of 5 text rows will fit in 80-pixel row height.
/// </summary> /// </summary>
protected static string GetMiscDisplay(LibraryBook libraryBook) protected static string GetMiscDisplay(LibraryBook libraryBook)
@ -161,7 +161,7 @@ namespace LibationWinForms.AvaloniaUI.ViewModels
#endregion #endregion
~GridEntry2() ~GridEntry()
{ {
PictureStorage.PictureCached -= PictureStorage_PictureCached; PictureStorage.PictureCached -= PictureStorage_PictureCached;
} }

View File

@ -23,32 +23,32 @@ namespace LibationWinForms.AvaloniaUI.ViewModels
* but requires ResetCollection() to be called after all changes * but requires ResetCollection() to be called after all changes
* have been made. * have been made.
*/ */
public class GridEntryBindingList2 : ObservableCollection<GridEntry2> public class GridEntryCollection : ObservableCollection<GridEntry>
{ {
public GridEntryBindingList2(IEnumerable<GridEntry2> enumeration) public GridEntryCollection(IEnumerable<GridEntry> enumeration)
: base(new List<GridEntry2>(enumeration)) { } : base(new List<GridEntry>(enumeration)) { }
public GridEntryBindingList2(List<GridEntry2> list) public GridEntryCollection(List<GridEntry> list)
: base(list) { } : base(list) { }
public List<GridEntry2> InternalList => Items as List<GridEntry2>; public List<GridEntry> InternalList => Items as List<GridEntry>;
/// <returns>All items in the list, including those filtered out.</returns> /// <returns>All items in the list, including those filtered out.</returns>
public List<GridEntry2> AllItems() => Items.Concat(FilterRemoved).ToList(); public List<GridEntry> AllItems() => Items.Concat(FilterRemoved).ToList();
/// <summary>When true, itms will not be checked filtered by search criteria on item changed<summary> /// <summary>When true, itms will not be checked filtered by search criteria on item changed<summary>
public bool SuspendFilteringOnUpdate { get; set; } public bool SuspendFilteringOnUpdate { get; set; }
public string Filter { get => FilterString; set => ApplyFilter(value); } public string Filter { get => FilterString; set => ApplyFilter(value); }
/// <summary> Items that were removed from the base list due to filtering </summary> /// <summary> Items that were removed from the base list due to filtering </summary>
private readonly List<GridEntry2> FilterRemoved = new(); private readonly List<GridEntry> FilterRemoved = new();
private string FilterString; private string FilterString;
private SearchResultSet SearchResults; private SearchResultSet SearchResults;
#region Items Management #region Items Management
public void ReplaceList(IEnumerable<GridEntry2> newItems) public void ReplaceList(IEnumerable<GridEntry> newItems)
{ {
Items.Clear(); Items.Clear();
((List<GridEntry2>)Items).AddRange(newItems); ((List<GridEntry>)Items).AddRange(newItems);
ResetCollection(); ResetCollection();
} }
public void ResetCollection() public void ResetCollection()
@ -67,7 +67,7 @@ namespace LibationWinForms.AvaloniaUI.ViewModels
FilterString = filterString; FilterString = filterString;
SearchResults = SearchEngineCommands.Search(filterString); SearchResults = SearchEngineCommands.Search(filterString);
var booksFilteredIn = Items.BookEntries().Join(SearchResults.Docs, lbe => lbe.AudibleProductId, d => d.ProductId, (lbe, d) => (GridEntry2)lbe); var booksFilteredIn = Items.BookEntries().Join(SearchResults.Docs, lbe => lbe.AudibleProductId, d => d.ProductId, (lbe, d) => (GridEntry)lbe);
//Find all series containing children that match the search criteria //Find all series containing children that match the search criteria
var seriesFilteredIn = Items.SeriesEntries().Where(s => s.Children.Join(SearchResults.Docs, lbe => lbe.AudibleProductId, d => d.ProductId, (lbe, d) => lbe).Any()); var seriesFilteredIn = Items.SeriesEntries().Where(s => s.Children.Join(SearchResults.Docs, lbe => lbe.AudibleProductId, d => d.ProductId, (lbe, d) => lbe).Any());
@ -90,7 +90,7 @@ namespace LibationWinForms.AvaloniaUI.ViewModels
foreach (var item in FilterRemoved.ToList()) foreach (var item in FilterRemoved.ToList())
{ {
if (item is SeriesEntrys2 || item is LibraryBookEntry2 lbe && (lbe.Parent is null || lbe.Parent.Liberate.Expanded)) if (item is SeriesEntry || item is LibraryBookEntry lbe && (lbe.Parent is null || lbe.Parent.Liberate.Expanded))
{ {
FilterRemoved.Remove(item); FilterRemoved.Remove(item);
@ -119,7 +119,7 @@ namespace LibationWinForms.AvaloniaUI.ViewModels
ExpandItem(series); ExpandItem(series);
} }
public void CollapseItem(SeriesEntrys2 sEntry) public void CollapseItem(SeriesEntry sEntry)
{ {
foreach (var episode in Items.BookEntries().Where(b => b.Parent == sEntry).OrderByDescending(lbe => lbe.SeriesIndex).ToList()) foreach (var episode in Items.BookEntries().Where(b => b.Parent == sEntry).OrderByDescending(lbe => lbe.SeriesIndex).ToList())
{ {
@ -141,7 +141,7 @@ namespace LibationWinForms.AvaloniaUI.ViewModels
ResetCollection(); ResetCollection();
} }
public void ExpandItem(SeriesEntrys2 sEntry) public void ExpandItem(SeriesEntry sEntry)
{ {
var sindex = Items.IndexOf(sEntry); var sindex = Items.IndexOf(sEntry);

View File

@ -6,9 +6,9 @@ using System.Collections.Generic;
namespace LibationWinForms.AvaloniaUI.ViewModels namespace LibationWinForms.AvaloniaUI.ViewModels
{ {
public class LiberateButtonStatus2 : ViewModelBase, IComparable public class LiberateButtonStatus : ViewModelBase, IComparable
{ {
public LiberateButtonStatus2(bool isSeries) public LiberateButtonStatus(bool isSeries)
{ {
IsSeries = isSeries; IsSeries = isSeries;
} }
@ -35,7 +35,7 @@ namespace LibationWinForms.AvaloniaUI.ViewModels
/// <summary> Defines the Liberate column's sorting behavior </summary> /// <summary> Defines the Liberate column's sorting behavior </summary>
public int CompareTo(object obj) public int CompareTo(object obj)
{ {
if (obj is not LiberateButtonStatus2 second) return -1; if (obj is not LiberateButtonStatus second) return -1;
if (IsSeries && !second.IsSeries) return -1; if (IsSeries && !second.IsSeries) return -1;
else if (!IsSeries && second.IsSeries) return 1; else if (!IsSeries && second.IsSeries) return 1;

View File

@ -10,10 +10,10 @@ using System.Linq;
namespace LibationWinForms.AvaloniaUI.ViewModels namespace LibationWinForms.AvaloniaUI.ViewModels
{ {
/// <summary>The View Model for a LibraryBook that is ContentType.Product or ContentType.Episode</summary> /// <summary>The View Model for a LibraryBook that is ContentType.Product or ContentType.Episode</summary>
public class LibraryBookEntry2 : GridEntry2 public class LibraryBookEntry : GridEntry
{ {
[Browsable(false)] public override DateTime DateAdded => LibraryBook.DateAdded; [Browsable(false)] public override DateTime DateAdded => LibraryBook.DateAdded;
[Browsable(false)] public SeriesEntrys2 Parent { get; init; } [Browsable(false)] public SeriesEntry Parent { get; init; }
#region Model properties exposed to the view #region Model properties exposed to the view
@ -33,7 +33,7 @@ namespace LibationWinForms.AvaloniaUI.ViewModels
} }
} }
public override LiberateButtonStatus2 Liberate public override LiberateButtonStatus Liberate
{ {
get get
{ {
@ -44,7 +44,7 @@ namespace LibationWinForms.AvaloniaUI.ViewModels
_pdfStatus = LibraryCommands.Pdf_Status(LibraryBook.Book); _pdfStatus = LibraryCommands.Pdf_Status(LibraryBook.Book);
lastStatusUpdate = DateTime.Now; lastStatusUpdate = DateTime.Now;
} }
return new LiberateButtonStatus2(IsSeries) { BookStatus = _bookStatus, PdfStatus = _pdfStatus }; return new LiberateButtonStatus(IsSeries) { BookStatus = _bookStatus, PdfStatus = _pdfStatus };
} }
} }
@ -56,7 +56,7 @@ namespace LibationWinForms.AvaloniaUI.ViewModels
#endregion #endregion
public LibraryBookEntry2(LibraryBook libraryBook) public LibraryBookEntry(LibraryBook libraryBook)
{ {
LibraryBook = libraryBook; LibraryBook = libraryBook;
LoadCover(); LoadCover();
@ -144,7 +144,7 @@ namespace LibationWinForms.AvaloniaUI.ViewModels
#endregion #endregion
~LibraryBookEntry2() ~LibraryBookEntry()
{ {
UserDefinedItem.ItemChanged -= UserDefinedItem_ItemChanged; UserDefinedItem.ItemChanged -= UserDefinedItem_ItemChanged;
} }

View File

@ -36,7 +36,7 @@ namespace LibationWinForms.AvaloniaUI.ViewModels
/// <summary> /// <summary>
/// This is the viewmodel for queued processables /// This is the viewmodel for queued processables
/// </summary> /// </summary>
public class ProcessBook2 : ViewModelBase public class ProcessBookViewModel : ViewModelBase
{ {
public event EventHandler Completed; public event EventHandler Completed;
@ -91,7 +91,7 @@ namespace LibationWinForms.AvaloniaUI.ViewModels
private readonly Queue<Func<Processable>> Processes = new(); private readonly Queue<Func<Processable>> Processes = new();
private readonly ProcessQueue.LogMe Logger; private readonly ProcessQueue.LogMe Logger;
public ProcessBook2(LibraryBook libraryBook, ProcessQueue.LogMe logme) public ProcessBookViewModel(LibraryBook libraryBook, ProcessQueue.LogMe logme)
{ {
LibraryBook = libraryBook; LibraryBook = libraryBook;
Logger = logme; Logger = logme;

View File

@ -14,10 +14,10 @@ namespace LibationWinForms.AvaloniaUI.ViewModels
public class ProcessQueueViewModel : ViewModelBase, ProcessQueue.ILogForm public class ProcessQueueViewModel : ViewModelBase, ProcessQueue.ILogForm
{ {
public ObservableCollection<LogEntry> LogEntries { get; } = new(); public ObservableCollection<LogEntry> LogEntries { get; } = new();
public TrackedQueue2<ProcessBook2> Items { get; } = new(); public TrackedQueue<ProcessBookViewModel> Items { get; } = new();
private TrackedQueue2<ProcessBook2> Queue => Items; private TrackedQueue<ProcessBookViewModel> Queue => Items;
public ProcessBook2 SelectedItem { get; set; } public ProcessBookViewModel SelectedItem { get; set; }
public Task QueueRunner { get; private set; } public Task QueueRunner { get; private set; }
public bool Running => !QueueRunner?.IsCompleted ?? false; public bool Running => !QueueRunner?.IsCompleted ?? false;
@ -88,13 +88,13 @@ namespace LibationWinForms.AvaloniaUI.ViewModels
public void AddDownloadPdf(IEnumerable<LibraryBook> entries) public void AddDownloadPdf(IEnumerable<LibraryBook> entries)
{ {
List<ProcessBook2> procs = new(); List<ProcessBookViewModel> procs = new();
foreach (var entry in entries) foreach (var entry in entries)
{ {
if (isBookInQueue(entry)) if (isBookInQueue(entry))
continue; continue;
ProcessBook2 pbook = new(entry, Logger); ProcessBookViewModel pbook = new(entry, Logger);
pbook.AddDownloadPdf(); pbook.AddDownloadPdf();
procs.Add(pbook); procs.Add(pbook);
} }
@ -105,13 +105,13 @@ namespace LibationWinForms.AvaloniaUI.ViewModels
public void AddDownloadDecrypt(IEnumerable<LibraryBook> entries) public void AddDownloadDecrypt(IEnumerable<LibraryBook> entries)
{ {
List<ProcessBook2> procs = new(); List<ProcessBookViewModel> procs = new();
foreach (var entry in entries) foreach (var entry in entries)
{ {
if (isBookInQueue(entry)) if (isBookInQueue(entry))
continue; continue;
ProcessBook2 pbook = new(entry, Logger); ProcessBookViewModel pbook = new(entry, Logger);
pbook.AddDownloadDecryptBook(); pbook.AddDownloadDecryptBook();
pbook.AddDownloadPdf(); pbook.AddDownloadPdf();
procs.Add(pbook); procs.Add(pbook);
@ -123,13 +123,13 @@ namespace LibationWinForms.AvaloniaUI.ViewModels
public void AddConvertMp3(IEnumerable<LibraryBook> entries) public void AddConvertMp3(IEnumerable<LibraryBook> entries)
{ {
List<ProcessBook2> procs = new(); List<ProcessBookViewModel> procs = new();
foreach (var entry in entries) foreach (var entry in entries)
{ {
if (isBookInQueue(entry)) if (isBookInQueue(entry))
continue; continue;
ProcessBook2 pbook = new(entry, Logger); ProcessBookViewModel pbook = new(entry, Logger);
pbook.AddConvertToMp3(); pbook.AddConvertToMp3();
procs.Add(pbook); procs.Add(pbook);
} }
@ -138,7 +138,7 @@ namespace LibationWinForms.AvaloniaUI.ViewModels
AddToQueue(procs); AddToQueue(procs);
} }
public void AddToQueue(IEnumerable<ProcessBook2> pbook) public void AddToQueue(IEnumerable<ProcessBookViewModel> pbook)
{ {
Dispatcher.UIThread.Post(() => Dispatcher.UIThread.Post(() =>
{ {

View File

@ -25,9 +25,9 @@ namespace LibationWinForms.AvaloniaUI.ViewModels
private DataGridColumn _currentSortColumn; private DataGridColumn _currentSortColumn;
private DataGrid productsDataGrid; private DataGrid productsDataGrid;
private GridEntryBindingList2 _gridEntries; private GridEntryCollection _gridEntries;
private bool _removeColumnVisivle; private bool _removeColumnVisivle;
public GridEntryBindingList2 GridEntries { get => _gridEntries; private set => this.RaiseAndSetIfChanged(ref _gridEntries, value); } public GridEntryCollection GridEntries { get => _gridEntries; private set => this.RaiseAndSetIfChanged(ref _gridEntries, value); }
public bool RemoveColumnVisivle { get => _removeColumnVisivle; private set => this.RaiseAndSetIfChanged(ref _removeColumnVisivle, value); } public bool RemoveColumnVisivle { get => _removeColumnVisivle; private set => this.RaiseAndSetIfChanged(ref _removeColumnVisivle, value); }
public List<LibraryBook> GetVisibleBookEntries() public List<LibraryBook> GetVisibleBookEntries()
@ -35,14 +35,14 @@ namespace LibationWinForms.AvaloniaUI.ViewModels
.BookEntries() .BookEntries()
.Select(lbe => lbe.LibraryBook) .Select(lbe => lbe.LibraryBook)
.ToList(); .ToList();
public IEnumerable<LibraryBookEntry2> GetAllBookEntries() public IEnumerable<LibraryBookEntry> GetAllBookEntries()
=> GridEntries => GridEntries
.AllItems() .AllItems()
.BookEntries(); .BookEntries();
public ProductsDisplayViewModel() { } public ProductsDisplayViewModel() { }
public ProductsDisplayViewModel(List<GridEntry2> items) public ProductsDisplayViewModel(List<GridEntry> items)
{ {
GridEntries = new GridEntryBindingList2(items); GridEntries = new GridEntryCollection(items);
} }
#region Display Functions #region Display Functions
@ -50,7 +50,7 @@ namespace LibationWinForms.AvaloniaUI.ViewModels
/// <summary> /// <summary>
/// Call once on load so we can modify access a private member with reflection /// Call once on load so we can modify access a private member with reflection
/// </summary> /// </summary>
public void RegisterCollectionChanged(ProductsDisplay2 productsDisplay = null) public void RegisterCollectionChanged(ProductsDisplay productsDisplay = null)
{ {
productsDataGrid ??= productsDisplay?.productsGrid; productsDataGrid ??= productsDisplay?.productsGrid;
@ -67,7 +67,7 @@ namespace LibationWinForms.AvaloniaUI.ViewModels
{ {
if (s != GridEntries) return; if (s != GridEntries) return;
var displayListGE = ((IEnumerable)DataSource_PI.GetValue(DataConnection_PI.GetValue(productsDataGrid))).Cast<GridEntry2>(); var displayListGE = ((IEnumerable)DataSource_PI.GetValue(DataConnection_PI.GetValue(productsDataGrid))).Cast<GridEntry>();
int index = 0; int index = 0;
foreach (var di in displayListGE) foreach (var di in displayListGE)
{ {
@ -83,7 +83,7 @@ namespace LibationWinForms.AvaloniaUI.ViewModels
{ {
try try
{ {
GridEntries = new GridEntryBindingList2(CreateGridEntries(dbBooks)); GridEntries = new GridEntryCollection(CreateGridEntries(dbBooks));
GridEntries.CollapseAll(); GridEntries.CollapseAll();
int bookEntryCount = GridEntries.BookEntries().Count(); int bookEntryCount = GridEntries.BookEntries().Count();
@ -119,7 +119,7 @@ namespace LibationWinForms.AvaloniaUI.ViewModels
foreach (var series in existingSeriesEntries) foreach (var series in existingSeriesEntries)
{ {
var sEntry = GridEntries.InternalList.FirstOrDefault(ge => ge.AudibleProductId == series.AudibleProductId); var sEntry = GridEntries.InternalList.FirstOrDefault(ge => ge.AudibleProductId == series.AudibleProductId);
if (sEntry is SeriesEntrys2 se && !series.Liberate.Expanded) if (sEntry is SeriesEntry se && !series.Liberate.Expanded)
await Dispatcher.UIThread.InvokeAsync(() => GridEntries.CollapseItem(se)); await Dispatcher.UIThread.InvokeAsync(() => GridEntries.CollapseItem(se));
} }
await Dispatcher.UIThread.InvokeAsync(() => await Dispatcher.UIThread.InvokeAsync(() =>
@ -134,12 +134,12 @@ namespace LibationWinForms.AvaloniaUI.ViewModels
} }
} }
private static IEnumerable<GridEntry2> CreateGridEntries(IEnumerable<LibraryBook> dbBooks) private static IEnumerable<GridEntry> CreateGridEntries(IEnumerable<LibraryBook> dbBooks)
{ {
var geList = dbBooks var geList = dbBooks
.Where(lb => lb.Book.IsProduct()) .Where(lb => lb.Book.IsProduct())
.Select(b => new LibraryBookEntry2(b)) .Select(b => new LibraryBookEntry(b))
.Cast<GridEntry2>() .Cast<GridEntry>()
.ToList(); .ToList();
var episodes = dbBooks.Where(lb => lb.Book.IsEpisodeChild()); var episodes = dbBooks.Where(lb => lb.Book.IsEpisodeChild());
@ -152,7 +152,7 @@ namespace LibationWinForms.AvaloniaUI.ViewModels
if (!seriesEpisodes.Any()) continue; if (!seriesEpisodes.Any()) continue;
var seriesEntry = new SeriesEntrys2(parent, seriesEpisodes); var seriesEntry = new SeriesEntry(parent, seriesEpisodes);
geList.Add(seriesEntry); geList.Add(seriesEntry);
geList.AddRange(seriesEntry.Children); geList.AddRange(seriesEntry.Children);
@ -160,7 +160,7 @@ namespace LibationWinForms.AvaloniaUI.ViewModels
return geList.OrderByDescending(e => e.DateAdded); return geList.OrderByDescending(e => e.DateAdded);
} }
public void ToggleSeriesExpanded(SeriesEntrys2 seriesEntry) public void ToggleSeriesExpanded(SeriesEntry seriesEntry)
{ {
if (seriesEntry.Liberate.Expanded) if (seriesEntry.Liberate.Expanded)
GridEntries.CollapseItem(seriesEntry); GridEntries.CollapseItem(seriesEntry);
@ -213,7 +213,7 @@ namespace LibationWinForms.AvaloniaUI.ViewModels
if (_currentSortColumn is null) if (_currentSortColumn is null)
{ {
//Sort ascending and reverse. That's how the comparer is designed to work to be compatible with Avalonia. //Sort ascending and reverse. That's how the comparer is designed to work to be compatible with Avalonia.
var defaultComparer = new RowComparer(ListSortDirection.Descending, nameof(GridEntry2.DateAdded)); var defaultComparer = new RowComparer(ListSortDirection.Descending, nameof(GridEntry.DateAdded));
GridEntries.InternalList.Sort(defaultComparer); GridEntries.InternalList.Sort(defaultComparer);
GridEntries.InternalList.Reverse(); GridEntries.InternalList.Reverse();
GridEntries.ResetCollection(); GridEntries.ResetCollection();
@ -326,7 +326,7 @@ namespace LibationWinForms.AvaloniaUI.ViewModels
private void Item_PropertyChanged(object sender, PropertyChangedEventArgs e) private void Item_PropertyChanged(object sender, PropertyChangedEventArgs e)
{ {
if (e.PropertyName == nameof(GridEntry2.Remove) && sender is LibraryBookEntry2 lbEntry) if (e.PropertyName == nameof(GridEntry.Remove) && sender is LibraryBookEntry lbEntry)
{ {
int removeCount = GetAllBookEntries().Count(lbe => lbe.Remove is true); int removeCount = GetAllBookEntries().Count(lbe => lbe.Remove is true);
RemovableCountChanged?.Invoke(this, removeCount); RemovableCountChanged?.Invoke(this, removeCount);

View File

@ -8,19 +8,19 @@ namespace LibationWinForms.AvaloniaUI.ViewModels
#nullable enable #nullable enable
internal static class QueryExtensions internal static class QueryExtensions
{ {
public static IEnumerable<LibraryBookEntry2> BookEntries(this IEnumerable<GridEntry2> gridEntries) public static IEnumerable<LibraryBookEntry> BookEntries(this IEnumerable<GridEntry> gridEntries)
=> gridEntries.OfType<LibraryBookEntry2>(); => gridEntries.OfType<LibraryBookEntry>();
public static IEnumerable<SeriesEntrys2> SeriesEntries(this IEnumerable<GridEntry2> gridEntries) public static IEnumerable<SeriesEntry> SeriesEntries(this IEnumerable<GridEntry> gridEntries)
=> gridEntries.OfType<SeriesEntrys2>(); => gridEntries.OfType<SeriesEntry>();
public static T? FindByAsin<T>(this IEnumerable<T> gridEntries, string audibleProductID) where T : GridEntry2 public static T? FindByAsin<T>(this IEnumerable<T> gridEntries, string audibleProductID) where T : GridEntry
=> gridEntries.FirstOrDefault(i => i.AudibleProductId == audibleProductID); => gridEntries.FirstOrDefault(i => i.AudibleProductId == audibleProductID);
public static IEnumerable<SeriesEntrys2> EmptySeries(this IEnumerable<GridEntry2> gridEntries) public static IEnumerable<SeriesEntry> EmptySeries(this IEnumerable<GridEntry> gridEntries)
=> gridEntries.SeriesEntries().Where(i => i.Children.Count == 0); => gridEntries.SeriesEntries().Where(i => i.Children.Count == 0);
public static SeriesEntrys2? FindSeriesParent(this IEnumerable<GridEntry2> gridEntries, LibraryBook seriesEpisode) public static SeriesEntry? FindSeriesParent(this IEnumerable<GridEntry> gridEntries, LibraryBook seriesEpisode)
{ {
if (seriesEpisode.Book.SeriesLink is null) return null; if (seriesEpisode.Book.SeriesLink is null) return null;

View File

@ -13,7 +13,7 @@ namespace LibationWinForms.AvaloniaUI.ViewModels
/// sorted by series index, ascending. Stable sorting is achieved by comparing the GridEntry.ListIndex /// sorted by series index, ascending. Stable sorting is achieved by comparing the GridEntry.ListIndex
/// properties when 2 items compare equal. /// properties when 2 items compare equal.
/// </summary> /// </summary>
internal class RowComparer : IComparer, IComparer<GridEntry2> internal class RowComparer : IComparer, IComparer<GridEntry>
{ {
private static readonly PropertyInfo HeaderCellPi = typeof(DataGridColumn).GetProperty("HeaderCell", BindingFlags.NonPublic | BindingFlags.Instance); private static readonly PropertyInfo HeaderCellPi = typeof(DataGridColumn).GetProperty("HeaderCell", BindingFlags.NonPublic | BindingFlags.Instance);
private static readonly PropertyInfo CurrentSortingStatePi = typeof(DataGridColumnHeader).GetProperty("CurrentSortingState", BindingFlags.NonPublic | BindingFlags.Instance); private static readonly PropertyInfo CurrentSortingStatePi = typeof(DataGridColumnHeader).GetProperty("CurrentSortingState", BindingFlags.NonPublic | BindingFlags.Instance);
@ -39,17 +39,17 @@ namespace LibationWinForms.AvaloniaUI.ViewModels
if (x is not null && y is null) return 1; if (x is not null && y is null) return 1;
if (x is null && y is null) return 0; if (x is null && y is null) return 0;
var geA = (GridEntry2)x; var geA = (GridEntry)x;
var geB = (GridEntry2)y; var geB = (GridEntry)y;
SortDirection ??= GetSortOrder(); SortDirection ??= GetSortOrder();
SeriesEntrys2 parentA = null; SeriesEntry parentA = null;
SeriesEntrys2 parentB = null; SeriesEntry parentB = null;
if (geA is LibraryBookEntry2 lbA && lbA.Parent is SeriesEntrys2 seA) if (geA is LibraryBookEntry lbA && lbA.Parent is SeriesEntry seA)
parentA = seA; parentA = seA;
if (geB is LibraryBookEntry2 lbB && lbB.Parent is SeriesEntrys2 seB) if (geB is LibraryBookEntry lbB && lbB.Parent is SeriesEntry seB)
parentB = seB; parentB = seB;
//both a and b are top-level grid entries //both a and b are top-level grid entries
@ -88,7 +88,7 @@ namespace LibationWinForms.AvaloniaUI.ViewModels
private ListSortDirection? GetSortOrder() private ListSortDirection? GetSortOrder()
=> CurrentSortingStatePi.GetValue(HeaderCellPi.GetValue(Column)) as ListSortDirection?; => CurrentSortingStatePi.GetValue(HeaderCellPi.GetValue(Column)) as ListSortDirection?;
private int InternalCompare(GridEntry2 x, GridEntry2 y) private int InternalCompare(GridEntry x, GridEntry y)
{ {
var val1 = x.GetMemberValue(PropertyName); var val1 = x.GetMemberValue(PropertyName);
var val2 = y.GetMemberValue(PropertyName); var val2 = y.GetMemberValue(PropertyName);
@ -103,7 +103,7 @@ namespace LibationWinForms.AvaloniaUI.ViewModels
return compareResult; return compareResult;
} }
public int Compare(GridEntry2 x, GridEntry2 y) public int Compare(GridEntry x, GridEntry y)
{ {
return Compare((object)x, y); return Compare((object)x, y);
} }

View File

@ -10,9 +10,9 @@ using System.Linq;
namespace LibationWinForms.AvaloniaUI.ViewModels namespace LibationWinForms.AvaloniaUI.ViewModels
{ {
/// <summary>The View Model for a LibraryBook that is ContentType.Parent</summary> /// <summary>The View Model for a LibraryBook that is ContentType.Parent</summary>
public class SeriesEntrys2 : GridEntry2 public class SeriesEntry : GridEntry
{ {
[Browsable(false)] public List<LibraryBookEntry2> Children { get; } [Browsable(false)] public List<LibraryBookEntry> Children { get; }
[Browsable(false)] public override DateTime DateAdded => Children.Max(c => c.DateAdded); [Browsable(false)] public override DateTime DateAdded => Children.Max(c => c.DateAdded);
private bool suspendCounting = false; private bool suspendCounting = false;
@ -44,7 +44,7 @@ namespace LibationWinForms.AvaloniaUI.ViewModels
} }
} }
public override LiberateButtonStatus2 Liberate { get; } public override LiberateButtonStatus Liberate { get; }
public override BookTags BookTags { get; } = new(); public override BookTags BookTags { get; } = new();
public override bool IsSeries => true; public override bool IsSeries => true;
@ -53,16 +53,16 @@ namespace LibationWinForms.AvaloniaUI.ViewModels
#endregion #endregion
public SeriesEntrys2(LibraryBook parent, IEnumerable<LibraryBook> children) public SeriesEntry(LibraryBook parent, IEnumerable<LibraryBook> children)
{ {
Liberate = new LiberateButtonStatus2(IsSeries) { Expanded = true }; Liberate = new LiberateButtonStatus(IsSeries) { Expanded = true };
SeriesIndex = -1; SeriesIndex = -1;
LibraryBook = parent; LibraryBook = parent;
LoadCover(); LoadCover();
Children = children Children = children
.Select(c => new LibraryBookEntry2(c) { Parent = this }) .Select(c => new LibraryBookEntry(c) { Parent = this })
.OrderBy(c => c.SeriesIndex) .OrderBy(c => c.SeriesIndex)
.ToList(); .ToList();

View File

@ -33,7 +33,7 @@ namespace LibationWinForms.AvaloniaUI.ViewModels
* and is stored in ObservableCollection.Items. When the primary list changes, the * and is stored in ObservableCollection.Items. When the primary list changes, the
* secondary list is cleared and reset to match the primary. * secondary list is cleared and reset to match the primary.
*/ */
public class TrackedQueue2<T> : ObservableCollection<T> where T : class public class TrackedQueue<T> : ObservableCollection<T> where T : class
{ {
public event EventHandler<int> CompletedCountChanged; public event EventHandler<int> CompletedCountChanged;
public event EventHandler<int> QueuededCountChanged; public event EventHandler<int> QueuededCountChanged;

View File

@ -19,8 +19,8 @@ namespace LibationWinForms.AvaloniaUI.Views.Dialogs
get => _filterString; get => _filterString;
set set
{ {
IsDefault = string.IsNullOrEmpty(value);
this.RaiseAndSetIfChanged(ref _filterString, value); this.RaiseAndSetIfChanged(ref _filterString, value);
IsDefault = string.IsNullOrEmpty(_filterString);
this.RaisePropertyChanged(nameof(IsDefault)); this.RaisePropertyChanged(nameof(IsDefault));
} }
} }
@ -54,7 +54,9 @@ namespace LibationWinForms.AvaloniaUI.Views.Dialogs
{ {
if (Filters.Any(f => f.IsDefault)) if (Filters.Any(f => f.IsDefault))
return; return;
Filters.Insert(Filters.Count, new Filter()); var newBlank = new Filter();
newBlank.PropertyChanged += Filter_PropertyChanged;
Filters.Insert(Filters.Count, newBlank);
} }
protected override void SaveAndClose() protected override void SaveAndClose()

View File

@ -167,11 +167,11 @@
<!-- Process Queue --> <!-- Process Queue -->
<SplitView.Pane> <SplitView.Pane>
<views:ProcessQueueControl2 DataContext="{Binding ProcessQueue}"/> <views:ProcessQueueControl DataContext="{Binding ProcessQueue}"/>
</SplitView.Pane> </SplitView.Pane>
<!-- Product Display Grid --> <!-- Product Display Grid -->
<views:ProductsDisplay2 <views:ProductsDisplay
Name="productsDisplay" Name="productsDisplay"
Initialized="ProductsDisplay_Initialized1" Initialized="ProductsDisplay_Initialized1"
DataContext="{Binding ProductsDisplay}" DataContext="{Binding ProductsDisplay}"

View File

@ -72,7 +72,7 @@ namespace LibationWinForms.AvaloniaUI.Views
public void ProductsDisplay_Initialized1(object sender, EventArgs e) public void ProductsDisplay_Initialized1(object sender, EventArgs e)
{ {
if (sender is ProductsDisplay2 products) if (sender is ProductsDisplay products)
_viewModel.ProductsDisplay.RegisterCollectionChanged(products); _viewModel.ProductsDisplay.RegisterCollectionChanged(products);
} }
@ -92,7 +92,7 @@ namespace LibationWinForms.AvaloniaUI.Views
private void FindAllControls() private void FindAllControls()
{ {
quickFiltersToolStripMenuItem = this.FindControl<MenuItem>(nameof(quickFiltersToolStripMenuItem)); quickFiltersToolStripMenuItem = this.FindControl<MenuItem>(nameof(quickFiltersToolStripMenuItem));
productsDisplay = this.FindControl<ProductsDisplay2>(nameof(productsDisplay)); productsDisplay = this.FindControl<ProductsDisplay>(nameof(productsDisplay));
} }
protected override void OnDataContextChanged(EventArgs e) protected override void OnDataContextChanged(EventArgs e)

View File

@ -3,7 +3,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" d:DesignWidth="400" d:DesignHeight="90" MaxHeight="90" MinHeight="90" MinWidth="300" mc:Ignorable="d" d:DesignWidth="400" d:DesignHeight="90" MaxHeight="90" MinHeight="90" MinWidth="300"
x:Class="LibationWinForms.AvaloniaUI.Views.ProcessBookControl2" Background="{Binding BackgroundColor}"> x:Class="LibationWinForms.AvaloniaUI.Views.ProcessBookControl" Background="{Binding BackgroundColor}">
<Border BorderBrush="{DynamicResource ProcessQueueBookBorderBrush}" BorderThickness="2"> <Border BorderBrush="{DynamicResource ProcessQueueBookBorderBrush}" BorderThickness="2">
<Grid ColumnDefinitions="Auto,*,Auto"> <Grid ColumnDefinitions="Auto,*,Auto">

View File

@ -8,20 +8,20 @@ using DataLayer;
namespace LibationWinForms.AvaloniaUI.Views namespace LibationWinForms.AvaloniaUI.Views
{ {
public delegate void QueueItemPositionButtonClicked(ProcessBook2 item, QueuePosition queueButton); public delegate void QueueItemPositionButtonClicked(ProcessBookViewModel item, QueuePosition queueButton);
public delegate void QueueItemCancelButtonClicked(ProcessBook2 item); public delegate void QueueItemCancelButtonClicked(ProcessBookViewModel item);
public partial class ProcessBookControl2 : UserControl public partial class ProcessBookControl : UserControl
{ {
public static event QueueItemPositionButtonClicked PositionButtonClicked; public static event QueueItemPositionButtonClicked PositionButtonClicked;
public static event QueueItemCancelButtonClicked CancelButtonClicked; public static event QueueItemCancelButtonClicked CancelButtonClicked;
public ProcessBookControl2() public ProcessBookControl()
{ {
InitializeComponent(); InitializeComponent();
if (Design.IsDesignMode) if (Design.IsDesignMode)
{ {
using var context = DbContexts.GetContext(); using var context = DbContexts.GetContext();
DataContext = new ProcessBook2( DataContext = new ProcessBookViewModel(
context.GetLibraryBook_Flat_NoTracking("B017V4IM1G"), context.GetLibraryBook_Flat_NoTracking("B017V4IM1G"),
ProcessQueue.LogMe.RegisterForm(default(ProcessQueue.ILogForm)) ProcessQueue.LogMe.RegisterForm(default(ProcessQueue.ILogForm))
); );
@ -29,7 +29,7 @@ namespace LibationWinForms.AvaloniaUI.Views
} }
} }
private ProcessBook2 DataItem => DataContext is null ? null : DataContext as ProcessBook2; private ProcessBookViewModel DataItem => DataContext is null ? null : DataContext as ProcessBookViewModel;
public void Cancel_Click(object sender, Avalonia.Interactivity.RoutedEventArgs e) public void Cancel_Click(object sender, Avalonia.Interactivity.RoutedEventArgs e)
=> CancelButtonClicked?.Invoke(DataItem); => CancelButtonClicked?.Invoke(DataItem);

View File

@ -6,12 +6,12 @@
xmlns:views="clr-namespace:LibationWinForms.AvaloniaUI.Views" xmlns:views="clr-namespace:LibationWinForms.AvaloniaUI.Views"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
mc:Ignorable="d" d:DesignWidth="450" d:DesignHeight="850" mc:Ignorable="d" d:DesignWidth="450" d:DesignHeight="850"
x:Class="LibationWinForms.AvaloniaUI.Views.ProcessQueueControl2"> x:Class="LibationWinForms.AvaloniaUI.Views.ProcessQueueControl">
<UserControl.Resources> <UserControl.Resources>
<RecyclePool x:Key="RecyclePool" /> <RecyclePool x:Key="RecyclePool" />
<DataTemplate x:Key="queuedBook"> <DataTemplate x:Key="queuedBook">
<views:ProcessBookControl2 /> <views:ProcessBookControl />
</DataTemplate> </DataTemplate>
<RecyclingElementFactory x:Key="elementFactory" RecyclePool="{StaticResource RecyclePool}"> <RecyclingElementFactory x:Key="elementFactory" RecyclePool="{StaticResource RecyclePool}">
<RecyclingElementFactory.Templates> <RecyclingElementFactory.Templates>

View File

@ -10,17 +10,17 @@ using System.Linq;
namespace LibationWinForms.AvaloniaUI.Views namespace LibationWinForms.AvaloniaUI.Views
{ {
public partial class ProcessQueueControl2 : UserControl public partial class ProcessQueueControl : UserControl
{ {
private TrackedQueue2<ProcessBook2> Queue => _viewModel.Items; private TrackedQueue<ProcessBookViewModel> Queue => _viewModel.Items;
private ProcessQueueViewModel _viewModel => DataContext as ProcessQueueViewModel; private ProcessQueueViewModel _viewModel => DataContext as ProcessQueueViewModel;
public ProcessQueueControl2() public ProcessQueueControl()
{ {
InitializeComponent(); InitializeComponent();
ProcessBookControl2.PositionButtonClicked += ProcessBookControl2_ButtonClicked; ProcessBookControl.PositionButtonClicked += ProcessBookControl2_ButtonClicked;
ProcessBookControl2.CancelButtonClicked += ProcessBookControl2_CancelButtonClicked; ProcessBookControl.CancelButtonClicked += ProcessBookControl2_CancelButtonClicked;
#region Design Mode Testing #region Design Mode Testing
if (Design.IsDesignMode) if (Design.IsDesignMode)
@ -29,44 +29,44 @@ namespace LibationWinForms.AvaloniaUI.Views
var Logger = ProcessQueue.LogMe.RegisterForm(vm); var Logger = ProcessQueue.LogMe.RegisterForm(vm);
DataContext = vm; DataContext = vm;
using var context = DbContexts.GetContext(); using var context = DbContexts.GetContext();
List<ProcessBook2> testList = new() List<ProcessBookViewModel> testList = new()
{ {
new ProcessBook2(context.GetLibraryBook_Flat_NoTracking("B017V4IM1G"), Logger) new ProcessBookViewModel(context.GetLibraryBook_Flat_NoTracking("B017V4IM1G"), Logger)
{ {
Result = ProcessBookResult.FailedAbort, Result = ProcessBookResult.FailedAbort,
Status = ProcessBookStatus.Failed, Status = ProcessBookStatus.Failed,
}, },
new ProcessBook2(context.GetLibraryBook_Flat_NoTracking("B017V4IWVG"), Logger) new ProcessBookViewModel(context.GetLibraryBook_Flat_NoTracking("B017V4IWVG"), Logger)
{ {
Result = ProcessBookResult.FailedSkip, Result = ProcessBookResult.FailedSkip,
Status = ProcessBookStatus.Failed, Status = ProcessBookStatus.Failed,
}, },
new ProcessBook2(context.GetLibraryBook_Flat_NoTracking("B017V4JA2Q"), Logger) new ProcessBookViewModel(context.GetLibraryBook_Flat_NoTracking("B017V4JA2Q"), Logger)
{ {
Result = ProcessBookResult.FailedRetry, Result = ProcessBookResult.FailedRetry,
Status = ProcessBookStatus.Failed, Status = ProcessBookStatus.Failed,
}, },
new ProcessBook2(context.GetLibraryBook_Flat_NoTracking("B017V4NUPO"), Logger) new ProcessBookViewModel(context.GetLibraryBook_Flat_NoTracking("B017V4NUPO"), Logger)
{ {
Result = ProcessBookResult.ValidationFail, Result = ProcessBookResult.ValidationFail,
Status = ProcessBookStatus.Failed, Status = ProcessBookStatus.Failed,
}, },
new ProcessBook2(context.GetLibraryBook_Flat_NoTracking("B017V4NMX4"), Logger) new ProcessBookViewModel(context.GetLibraryBook_Flat_NoTracking("B017V4NMX4"), Logger)
{ {
Result = ProcessBookResult.Cancelled, Result = ProcessBookResult.Cancelled,
Status = ProcessBookStatus.Cancelled, Status = ProcessBookStatus.Cancelled,
}, },
new ProcessBook2(context.GetLibraryBook_Flat_NoTracking("B017V4NOZ0"), Logger) new ProcessBookViewModel(context.GetLibraryBook_Flat_NoTracking("B017V4NOZ0"), Logger)
{ {
Result = ProcessBookResult.Success, Result = ProcessBookResult.Success,
Status = ProcessBookStatus.Completed, Status = ProcessBookStatus.Completed,
}, },
new ProcessBook2(context.GetLibraryBook_Flat_NoTracking("B017WJ5ZK6"), Logger) new ProcessBookViewModel(context.GetLibraryBook_Flat_NoTracking("B017WJ5ZK6"), Logger)
{ {
Result = ProcessBookResult.None, Result = ProcessBookResult.None,
Status = ProcessBookStatus.Working, Status = ProcessBookStatus.Working,
}, },
new ProcessBook2(context.GetLibraryBook_Flat_NoTracking("B017V4IM1G"), Logger) new ProcessBookViewModel(context.GetLibraryBook_Flat_NoTracking("B017V4IM1G"), Logger)
{ {
Result = ProcessBookResult.None, Result = ProcessBookResult.None,
Status = ProcessBookStatus.Queued, Status = ProcessBookStatus.Queued,
@ -93,14 +93,14 @@ namespace LibationWinForms.AvaloniaUI.Views
#region Control event handlers #region Control event handlers
private async void ProcessBookControl2_CancelButtonClicked(ProcessBook2 item) private async void ProcessBookControl2_CancelButtonClicked(ProcessBookViewModel item)
{ {
if (item is not null) if (item is not null)
await item.CancelAsync(); await item.CancelAsync();
Queue.RemoveQueued(item); Queue.RemoveQueued(item);
} }
private void ProcessBookControl2_ButtonClicked(ProcessBook2 item, QueuePosition queueButton) private void ProcessBookControl2_ButtonClicked(ProcessBookViewModel item, QueuePosition queueButton)
{ {
Queue.MoveQueuePosition(item, queueButton); Queue.MoveQueuePosition(item, queueButton);
} }

View File

@ -5,7 +5,7 @@
xmlns:views="clr-namespace:LibationWinForms.AvaloniaUI.Views" xmlns:views="clr-namespace:LibationWinForms.AvaloniaUI.Views"
xmlns:controls="clr-namespace:LibationWinForms.AvaloniaUI.Controls" xmlns:controls="clr-namespace:LibationWinForms.AvaloniaUI.Controls"
mc:Ignorable="d" d:DesignWidth="1560" d:DesignHeight="400" mc:Ignorable="d" d:DesignWidth="1560" d:DesignHeight="400"
x:Class="LibationWinForms.AvaloniaUI.Views.ProductsDisplay2"> x:Class="LibationWinForms.AvaloniaUI.Views.ProductsDisplay">
<Grid> <Grid>

View File

@ -13,29 +13,29 @@ using System.Linq;
namespace LibationWinForms.AvaloniaUI.Views namespace LibationWinForms.AvaloniaUI.Views
{ {
public partial class ProductsDisplay2 : UserControl public partial class ProductsDisplay : UserControl
{ {
public event EventHandler<LibraryBook> LiberateClicked; public event EventHandler<LibraryBook> LiberateClicked;
private ProductsDisplayViewModel _viewModel => DataContext as ProductsDisplayViewModel; private ProductsDisplayViewModel _viewModel => DataContext as ProductsDisplayViewModel;
ImageDisplayDialog imageDisplayDialog; ImageDisplayDialog imageDisplayDialog;
public ProductsDisplay2() public ProductsDisplay()
{ {
InitializeComponent(); InitializeComponent();
if (Design.IsDesignMode) if (Design.IsDesignMode)
{ {
using var context = DbContexts.GetContext(); using var context = DbContexts.GetContext();
List<GridEntry2> sampleEntries = new() List<GridEntry> sampleEntries = new()
{ {
new LibraryBookEntry2(context.GetLibraryBook_Flat_NoTracking("B017V4IM1G")), new LibraryBookEntry(context.GetLibraryBook_Flat_NoTracking("B017V4IM1G")),
new LibraryBookEntry2(context.GetLibraryBook_Flat_NoTracking("B017V4IWVG")), new LibraryBookEntry(context.GetLibraryBook_Flat_NoTracking("B017V4IWVG")),
new LibraryBookEntry2(context.GetLibraryBook_Flat_NoTracking("B017V4JA2Q")), new LibraryBookEntry(context.GetLibraryBook_Flat_NoTracking("B017V4JA2Q")),
new LibraryBookEntry2(context.GetLibraryBook_Flat_NoTracking("B017V4NUPO")), new LibraryBookEntry(context.GetLibraryBook_Flat_NoTracking("B017V4NUPO")),
new LibraryBookEntry2(context.GetLibraryBook_Flat_NoTracking("B017V4NMX4")), new LibraryBookEntry(context.GetLibraryBook_Flat_NoTracking("B017V4NMX4")),
new LibraryBookEntry2(context.GetLibraryBook_Flat_NoTracking("B017V4NOZ0")), new LibraryBookEntry(context.GetLibraryBook_Flat_NoTracking("B017V4NOZ0")),
new LibraryBookEntry2(context.GetLibraryBook_Flat_NoTracking("B017WJ5ZK6")), new LibraryBookEntry(context.GetLibraryBook_Flat_NoTracking("B017WJ5ZK6")),
}; };
DataContext = new ProductsDisplayViewModel(sampleEntries); DataContext = new ProductsDisplayViewModel(sampleEntries);
return; return;
@ -101,7 +101,7 @@ namespace LibationWinForms.AvaloniaUI.Views
{ {
var itemName = column.SortMemberPath; var itemName = column.SortMemberPath;
if (itemName == nameof(GridEntry2.Remove)) if (itemName == nameof(GridEntry.Remove))
continue; continue;
menuItems.Add menuItems.Add
@ -192,7 +192,7 @@ namespace LibationWinForms.AvaloniaUI.Views
{ {
var button = args.Source as Button; var button = args.Source as Button;
if (button.DataContext is SeriesEntrys2 sEntry) if (button.DataContext is SeriesEntry sEntry)
{ {
_viewModel.ToggleSeriesExpanded(sEntry); _viewModel.ToggleSeriesExpanded(sEntry);
@ -200,7 +200,7 @@ namespace LibationWinForms.AvaloniaUI.Views
//to the topright cell. Reset focus onto the clicked button's cell. //to the topright cell. Reset focus onto the clicked button's cell.
((sender as Control).Parent.Parent as DataGridCell)?.Focus(); ((sender as Control).Parent.Parent as DataGridCell)?.Focus();
} }
else if (button.DataContext is LibraryBookEntry2 lbEntry) else if (button.DataContext is LibraryBookEntry lbEntry)
{ {
LiberateClicked?.Invoke(this, lbEntry.LibraryBook); LiberateClicked?.Invoke(this, lbEntry.LibraryBook);
} }
@ -214,7 +214,7 @@ namespace LibationWinForms.AvaloniaUI.Views
public void Cover_Click(object sender, Avalonia.Interactivity.RoutedEventArgs args) public void Cover_Click(object sender, Avalonia.Interactivity.RoutedEventArgs args)
{ {
if (sender is not Image tblock || tblock.DataContext is not GridEntry2 gEntry) if (sender is not Image tblock || tblock.DataContext is not GridEntry gEntry)
return; return;
@ -254,7 +254,7 @@ namespace LibationWinForms.AvaloniaUI.Views
public void Description_Click(object sender, Avalonia.Interactivity.RoutedEventArgs args) public void Description_Click(object sender, Avalonia.Interactivity.RoutedEventArgs args)
{ {
if (sender is TextBlock tblock && tblock.DataContext is GridEntry2 gEntry) if (sender is TextBlock tblock && tblock.DataContext is GridEntry gEntry)
{ {
var pt = tblock.Parent.PointToScreen(tblock.Parent.Bounds.TopRight); var pt = tblock.Parent.PointToScreen(tblock.Parent.Bounds.TopRight);
var displayWindow = new DescriptionDisplayDialog var displayWindow = new DescriptionDisplayDialog
@ -283,7 +283,7 @@ namespace LibationWinForms.AvaloniaUI.Views
{ {
var button = args.Source as Button; var button = args.Source as Button;
if (button.DataContext is LibraryBookEntry2 lbEntry && VisualRoot is Window window) if (button.DataContext is LibraryBookEntry lbEntry && VisualRoot is Window window)
{ {
if (bookDetailsForm is null || !bookDetailsForm.IsVisible) if (bookDetailsForm is null || !bookDetailsForm.IsVisible)
{ {

View File

@ -124,6 +124,15 @@
<Compile Update="AvaloniaUI\Views\Dialogs\ImageDisplayDialog.axaml.cs"> <Compile Update="AvaloniaUI\Views\Dialogs\ImageDisplayDialog.axaml.cs">
<DependentUpon>ImageDisplayDialog.axaml</DependentUpon> <DependentUpon>ImageDisplayDialog.axaml</DependentUpon>
</Compile> </Compile>
<Compile Update="AvaloniaUI\Views\ProcessBookControl.axaml.cs">
<DependentUpon>ProcessBookControl.axaml</DependentUpon>
</Compile>
<Compile Update="AvaloniaUI\Views\ProcessQueueControl.axaml.cs">
<DependentUpon>ProcessQueueControl.axaml</DependentUpon>
</Compile>
<Compile Update="AvaloniaUI\Views\ProductsDisplay.axaml.cs">
<DependentUpon>ProductsDisplay.axaml</DependentUpon>
</Compile>
<Compile Update="Properties\Resources.Designer.cs"> <Compile Update="Properties\Resources.Designer.cs">
<DesignTime>True</DesignTime> <DesignTime>True</DesignTime>
<AutoGen>True</AutoGen> <AutoGen>True</AutoGen>