diff --git a/src/Resources/Locales/en_US.xaml b/src/Resources/Locales/en_US.xaml
index 9c7672b0..df714d9b 100644
--- a/src/Resources/Locales/en_US.xaml
+++ b/src/Resources/Locales/en_US.xaml
@@ -116,7 +116,6 @@
Tag Message :
Optional.
- Open
Open In File Browser
Open In Visual Studio Code
Open In Git Bash
diff --git a/src/Resources/Locales/zh_CN.xaml b/src/Resources/Locales/zh_CN.xaml
index adda3cbd..38f71cde 100644
--- a/src/Resources/Locales/zh_CN.xaml
+++ b/src/Resources/Locales/zh_CN.xaml
@@ -115,7 +115,6 @@
标签描述 :
选填
- 打开
在文件浏览器中打开
在Visual Studio Code中打开
在GIT终端中打开
diff --git a/src/Views/Widgets/Dashboard.xaml b/src/Views/Widgets/Dashboard.xaml
index a3f62bf8..da779d87 100644
--- a/src/Views/Widgets/Dashboard.xaml
+++ b/src/Views/Widgets/Dashboard.xaml
@@ -33,15 +33,23 @@
+ Icon="{DynamicResource Icon.Folder.Open}"
+ ToolTip="{DynamicResource Text.Dashboard.Explore}"
+ Click="OpenInExplorer"/>
+
+ Icon="{DynamicResource Icon.Terminal}"
+ ToolTip="{DynamicResource Text.Dashboard.Terminal}"
+ Click="OpenInTerminal"/>
@@ -93,14 +101,22 @@
-
+
+
+ {
+ var vscode = Models.ExecutableFinder.Find("code.cmd");
+ if (vscode != null) Dispatcher.Invoke(() => btnVSCode.Visibility = Visibility.Visible);
+ });
+
var watcher = Models.Watcher.Get(repo.Path);
watcher.Navigate += NavigateTo;
watcher.BranchChanged += UpdateBranches;
@@ -304,86 +309,44 @@ namespace SourceGit.Views.Widgets {
#endregion
#region TOOLBAR_COMMANDS
- private MenuItem CreateMenuItem(string icon, string header, Action click) {
- var ret = new MenuItem();
- ret.Header = App.Text(header);
- ret.Click += (o, e) => {
- click();
- e.Handled = true;
- };
-
- if (!string.IsNullOrEmpty(icon)) {
- var geo = new System.Windows.Shapes.Path();
- geo.Data = FindResource(icon) as Geometry;
- geo.VerticalAlignment = VerticalAlignment.Center;
- geo.Width = 12;
- geo.Height = 12;
-
- ret.Icon = geo;
- }
-
- return ret;
+ private void OpenInExplorer(object sender, RoutedEventArgs e) {
+ Process.Start("explorer", repo.Path);
}
- private void OpenExternal(object sender, RoutedEventArgs e) {
- var btn = sender as Controls.IconButton;
- if (btn == null) return;
-
- if (btn.ContextMenu != null) {
- btn.ContextMenu.IsOpen = true;
- e.Handled = true;
+ private void OpenInTerminal(object sender, RoutedEventArgs e) {
+ var bash = Path.Combine(Models.Preference.Instance.Git.Path, "..", "bash.exe");
+ if (!File.Exists(bash)) {
+ Models.Exception.Raise(App.Text("MissingBash"));
return;
}
- var menu = new ContextMenu();
- menu.PlacementTarget = btn;
- menu.Placement = PlacementMode.Bottom;
- menu.StaysOpen = false;
- menu.Focusable = true;
-
- menu.Items.Add(CreateMenuItem("Icon.Folder.Open", "Dashboard.Explore", () => {
- Process.Start("explorer", repo.Path);
- }));
-
- menu.Items.Add(CreateMenuItem("Icon.Terminal", "Dashboard.Terminal", () => {
- var bash = Path.Combine(Models.Preference.Instance.Git.Path, "..", "bash.exe");
- if (!File.Exists(bash)) {
- Models.Exception.Raise(App.Text("MissingBash"));
- return;
- }
-
- if (Models.Preference.Instance.General.UseWindowsTerminal) {
- Process.Start(new ProcessStartInfo {
- WorkingDirectory = repo.Path,
- FileName = "wt",
- Arguments = $"-d \"{repo.Path}\" \"{bash}\"",
- UseShellExecute = false,
- });
- } else {
- Process.Start(new ProcessStartInfo {
- WorkingDirectory = repo.Path,
- FileName = bash,
- UseShellExecute = true,
- });
- }
- }));
-
- var vscode = Models.ExecutableFinder.Find("code.cmd");
- if (vscode != null) {
- vscode = Path.Combine(Path.GetDirectoryName(vscode), "..", "Code.exe");
- menu.Items.Add(CreateMenuItem("Icon.VSCode", "Dashboard.VSCode", () => {
- Process.Start(new ProcessStartInfo {
- WorkingDirectory = repo.Path,
- FileName = vscode,
- Arguments = $"\"{repo.Path}\"",
- UseShellExecute = false,
- });
- }));
+ if (Models.Preference.Instance.General.UseWindowsTerminal) {
+ Process.Start(new ProcessStartInfo {
+ WorkingDirectory = repo.Path,
+ FileName = "wt",
+ Arguments = $"-d \"{repo.Path}\" \"{bash}\"",
+ UseShellExecute = false,
+ });
+ } else {
+ Process.Start(new ProcessStartInfo {
+ WorkingDirectory = repo.Path,
+ FileName = bash,
+ UseShellExecute = true,
+ });
}
+ }
- btn.ContextMenu = menu;
- menu.IsOpen = true;
- e.Handled = true;
+ private void OpenInVSCode(object sender, RoutedEventArgs e) {
+ var vscode = Models.ExecutableFinder.Find("code.cmd");
+ if (vscode == null) return;
+
+ vscode = Path.Combine(Path.GetDirectoryName(vscode), "..", "Code.exe");
+ Process.Start(new ProcessStartInfo {
+ WorkingDirectory = repo.Path,
+ FileName = vscode,
+ Arguments = $"\"{repo.Path}\"",
+ UseShellExecute = false,
+ });
}
private void TriggerRefresh(object sender, RoutedEventArgs e) {