diff --git a/src/Resources/Locales/en_US.xaml b/src/Resources/Locales/en_US.xaml index 648a03fb..eeefefa8 100644 --- a/src/Resources/Locales/en_US.xaml +++ b/src/Resources/Locales/en_US.xaml @@ -16,6 +16,7 @@ Optional. SELECT FOLDER NOTICE + Open With ... URL : Git Repository URL diff --git a/src/Resources/Locales/zh_CN.xaml b/src/Resources/Locales/zh_CN.xaml index e2eedd24..45d9b0ba 100644 --- a/src/Resources/Locales/zh_CN.xaml +++ b/src/Resources/Locales/zh_CN.xaml @@ -15,6 +15,7 @@ 选填 选择文件夹 系统提示 + 打开文件... 仓库地址 : 远程仓库地址 diff --git a/src/Views/Widgets/WorkingCopyChanges.xaml.cs b/src/Views/Widgets/WorkingCopyChanges.xaml.cs index b908602b..c2da06f5 100644 --- a/src/Views/Widgets/WorkingCopyChanges.xaml.cs +++ b/src/Views/Widgets/WorkingCopyChanges.xaml.cs @@ -3,12 +3,14 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Diagnostics; +using System.Drawing; using System.IO; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Input; using System.Windows.Media; +using System.Xml.Linq; namespace SourceGit.Views.Widgets { /// @@ -430,6 +432,18 @@ namespace SourceGit.Views.Widgets { e.Handled = true; }; + menu.Items.Add(explore); + + if (!node.IsFolder && File.Exists(path)) { + var openWith = new MenuItem(); + openWith.Header = App.Text("OpenWith"); + openWith.Click += (o, e) => { + Process.Start($"\"{path}\""); + e.Handled = true; + }; + menu.Items.Add(openWith); + } + var stage = new MenuItem(); stage.Header = App.Text("FileCM.Stage"); stage.Click += (o, e) => { @@ -481,7 +495,6 @@ namespace SourceGit.Views.Widgets { e.Handled = true; }; - menu.Items.Add(explore); menu.Items.Add(new Separator()); menu.Items.Add(stage); menu.Items.Add(discard); @@ -576,6 +589,18 @@ namespace SourceGit.Views.Widgets { e.Handled = true; }; + menu.Items.Add(explore); + + if (File.Exists(path)) { + var openWith = new MenuItem(); + openWith.Header = App.Text("OpenWith"); + openWith.Click += (o, e) => { + Process.Start($"\"{path}\""); + e.Handled = true; + }; + menu.Items.Add(openWith); + } + var stage = new MenuItem(); stage.Header = App.Text("FileCM.Stage"); stage.Click += (o, e) => { @@ -642,7 +667,6 @@ namespace SourceGit.Views.Widgets { e.Handled = true; }; - menu.Items.Add(explore); menu.Items.Add(new Separator()); menu.Items.Add(stage); menu.Items.Add(discard); @@ -738,6 +762,18 @@ namespace SourceGit.Views.Widgets { e.Handled = true; }; + menu.Items.Add(explore); + + if (!node.IsFolder && File.Exists(path)) { + var openWith = new MenuItem(); + openWith.Header = App.Text("OpenWith"); + openWith.Click += (o, e) => { + Process.Start($"\"{path}\""); + e.Handled = true; + }; + menu.Items.Add(openWith); + } + var unstage = new MenuItem(); unstage.Header = App.Text("FileCM.Unstage"); unstage.Click += (o, e) => { @@ -752,7 +788,6 @@ namespace SourceGit.Views.Widgets { e.Handled = true; }; - menu.Items.Add(explore); menu.Items.Add(unstage); menu.Items.Add(copyPath); } else { @@ -782,6 +817,18 @@ namespace SourceGit.Views.Widgets { e.Handled = true; }; + menu.Items.Add(explore); + + if (File.Exists(path)) { + var openWith = new MenuItem(); + openWith.Header = App.Text("OpenWith"); + openWith.Click += (o, e) => { + Process.Start($"\"{path}\""); + e.Handled = true; + }; + menu.Items.Add(openWith); + } + var unstage = new MenuItem(); unstage.Header = App.Text("FileCM.Unstage"); unstage.Click += (o, e) => { @@ -796,7 +843,6 @@ namespace SourceGit.Views.Widgets { e.Handled = true; }; - menu.Items.Add(explore); menu.Items.Add(new Separator()); menu.Items.Add(unstage); menu.Items.Add(new Separator());