mirror of
https://github.com/microsoft/PowerToys.git
synced 2024-12-14 03:37:10 +08:00
Open With Editor (#2261)
This commit is contained in:
parent
4b0532b072
commit
ab1efb0749
@ -7,8 +7,20 @@
|
||||
Loaded="View_Loaded"
|
||||
d:DesignHeight="300" d:DesignWidth="300">
|
||||
<Border BorderBrush="Gray" Margin="10" BorderThickness="1">
|
||||
<StackPanel>
|
||||
<CheckBox x:Name="UseLocationAsWorkingDir" Content="{DynamicResource wox_plugin_everything_use_location_as_working_dir}" Margin="10" HorizontalAlignment="Left" />
|
||||
</StackPanel>
|
||||
<Grid Margin="10" VerticalAlignment="Top" >
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"></ColumnDefinition>
|
||||
<ColumnDefinition Width="*"></ColumnDefinition>
|
||||
<ColumnDefinition Width="Auto"></ColumnDefinition>
|
||||
</Grid.ColumnDefinitions>
|
||||
<CheckBox Grid.Row="0" Grid.ColumnSpan="3" x:Name="UseLocationAsWorkingDir" Content="{DynamicResource wox_plugin_everything_use_location_as_working_dir}" Margin="10" HorizontalAlignment="Left" />
|
||||
<Label Grid.Row="1" Margin="10" Content="{DynamicResource wox_plugin_everything_editor_path}" HorizontalAlignment="Left"/>
|
||||
<Label Grid.Row="1" Grid.Column="1" x:Name="EditorPath" Margin="10" HorizontalAlignment="Stretch" />
|
||||
<Button Grid.Row="1" Grid.Column="2" x:Name="OpenEditorPath" Content="..." Margin="10" HorizontalAlignment="Right" Click="EditorPath_Clicked"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
</UserControl>
|
||||
|
@ -1,5 +1,6 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using Microsoft.Win32;
|
||||
|
||||
namespace Wox.Plugin.Everything
|
||||
{
|
||||
@ -26,6 +27,23 @@ namespace Wox.Plugin.Everything
|
||||
{
|
||||
_settings.UseLocationAsWorkingDir = false;
|
||||
};
|
||||
|
||||
EditorPath.Content = _settings.EditorPath;
|
||||
}
|
||||
|
||||
private void EditorPath_Clicked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
OpenFileDialog openFileDialog = new OpenFileDialog();
|
||||
openFileDialog.Filter = "Executable File(*.exe)| *.exe";
|
||||
if (!string.IsNullOrEmpty(_settings.EditorPath))
|
||||
openFileDialog.InitialDirectory = System.IO.Path.GetDirectoryName(_settings.EditorPath);
|
||||
|
||||
if (openFileDialog.ShowDialog() == true)
|
||||
{
|
||||
_settings.EditorPath = openFileDialog.FileName;
|
||||
}
|
||||
|
||||
EditorPath.Content = _settings.EditorPath;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7,6 +7,8 @@
|
||||
<system:String x:Key="wox_plugin_everything_copied">kopiert</system:String>
|
||||
<system:String x:Key="wox_plugin_everything_canot_start">Kann {0} nicht starten</system:String>
|
||||
<system:String x:Key="wox_plugin_everything_open_containing_folder">Öffne enthaltenden Ordner</system:String>
|
||||
<system:String x:Key="wox_plugin_everything_open_with_editor">Openen met {0}</system:String>
|
||||
<system:String x:Key="wox_plugin_everything_editor_path">Editor pad</system:String>
|
||||
|
||||
<system:String x:Key="wox_plugin_everything_plugin_name">Everything</system:String>
|
||||
<system:String x:Key="wox_plugin_everything_plugin_description">Suche Dateien mit Everything</system:String>
|
||||
|
@ -7,6 +7,8 @@
|
||||
<system:String x:Key="wox_plugin_everything_copied">Copied</system:String>
|
||||
<system:String x:Key="wox_plugin_everything_canot_start">Can’t start {0}</system:String>
|
||||
<system:String x:Key="wox_plugin_everything_open_containing_folder">Open parent folder</system:String>
|
||||
<system:String x:Key="wox_plugin_everything_open_with_editor">Open with {0}</system:String>
|
||||
<system:String x:Key="wox_plugin_everything_editor_path">Editor Path</system:String>
|
||||
|
||||
<system:String x:Key="wox_plugin_everything_plugin_name">Everything</system:String>
|
||||
<system:String x:Key="wox_plugin_everything_plugin_description">Search on-disk files using Everything</system:String>
|
||||
|
@ -7,6 +7,8 @@
|
||||
<system:String x:Key="wox_plugin_everything_copied">Skopiowano</system:String>
|
||||
<system:String x:Key="wox_plugin_everything_canot_start">Nie udało się uruchomić {0}</system:String>
|
||||
<system:String x:Key="wox_plugin_everything_open_containing_folder">Otwórz folder nadrzędny.</system:String>
|
||||
<system:String x:Key="wox_plugin_everything_open_with_editor">Otwórz za pomocą {0}</system:String>
|
||||
<system:String x:Key="wox_plugin_everything_editor_path">Ścieżka edytora</system:String>
|
||||
|
||||
<system:String x:Key="wox_plugin_everything_plugin_name">Everything</system:String>
|
||||
<system:String x:Key="wox_plugin_everything_plugin_description">Szukaj w plikach na dysku używając programu Everything</system:String>
|
||||
|
@ -7,6 +7,8 @@
|
||||
<system:String x:Key="wox_plugin_everything_copied">拷贝成功</system:String>
|
||||
<system:String x:Key="wox_plugin_everything_canot_start">不能启动 {0}</system:String>
|
||||
<system:String x:Key="wox_plugin_everything_open_containing_folder">打开所属文件夹</system:String>
|
||||
<system:String x:Key="wox_plugin_everything_open_with_editor">使用{0}打开</system:String>
|
||||
<system:String x:Key="wox_plugin_everything_editor_path">编辑器路径</system:String>
|
||||
|
||||
<system:String x:Key="wox_plugin_everything_plugin_name">Everything</system:String>
|
||||
<system:String x:Key="wox_plugin_everything_plugin_description">利用 Everything 搜索磁盘文件</system:String>
|
||||
|
@ -7,6 +7,8 @@
|
||||
<system:String x:Key="wox_plugin_everything_copied">複製成功</system:String>
|
||||
<system:String x:Key="wox_plugin_everything_canot_start">無法啟動 {0}</system:String>
|
||||
<system:String x:Key="wox_plugin_everything_open_containing_folder">開啟檔案位置</system:String>
|
||||
<system:String x:Key="wox_plugin_everything_open_with_editor">利用{0}啟動</system:String>
|
||||
<system:String x:Key="wox_plugin_everything_editor_path">編輯器路径</system:String>
|
||||
|
||||
<system:String x:Key="wox_plugin_everything_plugin_name">Everything</system:String>
|
||||
<system:String x:Key="wox_plugin_everything_plugin_description">利用 Everything 搜尋磁碟上的檔案</system:String>
|
||||
|
@ -126,6 +126,19 @@ namespace Wox.Plugin.Everything
|
||||
};
|
||||
|
||||
defaultContextMenus.Add(openFolderContextMenu);
|
||||
|
||||
string editorPath = string.IsNullOrEmpty(_settings.EditorPath) ? "notepad.exe" : _settings.EditorPath;
|
||||
|
||||
ContextMenu openWithEditorContextMenu = new ContextMenu
|
||||
{
|
||||
Name = string.Format(_context.API.GetTranslation("wox_plugin_everything_open_with_editor"), Path.GetFileNameWithoutExtension(editorPath)),
|
||||
Command = editorPath,
|
||||
Argument = " \"{path}\"",
|
||||
ImagePath = editorPath
|
||||
};
|
||||
|
||||
defaultContextMenus.Add(openWithEditorContextMenu);
|
||||
|
||||
return defaultContextMenus;
|
||||
}
|
||||
|
||||
|
@ -7,6 +7,8 @@ namespace Wox.Plugin.Everything
|
||||
{
|
||||
public class Settings
|
||||
{
|
||||
public string EditorPath { get; set; } = "";
|
||||
|
||||
public List<ContextMenu> ContextMenus = new List<ContextMenu>();
|
||||
|
||||
public int MaxSearchCount { get; set; } = 100;
|
||||
|
Loading…
Reference in New Issue
Block a user