mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-07 11:46:30 +02:00
Add shared commands and move to shared
This commit is contained in:
@@ -1,27 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace Wox.Plugin.WebSearch.Commands
|
|
||||||
{
|
|
||||||
internal static class SearchWeb
|
|
||||||
{
|
|
||||||
/// <summary> Opens search in a new browser. If no browser path is passed in then Chrome is used.
|
|
||||||
/// Leave browser path blank to use Chrome.
|
|
||||||
/// </summary>
|
|
||||||
internal static void NewBrowserWindow(this string url, string browserPath)
|
|
||||||
{
|
|
||||||
var browserExecutableName = browserPath?
|
|
||||||
.Split(new[] { Path.DirectorySeparatorChar }, StringSplitOptions.None)
|
|
||||||
.Last();
|
|
||||||
|
|
||||||
var browser = string.IsNullOrEmpty(browserExecutableName) ? "chrome" : browserPath;
|
|
||||||
|
|
||||||
// Internet Explorer will open url in new browser window, and does not take the --new-window parameter
|
|
||||||
var browserArguements = browserExecutableName == "iexplore.exe" ? url : "--new-window " + url;
|
|
||||||
|
|
||||||
Process.Start(browser, browserArguements);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -8,7 +8,7 @@ using System.Threading.Tasks;
|
|||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using Wox.Infrastructure;
|
using Wox.Infrastructure;
|
||||||
using Wox.Infrastructure.Storage;
|
using Wox.Infrastructure.Storage;
|
||||||
using Wox.Plugin.WebSearch.Commands;
|
using Wox.Plugin.SharedCommands;
|
||||||
|
|
||||||
namespace Wox.Plugin.WebSearch
|
namespace Wox.Plugin.WebSearch
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -58,7 +58,6 @@
|
|||||||
<Compile Include="..\..\SolutionAssemblyInfo.cs">
|
<Compile Include="..\..\SolutionAssemblyInfo.cs">
|
||||||
<Link>Properties\SolutionAssemblyInfo.cs</Link>
|
<Link>Properties\SolutionAssemblyInfo.cs</Link>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Commands\SearchWeb.cs" />
|
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="SearchSourceViewModel.cs" />
|
<Compile Include="SearchSourceViewModel.cs" />
|
||||||
<Compile Include="SettingsViewModel.cs" />
|
<Compile Include="SettingsViewModel.cs" />
|
||||||
|
|||||||
@@ -3,14 +3,14 @@ using System.Diagnostics;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
namespace Wox.Plugin.WebSearch.Commands
|
namespace Wox.Plugin.SharedCommands
|
||||||
{
|
{
|
||||||
internal static class SearchWeb
|
public static class SearchWeb
|
||||||
{
|
{
|
||||||
/// <summary> Opens search in a new browser. If no browser path is passed in then Chrome is used.
|
/// <summary> Opens search in a new browser. If no browser path is passed in then Chrome is used.
|
||||||
/// Leave browser path blank to use Chrome.
|
/// Leave browser path blank to use Chrome.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal static void NewBrowserWindow(this string url, string browserPath)
|
public static void NewBrowserWindow(this string url, string browserPath)
|
||||||
{
|
{
|
||||||
var browserExecutableName = browserPath?
|
var browserExecutableName = browserPath?
|
||||||
.Split(new[] { Path.DirectorySeparatorChar }, StringSplitOptions.None)
|
.Split(new[] { Path.DirectorySeparatorChar }, StringSplitOptions.None)
|
||||||
|
|||||||
Reference in New Issue
Block a user