diff --git a/Source/LibationAvalonia/Controls/Settings/Important.axaml b/Source/LibationAvalonia/Controls/Settings/Important.axaml index a102c398..61464095 100644 --- a/Source/LibationAvalonia/Controls/Settings/Important.axaml +++ b/Source/LibationAvalonia/Controls/Settings/Important.axaml @@ -53,7 +53,7 @@ Padding="20,0" VerticalAlignment="Stretch" Content="Open Log Folder" - Click="OpenLogFolderButton_Click" /> + Command="{CompiledBinding OpenLogFolderButton}" /> diff --git a/Source/LibationAvalonia/Dialogs/SettingsDialog.axaml.cs b/Source/LibationAvalonia/Dialogs/SettingsDialog.axaml.cs index 7160fafa..ba1839b9 100644 --- a/Source/LibationAvalonia/Dialogs/SettingsDialog.axaml.cs +++ b/Source/LibationAvalonia/Dialogs/SettingsDialog.axaml.cs @@ -1,14 +1,6 @@ -using Avalonia.Collections; using Avalonia.Controls; -using Dinah.Core; -using FileManager; using LibationAvalonia.ViewModels.Settings; using LibationFileManager; -using LibationUiBase; -using ReactiveUI; -using System; -using System.Collections.Generic; -using System.Linq; using System.Threading.Tasks; namespace LibationAvalonia.Dialogs @@ -47,10 +39,5 @@ namespace LibationAvalonia.Dialogs public async void SaveButton_Clicked(object sender, Avalonia.Interactivity.RoutedEventArgs e) => await SaveAndCloseAsync(); - - public void OpenLogFolderButton_Click(object sender, Avalonia.Interactivity.RoutedEventArgs e) - { - Go.To.Folder(((LongPath)Configuration.Instance.LibationFiles).ShortPathName); - } } } diff --git a/Source/LibationAvalonia/ViewModels/Settings/ImportantSettingsVM.cs b/Source/LibationAvalonia/ViewModels/Settings/ImportantSettingsVM.cs index 9f7b7e00..1549f0bc 100644 --- a/Source/LibationAvalonia/ViewModels/Settings/ImportantSettingsVM.cs +++ b/Source/LibationAvalonia/ViewModels/Settings/ImportantSettingsVM.cs @@ -1,4 +1,5 @@ -using FileManager; +using Dinah.Core; +using FileManager; using LibationFileManager; using ReactiveUI; using System; @@ -38,6 +39,8 @@ namespace LibationAvalonia.ViewModels.Settings Configuration.Instance.SetString(ThemeVariant, nameof(ThemeVariant)); } + public void OpenLogFolderButton() => Go.To.Folder(((LongPath)Configuration.Instance.LibationFiles).ShortPathName); + public List KnownDirectories { get; } = new() { Configuration.KnownDirectories.UserProfile, diff --git a/Source/LibationAvalonia/Views/MainWindow.axaml b/Source/LibationAvalonia/Views/MainWindow.axaml index 6cb02cb5..190882ff 100644 --- a/Source/LibationAvalonia/Views/MainWindow.axaml +++ b/Source/LibationAvalonia/Views/MainWindow.axaml @@ -74,203 +74,169 @@ - - - - - - - + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Source/LibationUiBase/GridView/EntryStatus.cs b/Source/LibationUiBase/GridView/EntryStatus.cs index 1abeded9..4e319597 100644 --- a/Source/LibationUiBase/GridView/EntryStatus.cs +++ b/Source/LibationUiBase/GridView/EntryStatus.cs @@ -58,7 +58,7 @@ namespace LibationUiBase.GridView public abstract object BackgroundBrush { get; } public object ButtonImage => GetLiberateIcon(); public string ToolTip => GetTooltip(); - protected Book Book { get; } + protected internal Book Book { get; internal set; } private DateTime lastBookUpdate; private LiberatedStatus bookStatus; diff --git a/Source/LibationUiBase/GridView/GridEntry[TStatus].cs b/Source/LibationUiBase/GridView/GridEntry[TStatus].cs index 905a9e68..c731121d 100644 --- a/Source/LibationUiBase/GridView/GridEntry[TStatus].cs +++ b/Source/LibationUiBase/GridView/GridEntry[TStatus].cs @@ -154,6 +154,10 @@ namespace LibationUiBase.GridView if (udi.Book.AudibleProductId != Book.AudibleProductId) return; + //If UserDefinedItem was changed on a different Book instance (such as when batch liberating via menus), + //EntryStatu's Book instance will not have the current DB state. + Liberate.Book = udi.Book; + // UDI changed, possibly in a different context/view. Update this viewmodel. Call NotifyPropertyChanged to notify view. // - This method responds to tons of incidental changes. Do not persist to db from here. Committing to db must be a volitional action by the caller, not incidental. Otherwise batch changes would be impossible; we would only have slow one-offs // - Don't restrict notifying view to 'only if property changed'. This same book instance can get passed to a different view, then changed there. When the chain of events makes its way back here, the property is unchanged (because it's the same instance), but this view is out of sync. NotifyPropertyChanged will then update this view. diff --git a/Source/LibationWinForms/GridView/GridEntryBindingList.cs b/Source/LibationWinForms/GridView/GridEntryBindingList.cs index b5b10c5e..5cf68f66 100644 --- a/Source/LibationWinForms/GridView/GridEntryBindingList.cs +++ b/Source/LibationWinForms/GridView/GridEntryBindingList.cs @@ -24,7 +24,11 @@ namespace LibationWinForms.GridView internal class GridEntryBindingList : BindingList, IBindingListView { public GridEntryBindingList() : base(new List()) { } - public GridEntryBindingList(IEnumerable enumeration) : base(new List(enumeration)) { } + public GridEntryBindingList(IEnumerable enumeration) : base(new List(enumeration)) + { + SearchEngineCommands.SearchEngineUpdated += (_,_) => ApplyFilter(FilterString); + } + /// All items in the list, including those filtered out. public List AllItems() => Items.Concat(FilterRemoved).ToList();