mirror of
https://fastgit.cc/github.com/sourcegit-scm/sourcegit
synced 2026-04-26 03:40:45 +08:00
enhance: cleanup unused resources
Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
@@ -4,7 +4,7 @@ using CommunityToolkit.Mvvm.ComponentModel;
|
||||
|
||||
namespace SourceGit.ViewModels
|
||||
{
|
||||
public class WorkspaceSwitcher : ObservableObject
|
||||
public class WorkspaceSwitcher : ObservableObject, IDisposable
|
||||
{
|
||||
public List<Workspace> VisibleWorkspaces
|
||||
{
|
||||
@@ -41,12 +41,17 @@ namespace SourceGit.ViewModels
|
||||
|
||||
public void Switch()
|
||||
{
|
||||
if (_selectedWorkspace is { })
|
||||
_launcher.SwitchWorkspace(_selectedWorkspace);
|
||||
|
||||
_launcher.SwitchWorkspace(_selectedWorkspace);
|
||||
_launcher.CancelSwitcher();
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_visibleWorkspaces.Clear();
|
||||
_selectedWorkspace = null;
|
||||
_searchFilter = string.Empty;
|
||||
}
|
||||
|
||||
private void UpdateVisibleWorkspaces()
|
||||
{
|
||||
var visible = new List<Workspace>();
|
||||
|
||||
Reference in New Issue
Block a user