refactor: rewrite workspace switcher (#1267)

Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
leo 2025-05-17 20:14:09 +08:00
parent bd553405c2
commit 4c1ba717a7
No known key found for this signature in database
10 changed files with 287 additions and 51 deletions

View file

@ -23,6 +23,12 @@ namespace SourceGit.ViewModels
private set;
}
public WorkspaceSwitcher WorkspaceSwitcher
{
get => _workspaceSwitcher;
set => SetProperty(ref _workspaceSwitcher, value);
}
public Workspace ActiveWorkspace
{
get => _activeWorkspace;
@ -130,8 +136,21 @@ namespace SourceGit.ViewModels
_ignoreIndexChange = false;
}
public void OpenWorkspaceSwitcher()
{
WorkspaceSwitcher = new WorkspaceSwitcher(this);
}
public void CancelWorkspaceSwitcher()
{
WorkspaceSwitcher = null;
}
public void SwitchWorkspace(Workspace to)
{
if (to.IsActive)
return;
foreach (var one in Pages)
{
if (!one.CanCreatePopup() || one.Data is Repository { IsAutoFetching: true })
@ -599,5 +618,6 @@ namespace SourceGit.ViewModels
private LauncherPage _activePage = null;
private bool _ignoreIndexChange = false;
private string _title = string.Empty;
private WorkspaceSwitcher _workspaceSwitcher = null;
}
}