mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-07 03:36:44 +02:00
reformat
This commit is contained in:
@@ -50,7 +50,7 @@ namespace Wox.Plugin.WebSearch
|
|||||||
SubTitle = string.Empty,
|
SubTitle = string.Empty,
|
||||||
IcoPath = searchSource.IconPath
|
IcoPath = searchSource.IconPath
|
||||||
};
|
};
|
||||||
return new List<Result> { result };
|
return new List<Result> {result};
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -127,7 +127,7 @@ namespace Wox.Plugin.WebSearch
|
|||||||
static Main()
|
static Main()
|
||||||
{
|
{
|
||||||
var plugins = Constant.Plugins;
|
var plugins = Constant.Plugins;
|
||||||
var assemblyName = typeof(Main).Assembly.GetName().Name;
|
var assemblyName = typeof (Main).Assembly.GetName().Name;
|
||||||
var pluginDirectory = Path.Combine(Constant.SettingsPath, plugins, assemblyName);
|
var pluginDirectory = Path.Combine(Constant.SettingsPath, plugins, assemblyName);
|
||||||
ImagesDirectory = Path.Combine(pluginDirectory, Images);
|
ImagesDirectory = Path.Combine(pluginDirectory, Images);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ namespace Wox.Plugin.WebSearch
|
|||||||
[NotNull]
|
[NotNull]
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
internal string IconPath => Path.Combine(Main.ImagesDirectory, Icon);
|
internal string IconPath => Path.Combine(Main.ImagesDirectory, Icon);
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public ImageSource Image => ImageLoader.Load(IconPath);
|
public ImageSource Image => ImageLoader.Load(IconPath);
|
||||||
|
|
||||||
|
|||||||
@@ -24,12 +24,14 @@
|
|||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<TextBlock Margin="10" FontSize="14" Grid.Row="0" Grid.Column="0" VerticalAlignment="Center"
|
<TextBlock Margin="10" FontSize="14" Grid.Row="0" Grid.Column="0" VerticalAlignment="Center"
|
||||||
HorizontalAlignment="Right" Text="{DynamicResource wox_plugin_websearch_title}" />
|
HorizontalAlignment="Right" Text="{DynamicResource wox_plugin_websearch_title}" />
|
||||||
<TextBox Text="{Binding SearchSource.Title}" Margin="10" Grid.Row="0" Width="300" Grid.Column="1" VerticalAlignment="Center"
|
<TextBox Text="{Binding SearchSource.Title}" Margin="10" Grid.Row="0" Width="300" Grid.Column="1"
|
||||||
|
VerticalAlignment="Center"
|
||||||
HorizontalAlignment="Left" />
|
HorizontalAlignment="Left" />
|
||||||
|
|
||||||
<TextBlock Margin="10" FontSize="14" Grid.Row="1" Grid.Column="0" VerticalAlignment="Center"
|
<TextBlock Margin="10" FontSize="14" Grid.Row="1" Grid.Column="0" VerticalAlignment="Center"
|
||||||
HorizontalAlignment="Right" Text="{DynamicResource wox_plugin_websearch_url}" />
|
HorizontalAlignment="Right" Text="{DynamicResource wox_plugin_websearch_url}" />
|
||||||
<TextBox Text="{Binding SearchSource.Url}" Margin="10" Grid.Row="1" Width="300" Grid.Column="1" VerticalAlignment="Center"
|
<TextBox Text="{Binding SearchSource.Url}" Margin="10" Grid.Row="1" Width="300" Grid.Column="1"
|
||||||
|
VerticalAlignment="Center"
|
||||||
HorizontalAlignment="Left" />
|
HorizontalAlignment="Left" />
|
||||||
|
|
||||||
<TextBlock Margin="10" FontSize="14" Grid.Row="2" Grid.Column="0" VerticalAlignment="Center"
|
<TextBlock Margin="10" FontSize="14" Grid.Row="2" Grid.Column="0" VerticalAlignment="Center"
|
||||||
@@ -39,21 +41,22 @@
|
|||||||
|
|
||||||
<TextBlock Margin="10" FontSize="14" Grid.Row="3" Grid.Column="0" VerticalAlignment="Center"
|
<TextBlock Margin="10" FontSize="14" Grid.Row="3" Grid.Column="0" VerticalAlignment="Center"
|
||||||
HorizontalAlignment="Right" Text="{DynamicResource wox_plugin_websearch_enable}" />
|
HorizontalAlignment="Right" Text="{DynamicResource wox_plugin_websearch_enable}" />
|
||||||
<CheckBox IsChecked="{Binding SearchSource.Enabled}" Margin="10" Grid.Row="3" Grid.Column="1" VerticalAlignment="Center" />
|
<CheckBox IsChecked="{Binding SearchSource.Enabled}" Margin="10" Grid.Row="3" Grid.Column="1"
|
||||||
|
VerticalAlignment="Center" />
|
||||||
|
|
||||||
<TextBlock Margin="10" FontSize="14" Grid.Row="4" Grid.Column="0" VerticalAlignment="Center"
|
<TextBlock Margin="10" FontSize="14" Grid.Row="4" Grid.Column="0" VerticalAlignment="Center"
|
||||||
HorizontalAlignment="Right" Text="{DynamicResource wox_plugin_websearch_icon}" />
|
HorizontalAlignment="Right" Text="{DynamicResource wox_plugin_websearch_icon}" />
|
||||||
<StackPanel Orientation="Horizontal" Grid.Row="4" Grid.Column="1" Margin="10">
|
<StackPanel Orientation="Horizontal" Grid.Row="4" Grid.Column="1" Margin="10">
|
||||||
<Image Source="{Binding SearchSource.Image ,IsAsync=True}" Width="24" Height="24" Margin="0 0 10 0" />
|
<Image Source="{Binding SearchSource.Image ,IsAsync=True}" Width="24" Height="24" Margin="0 0 10 0" />
|
||||||
<Button Click="OnSelectIconClick" Height="24"
|
<Button Click="OnSelectIconClick" Height="24"
|
||||||
Content="{DynamicResource wox_plugin_websearch_select_icon}" />
|
Content="{DynamicResource wox_plugin_websearch_select_icon}" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Grid.Row="5" Grid.Column="1">
|
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Grid.Row="5" Grid.Column="1">
|
||||||
<Button Click="OnCancelButtonClick"
|
<Button Click="OnCancelButtonClick"
|
||||||
Margin="10 0 10 0" Width="80" Height="25"
|
Margin="10 0 10 0" Width="80" Height="25"
|
||||||
Content="{DynamicResource wox_plugin_websearch_cancel}" />
|
Content="{DynamicResource wox_plugin_websearch_cancel}" />
|
||||||
<Button Click="OnConfirmButtonClick"
|
<Button Click="OnConfirmButtonClick"
|
||||||
Margin="10 0 10 0" Width="80" Height="25"
|
Margin="10 0 10 0" Width="80" Height="25"
|
||||||
Content="{DynamicResource wox_plugin_websearch_confirm}" />
|
Content="{DynamicResource wox_plugin_websearch_confirm}" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|||||||
@@ -20,13 +20,13 @@ namespace Wox.Plugin.WebSearch
|
|||||||
public SearchSourceSettingWindow(IList<SearchSource> sources, PluginInitContext context, SearchSource old)
|
public SearchSourceSettingWindow(IList<SearchSource> sources, PluginInitContext context, SearchSource old)
|
||||||
{
|
{
|
||||||
_oldSearchSource = old;
|
_oldSearchSource = old;
|
||||||
_viewModel = new SearchSourceViewModel { SearchSource = old.DeepCopy() };
|
_viewModel = new SearchSourceViewModel {SearchSource = old.DeepCopy()};
|
||||||
Initilize(sources, context, Action.Edit);
|
Initilize(sources, context, Action.Edit);
|
||||||
}
|
}
|
||||||
|
|
||||||
public SearchSourceSettingWindow(IList<SearchSource> sources, PluginInitContext context)
|
public SearchSourceSettingWindow(IList<SearchSource> sources, PluginInitContext context)
|
||||||
{
|
{
|
||||||
_viewModel = new SearchSourceViewModel { SearchSource = new SearchSource() };
|
_viewModel = new SearchSourceViewModel {SearchSource = new SearchSource()};
|
||||||
Initilize(sources, context, Action.Add);
|
Initilize(sources, context, Action.Add);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -48,7 +48,6 @@ namespace Wox.Plugin.WebSearch
|
|||||||
|
|
||||||
private void OnConfirmButtonClick(object sender, RoutedEventArgs e)
|
private void OnConfirmButtonClick(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(_searchSource.Title))
|
if (string.IsNullOrEmpty(_searchSource.Title))
|
||||||
{
|
{
|
||||||
var warning = _api.GetTranslation("wox_plugin_websearch_input_title");
|
var warning = _api.GetTranslation("wox_plugin_websearch_input_title");
|
||||||
@@ -123,7 +122,7 @@ namespace Wox.Plugin.WebSearch
|
|||||||
{
|
{
|
||||||
var directory = Path.Combine(Main.ImagesDirectory, Main.Images);
|
var directory = Path.Combine(Main.ImagesDirectory, Main.Images);
|
||||||
const string filter = "Image files (*.jpg, *.jpeg, *.gif, *.png, *.bmp) |*.jpg; *.jpeg; *.gif; *.png; *.bmp";
|
const string filter = "Image files (*.jpg, *.jpeg, *.gif, *.png, *.bmp) |*.jpg; *.jpeg; *.gif; *.png; *.bmp";
|
||||||
var dialog = new OpenFileDialog { InitialDirectory = directory, Filter = filter };
|
var dialog = new OpenFileDialog {InitialDirectory = directory, Filter = filter};
|
||||||
|
|
||||||
var result = dialog.ShowDialog();
|
var result = dialog.ShowDialog();
|
||||||
if (result == true)
|
if (result == true)
|
||||||
|
|||||||
@@ -4,4 +4,4 @@
|
|||||||
{
|
{
|
||||||
public SearchSource SearchSource { get; set; }
|
public SearchSource SearchSource { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -15,177 +15,178 @@ namespace Wox.Plugin.WebSearch
|
|||||||
SelectedSearchSource = SearchSources[0];
|
SelectedSearchSource = SearchSources[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ObservableCollection<SearchSource> SearchSources { get; set; } = new ObservableCollection<SearchSource>
|
public ObservableCollection<SearchSource> SearchSources { get; set; } = new ObservableCollection<SearchSource>
|
||||||
|
{
|
||||||
|
new SearchSource
|
||||||
{
|
{
|
||||||
new SearchSource
|
Title = "Google",
|
||||||
{
|
ActionKeyword = "g",
|
||||||
Title = "Google",
|
Icon = "google.png",
|
||||||
ActionKeyword = "g",
|
Url = "https://www.google.com/search?q={q}",
|
||||||
Icon = "google.png",
|
Enabled = true
|
||||||
Url = "https://www.google.com/search?q={q}",
|
},
|
||||||
Enabled = true
|
new SearchSource
|
||||||
},
|
{
|
||||||
new SearchSource
|
Title = "Google Scholar",
|
||||||
{
|
ActionKeyword = "sc",
|
||||||
Title = "Google Scholar",
|
Icon = "google.png",
|
||||||
ActionKeyword = "sc",
|
Url = "https://scholar.google.com/scholar?q={q}",
|
||||||
Icon = "google.png",
|
Enabled = true
|
||||||
Url = "https://scholar.google.com/scholar?q={q}",
|
},
|
||||||
Enabled = true
|
new SearchSource
|
||||||
},
|
{
|
||||||
new SearchSource
|
Title = "Wikipedia",
|
||||||
{
|
ActionKeyword = "wiki",
|
||||||
Title = "Wikipedia",
|
Icon = "wiki.png",
|
||||||
ActionKeyword = "wiki",
|
Url = "https://en.wikipedia.org/wiki/{q}",
|
||||||
Icon = "wiki.png",
|
Enabled = true
|
||||||
Url = "https://en.wikipedia.org/wiki/{q}",
|
},
|
||||||
Enabled = true
|
new SearchSource
|
||||||
},
|
{
|
||||||
new SearchSource
|
Title = "FindIcon",
|
||||||
{
|
ActionKeyword = "findicon",
|
||||||
Title = "FindIcon",
|
Icon = "pictures.png",
|
||||||
ActionKeyword = "findicon",
|
Url = "http://findicons.com/search/{q}",
|
||||||
Icon = "pictures.png",
|
Enabled = true
|
||||||
Url = "http://findicons.com/search/{q}",
|
},
|
||||||
Enabled = true
|
new SearchSource
|
||||||
},
|
{
|
||||||
new SearchSource
|
Title = "Facebook",
|
||||||
{
|
ActionKeyword = "facebook",
|
||||||
Title = "Facebook",
|
Icon = "facebook.png",
|
||||||
ActionKeyword = "facebook",
|
Url = "https://www.facebook.com/search/?q={q}",
|
||||||
Icon = "facebook.png",
|
Enabled = true
|
||||||
Url = "https://www.facebook.com/search/?q={q}",
|
},
|
||||||
Enabled = true
|
new SearchSource
|
||||||
},
|
{
|
||||||
new SearchSource
|
Title = "Twitter",
|
||||||
{
|
ActionKeyword = "twitter",
|
||||||
Title = "Twitter",
|
Icon = "twitter.png",
|
||||||
ActionKeyword = "twitter",
|
Url = "https://twitter.com/search?q={q}",
|
||||||
Icon = "twitter.png",
|
Enabled = true
|
||||||
Url = "https://twitter.com/search?q={q}",
|
},
|
||||||
Enabled = true
|
new SearchSource
|
||||||
},
|
{
|
||||||
new SearchSource
|
Title = "Google Maps",
|
||||||
{
|
ActionKeyword = "maps",
|
||||||
Title = "Google Maps",
|
Icon = "google_maps.png",
|
||||||
ActionKeyword = "maps",
|
Url = "https://maps.google.com/maps?q={q}",
|
||||||
Icon = "google_maps.png",
|
Enabled = true
|
||||||
Url = "https://maps.google.com/maps?q={q}",
|
},
|
||||||
Enabled = true
|
new SearchSource
|
||||||
},
|
{
|
||||||
new SearchSource
|
Title = "Google Translate",
|
||||||
{
|
ActionKeyword = "translate",
|
||||||
Title = "Google Translate",
|
Icon = "google_translate.png",
|
||||||
ActionKeyword = "translate",
|
Url = "https://translate.google.com/#auto|en|{q}",
|
||||||
Icon = "google_translate.png",
|
Enabled = true
|
||||||
Url = "https://translate.google.com/#auto|en|{q}",
|
},
|
||||||
Enabled = true
|
new SearchSource
|
||||||
},
|
{
|
||||||
new SearchSource
|
Title = "Duckduckgo",
|
||||||
{
|
ActionKeyword = "duckduckgo",
|
||||||
Title = "Duckduckgo",
|
Icon = "duckduckgo.png",
|
||||||
ActionKeyword = "duckduckgo",
|
Url = "https://duckduckgo.com/?q={q}",
|
||||||
Icon = "duckduckgo.png",
|
Enabled = true
|
||||||
Url = "https://duckduckgo.com/?q={q}",
|
},
|
||||||
Enabled = true
|
new SearchSource
|
||||||
},
|
{
|
||||||
new SearchSource
|
Title = "Github",
|
||||||
{
|
ActionKeyword = "github",
|
||||||
Title = "Github",
|
Icon = "github.png",
|
||||||
ActionKeyword = "github",
|
Url = "https://github.com/search?q={q}",
|
||||||
Icon = "github.png",
|
Enabled = true
|
||||||
Url = "https://github.com/search?q={q}",
|
},
|
||||||
Enabled = true
|
new SearchSource
|
||||||
},
|
{
|
||||||
new SearchSource
|
Title = "Github Gist",
|
||||||
{
|
ActionKeyword = "gist",
|
||||||
Title = "Github Gist",
|
Icon = "gist.png",
|
||||||
ActionKeyword = "gist",
|
Url = "https://gist.github.com/search?q={q}",
|
||||||
Icon = "gist.png",
|
Enabled = true
|
||||||
Url = "https://gist.github.com/search?q={q}",
|
},
|
||||||
Enabled = true
|
new SearchSource
|
||||||
},
|
{
|
||||||
new SearchSource
|
Title = "Gmail",
|
||||||
{
|
ActionKeyword = "gmail",
|
||||||
Title = "Gmail",
|
Icon = "gmail.png",
|
||||||
ActionKeyword = "gmail",
|
Url = "https://mail.google.com/mail/ca/u/0/#apps/{q}",
|
||||||
Icon = "gmail.png",
|
Enabled = true
|
||||||
Url = "https://mail.google.com/mail/ca/u/0/#apps/{q}",
|
},
|
||||||
Enabled = true
|
new SearchSource
|
||||||
},
|
{
|
||||||
new SearchSource
|
Title = "Google Drive",
|
||||||
{
|
ActionKeyword = "drive",
|
||||||
Title = "Google Drive",
|
Icon = "google_drive.png",
|
||||||
ActionKeyword = "drive",
|
Url = "https://drive.google.com/?hl=en&tab=bo#search/{q}",
|
||||||
Icon = "google_drive.png",
|
Enabled = true
|
||||||
Url = "https://drive.google.com/?hl=en&tab=bo#search/{q}",
|
},
|
||||||
Enabled = true
|
new SearchSource
|
||||||
},
|
{
|
||||||
new SearchSource
|
Title = "Wolframalpha",
|
||||||
{
|
ActionKeyword = "wolframalpha",
|
||||||
Title = "Wolframalpha",
|
Icon = "wolframalpha.png",
|
||||||
ActionKeyword = "wolframalpha",
|
Url = "https://www.wolframalpha.com/input/?i={q}",
|
||||||
Icon = "wolframalpha.png",
|
Enabled = true
|
||||||
Url = "https://www.wolframalpha.com/input/?i={q}",
|
},
|
||||||
Enabled = true
|
new SearchSource
|
||||||
},
|
{
|
||||||
new SearchSource
|
Title = "Stackoverflow",
|
||||||
{
|
ActionKeyword = "stackoverflow",
|
||||||
Title = "Stackoverflow",
|
Icon = "stackoverflow.png",
|
||||||
ActionKeyword = "stackoverflow",
|
Url = "https://stackoverflow.com/search?q={q}",
|
||||||
Icon = "stackoverflow.png",
|
Enabled = true
|
||||||
Url = "https://stackoverflow.com/search?q={q}",
|
},
|
||||||
Enabled = true
|
new SearchSource
|
||||||
},
|
{
|
||||||
new SearchSource
|
Title = "I'm Feeling Lucky",
|
||||||
{
|
ActionKeyword = "lucky",
|
||||||
Title = "I'm Feeling Lucky",
|
Icon = "google.png",
|
||||||
ActionKeyword = "lucky",
|
Url = "https://google.com/search?q={q}&btnI=I",
|
||||||
Icon = "google.png",
|
Enabled = true
|
||||||
Url = "https://google.com/search?q={q}&btnI=I",
|
},
|
||||||
Enabled = true
|
new SearchSource
|
||||||
},
|
{
|
||||||
new SearchSource
|
Title = "Google Image",
|
||||||
{
|
ActionKeyword = "image",
|
||||||
Title = "Google Image",
|
Icon = "google.png",
|
||||||
ActionKeyword = "image",
|
Url = "https://www.google.com/search?q={q}&tbm=isch",
|
||||||
Icon = "google.png",
|
Enabled = true
|
||||||
Url = "https://www.google.com/search?q={q}&tbm=isch",
|
},
|
||||||
Enabled = true
|
new SearchSource
|
||||||
},
|
{
|
||||||
new SearchSource
|
Title = "Youtube",
|
||||||
{
|
ActionKeyword = "youtube",
|
||||||
Title = "Youtube",
|
Icon = "youtube.png",
|
||||||
ActionKeyword = "youtube",
|
Url = "https://www.youtube.com/results?search_query={q}",
|
||||||
Icon = "youtube.png",
|
Enabled = true
|
||||||
Url = "https://www.youtube.com/results?search_query={q}",
|
},
|
||||||
Enabled = true
|
new SearchSource
|
||||||
},
|
{
|
||||||
new SearchSource
|
Title = "Bing",
|
||||||
{
|
ActionKeyword = "bing",
|
||||||
Title = "Bing",
|
Icon = "bing.png",
|
||||||
ActionKeyword = "bing",
|
Url = "https://www.bing.com/search?q={q}",
|
||||||
Icon = "bing.png",
|
Enabled = true
|
||||||
Url = "https://www.bing.com/search?q={q}",
|
},
|
||||||
Enabled = true
|
new SearchSource
|
||||||
},
|
{
|
||||||
new SearchSource
|
Title = "Yahoo",
|
||||||
{
|
ActionKeyword = "yahoo",
|
||||||
Title = "Yahoo",
|
Icon = "yahoo.png",
|
||||||
ActionKeyword = "yahoo",
|
Url = "https://www.search.yahoo.com/search?p={q}",
|
||||||
Icon = "yahoo.png",
|
Enabled = true
|
||||||
Url = "https://www.search.yahoo.com/search?p={q}",
|
},
|
||||||
Enabled = true
|
new SearchSource
|
||||||
},
|
{
|
||||||
new SearchSource
|
Title = "Baidu",
|
||||||
{
|
ActionKeyword = "bd",
|
||||||
Title = "Baidu",
|
Icon = "baidu.png",
|
||||||
ActionKeyword = "bd",
|
Url = "https://www.baidu.com/#ie=UTF-8&wd={q}",
|
||||||
Icon = "baidu.png",
|
Enabled = true
|
||||||
Url = "https://www.baidu.com/#ie=UTF-8&wd={q}",
|
}
|
||||||
Enabled = true
|
};
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public SearchSource SelectedSearchSource { get; set; }
|
public SearchSource SelectedSearchSource { get; set; }
|
||||||
@@ -206,10 +207,7 @@ namespace Wox.Plugin.WebSearch
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string Suggestion
|
public string Suggestion
|
||||||
{
|
{
|
||||||
get
|
get { return SelectedSuggestion.ToString(); }
|
||||||
{
|
|
||||||
return SelectedSuggestion.ToString();
|
|
||||||
}
|
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
foreach (var s in Suggestions)
|
foreach (var s in Suggestions)
|
||||||
@@ -221,6 +219,5 @@ namespace Wox.Plugin.WebSearch
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -45,9 +45,9 @@ namespace Wox.Plugin.WebSearch
|
|||||||
{
|
{
|
||||||
var selected = _settings.SelectedSearchSource;
|
var selected = _settings.SelectedSearchSource;
|
||||||
var webSearch = new SearchSourceSettingWindow
|
var webSearch = new SearchSourceSettingWindow
|
||||||
(
|
(
|
||||||
_settings.SearchSources, _context, selected
|
_settings.SearchSources, _context, selected
|
||||||
);
|
);
|
||||||
webSearch.ShowDialog();
|
webSearch.ShowDialog();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user