diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml
index 63c9815d..a9114e21 100644
--- a/src/Resources/Locales/en_US.axaml
+++ b/src/Resources/Locales/en_US.axaml
@@ -386,8 +386,7 @@
Go to previous page
Create new page
Open Preferences dialog
- Open Workspaces dialog
- Switch to corresponding workspace
+ Switch to corresponding workspace
REPOSITORY
Commit staged changes
Commit and push staged changes
diff --git a/src/Resources/Locales/zh_CN.axaml b/src/Resources/Locales/zh_CN.axaml
index 56227607..d196906f 100644
--- a/src/Resources/Locales/zh_CN.axaml
+++ b/src/Resources/Locales/zh_CN.axaml
@@ -390,6 +390,7 @@
切换到上一个页面
新建页面
打开偏好设置面板
+ 切换工作区
仓库页面快捷键
提交暂存区更改
提交暂存区更改并推送
diff --git a/src/Resources/Locales/zh_TW.axaml b/src/Resources/Locales/zh_TW.axaml
index 204e1cf7..09b11406 100644
--- a/src/Resources/Locales/zh_TW.axaml
+++ b/src/Resources/Locales/zh_TW.axaml
@@ -390,6 +390,7 @@
切換到上一個頁面
新增頁面
開啟偏好設定面板
+ 切換工作區
存放庫頁面快速鍵
提交暫存區變更
提交暫存區變更並推送
diff --git a/src/ViewModels/Launcher.cs b/src/ViewModels/Launcher.cs
index 5eaca763..420d7af9 100644
--- a/src/ViewModels/Launcher.cs
+++ b/src/ViewModels/Launcher.cs
@@ -130,6 +130,66 @@ namespace SourceGit.ViewModels
_ignoreIndexChange = false;
}
+ public void SwitchWorkspace(Workspace to)
+ {
+ foreach (var one in Pages)
+ {
+ if (!one.CanCreatePopup() || one.Data is Repository { IsAutoFetching: true })
+ {
+ App.RaiseException(null, "You have unfinished task(s) in opened pages. Please wait!!!");
+ return;
+ }
+ }
+
+ _ignoreIndexChange = true;
+
+ var pref = Preferences.Instance;
+ foreach (var w in pref.Workspaces)
+ w.IsActive = false;
+
+ ActiveWorkspace = to;
+ to.IsActive = true;
+
+ foreach (var one in Pages)
+ CloseRepositoryInTab(one, false);
+
+ Pages.Clear();
+ AddNewTab();
+
+ var repos = to.Repositories.ToArray();
+ foreach (var repo in repos)
+ {
+ var node = pref.FindNode(repo);
+ if (node == null)
+ {
+ node = new RepositoryNode()
+ {
+ Id = repo,
+ Name = Path.GetFileName(repo),
+ Bookmark = 0,
+ IsRepository = true,
+ };
+ }
+
+ OpenRepositoryInTab(node, null);
+ }
+
+ var activeIdx = to.ActiveIdx;
+ if (activeIdx >= 0 && activeIdx < Pages.Count)
+ {
+ ActivePage = Pages[activeIdx];
+ }
+ else
+ {
+ ActivePage = Pages[0];
+ to.ActiveIdx = 0;
+ }
+
+ _ignoreIndexChange = false;
+ Preferences.Instance.Save();
+ GC.Collect();
+ }
+
public void AddNewTab()
{
var page = new LauncherPage();
@@ -463,14 +523,6 @@ namespace SourceGit.ViewModels
return menu;
}
- public void SwitchWorkspace(int idx)
- {
- var pref = Preferences.Instance;
- if (idx >= pref.Workspaces.Count || pref.Workspaces[idx].IsActive) return;
-
- SwitchWorkspace(pref.Workspaces[idx]);
- }
-
private string GetRepositoryGitDir(string repo)
{
var fullpath = Path.Combine(repo, ".git");
@@ -501,66 +553,6 @@ namespace SourceGit.ViewModels
return new Commands.QueryGitDir(repo).Result();
}
-
- private void SwitchWorkspace(Workspace to)
- {
- foreach (var one in Pages)
- {
- if (!one.CanCreatePopup() || one.Data is Repository { IsAutoFetching: true })
- {
- App.RaiseException(null, "You have unfinished task(s) in opened pages. Please wait!!!");
- return;
- }
- }
-
- _ignoreIndexChange = true;
-
- var pref = Preferences.Instance;
- foreach (var w in pref.Workspaces)
- w.IsActive = false;
-
- ActiveWorkspace = to;
- to.IsActive = true;
-
- foreach (var one in Pages)
- CloseRepositoryInTab(one, false);
-
- Pages.Clear();
- AddNewTab();
-
- var repos = to.Repositories.ToArray();
- foreach (var repo in repos)
- {
- var node = pref.FindNode(repo);
- if (node == null)
- {
- node = new RepositoryNode()
- {
- Id = repo,
- Name = Path.GetFileName(repo),
- Bookmark = 0,
- IsRepository = true,
- };
- }
-
- OpenRepositoryInTab(node, null);
- }
-
- var activeIdx = to.ActiveIdx;
- if (activeIdx >= 0 && activeIdx < Pages.Count)
- {
- ActivePage = Pages[activeIdx];
- }
- else
- {
- ActivePage = Pages[0];
- to.ActiveIdx = 0;
- }
-
- _ignoreIndexChange = false;
- Preferences.Instance.Save();
- GC.Collect();
- }
private void CloseRepositoryInTab(LauncherPage page, bool removeFromWorkspace = true)
{
@@ -581,7 +573,7 @@ namespace SourceGit.ViewModels
return;
var workspace = _activeWorkspace.Name;
- if (_activePage is { Data: Repository repo })
+ if (_activePage is { Data: Repository })
{
var node = _activePage.Node;
var name = node.Name;
diff --git a/src/Views/Avatar.cs b/src/Views/Avatar.cs
index 87bc7ce3..5dacac69 100644
--- a/src/Views/Avatar.cs
+++ b/src/Views/Avatar.cs
@@ -78,10 +78,10 @@ namespace SourceGit.Views
if (switches[idx])
context.FillRectangle(brush, new Rect(x, y, stepX, stepY));
- if (switches[idx+1])
+ if (switches[idx + 1])
context.FillRectangle(brush, new Rect(x + stepX, y, stepX, stepY));
- if (switches[idx+2])
+ if (switches[idx + 2])
context.FillRectangle(brush, new Rect(x + stepX * 2, y, stepX, stepY));
}
@@ -94,7 +94,7 @@ namespace SourceGit.Views
if (switches[idx])
context.FillRectangle(brush, new Rect(x, y, stepX, stepY));
- if (switches[idx-1])
+ if (switches[idx - 1])
context.FillRectangle(brush, new Rect(x + stepX, y, stepX, stepY));
}
}
diff --git a/src/Views/Hotkeys.axaml b/src/Views/Hotkeys.axaml
index b1d436a4..e64ab1e3 100644
--- a/src/Views/Hotkeys.axaml
+++ b/src/Views/Hotkeys.axaml
@@ -45,7 +45,7 @@
FontSize="{Binding Source={x:Static vm:Preferences.Instance}, Path=DefaultFontSize, Converter={x:Static c:DoubleConverters.Increase}}"
Margin="0,0,0,8"/>
-
+
@@ -70,11 +70,8 @@
-
-
-
-
-
+
+
-