enhance: make search filter launcher page specific

This commit is contained in:
Aikawa Yataro 2024-08-25 03:52:41 +00:00
parent 118dccbeb5
commit eb139988e9
No known key found for this signature in database
GPG key ID: 1C5D95FB10179404
2 changed files with 19 additions and 1 deletions

View file

@ -22,8 +22,11 @@ namespace SourceGit.ViewModels
get => _activePage;
set
{
if (SetProperty(ref _activePage, value))
var old = _activePage;
if (SetProperty(ref _activePage, value)) {
PopupHost.Active = value;
UpdateSearchFilter(old, value);
}
}
}
@ -379,6 +382,14 @@ namespace SourceGit.ViewModels
page.Data = null;
}
private static void UpdateSearchFilter(LauncherPage oldPage, LauncherPage newPage) {
if (oldPage != null) {
oldPage.SearchFilter = Welcome.Instance.SearchFilter;
}
Welcome.Instance.SearchFilter = newPage.SearchFilter;
}
private LauncherPage _activePage = null;
}
}

View file

@ -24,6 +24,12 @@ namespace SourceGit.ViewModels
set;
} = new AvaloniaList<Models.Notification>();
public string SearchFilter
{
get => _searchFilter;
set => SetProperty(ref _searchFilter, value);
}
public LauncherPage()
{
_node = new RepositoryNode() { Id = Guid.NewGuid().ToString() };
@ -49,5 +55,6 @@ namespace SourceGit.ViewModels
private RepositoryNode _node = null;
private object _data = null;
private string _searchFilter = string.Empty;
}
}