optimize<*>: use custom view locator instead of ContentControl.DataTemplates to avoid memory leak.

This commit is contained in:
leo 2024-03-02 22:45:14 +08:00
parent 27d4dd5f64
commit 60e664ab26
9 changed files with 77 additions and 62 deletions

View file

@ -8,9 +8,9 @@ namespace SourceGit.ViewModels {
set => SetProperty(ref _node, value);
}
public object View {
get => _view;
set => SetProperty(ref _view, value);
public object Data {
get => _data;
set => SetProperty(ref _data, value);
}
public AvaloniaList<Models.Notification> Notifications {
@ -25,12 +25,12 @@ namespace SourceGit.ViewModels {
Bookmark = 0,
IsRepository = false,
};
_view = new Views.Welcome() { DataContext = new Welcome() };
_data = new Welcome();
}
public LauncherPage(RepositoryNode node, Repository repo) {
_node = node;
_view = new Views.Repository() { DataContext = repo };
_data = repo;
}
public override string GetId() {
@ -48,6 +48,6 @@ namespace SourceGit.ViewModels {
}
private RepositoryNode _node = null;
private object _view = null;
private object _data = null;
}
}