ui(manager): improve search bindings

This commit is contained in:
2025-11-18 16:21:34 +01:00
parent 86f93cf3d7
commit 2cbe25e0f8
12 changed files with 89 additions and 52 deletions

View File

@@ -1,5 +1,9 @@
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Reactive;
using System.Reactive.Linq;
using System.Reactive.Subjects;
using DynamicData;
using PropertyChanged;
namespace ModpackUpdater.Apps.Manager.Ui.Models.UpdatesCollectorViewMode;
@@ -9,6 +13,10 @@ public class UpdatesCollectorViewModel : INotifyPropertyChanged
public event PropertyChangedEventHandler? PropertyChanged;
public ProgressInfos Progress { get; } = new();
public string? SearchText { get; set; }
public ObservableCollection<ModUpdateInfo> Updates { get; } = [];
public DynamicDataView<ModUpdateInfo> Updates { get; } = new(FilterUpdates);
private static Func<ModUpdateInfo, bool> FilterUpdates(string? searchText)
{
return n => string.IsNullOrWhiteSpace(searchText) || (n.Origin.Name != null && n.Origin.Name.Contains(searchText, StringComparison.InvariantCultureIgnoreCase));
}
}