diff --git a/Flow.Launcher.Plugin/SharedCommands/FilesFolders.cs b/Flow.Launcher.Plugin/SharedCommands/FilesFolders.cs index 98e465b50..7165804a4 100644 --- a/Flow.Launcher.Plugin/SharedCommands/FilesFolders.cs +++ b/Flow.Launcher.Plugin/SharedCommands/FilesFolders.cs @@ -7,6 +7,7 @@ namespace Flow.Launcher.Plugin.SharedCommands { public static class FilesFolders { + private const string FileExplorerProgramName = "explorer"; public static void Copy(this string sourcePath, string targetPath) { // Get the subdirectories for the specified directory. @@ -111,10 +112,11 @@ namespace Flow.Launcher.Plugin.SharedCommands public static void OpenLocationInExporer(string location) { + var psi = new ProcessStartInfo { FileName = FileExplorerProgramName, UseShellExecute = true, Arguments = location }; try { if (LocationExists(location)) - Process.Start(location); + Process.Start(psi); } catch (Exception e) { diff --git a/Flow.Launcher/ReportWindow.xaml.cs b/Flow.Launcher/ReportWindow.xaml.cs index 2f90ec47a..b4e0414ab 100644 --- a/Flow.Launcher/ReportWindow.xaml.cs +++ b/Flow.Launcher/ReportWindow.xaml.cs @@ -9,6 +9,7 @@ using System.Windows.Documents; using Flow.Launcher.Helper; using Flow.Launcher.Infrastructure; using Flow.Launcher.Infrastructure.Logger; +using Flow.Launcher.Plugin.SharedCommands; namespace Flow.Launcher { @@ -51,8 +52,8 @@ namespace Flow.Launcher var link = new Hyperlink { IsEnabled = true }; link.Inlines.Add(url); link.NavigateUri = new Uri(url); - link.RequestNavigate += (s, e) => Process.Start(e.Uri.ToString()); - link.Click += (s, e) => Process.Start(url); + link.RequestNavigate += (s, e) => SearchWeb.NewBrowserWindow(e.Uri.ToString()); + link.Click += (s, e) => SearchWeb.NewBrowserWindow(url); paragraph.Inlines.Add(textBeforeUrl); paragraph.Inlines.Add(link); diff --git a/Flow.Launcher/SettingWindow.xaml.cs b/Flow.Launcher/SettingWindow.xaml.cs index 36e77e25c..af8a148da 100644 --- a/Flow.Launcher/SettingWindow.xaml.cs +++ b/Flow.Launcher/SettingWindow.xaml.cs @@ -1,22 +1,18 @@ using System; -using System.Collections.Generic; using System.Diagnostics; using System.IO; -using System.Linq; -using System.Net; using System.Windows; -using System.Windows.Controls; using System.Windows.Input; using System.Windows.Navigation; using Microsoft.Win32; using NHotkey; using NHotkey.Wpf; -using Flow.Launcher.Core; using Flow.Launcher.Core.Plugin; using Flow.Launcher.Core.Resource; using Flow.Launcher.Infrastructure.Hotkey; using Flow.Launcher.Infrastructure.UserSettings; using Flow.Launcher.Plugin; +using Flow.Launcher.Plugin.SharedCommands; using Flow.Launcher.ViewModel; namespace Flow.Launcher @@ -233,7 +229,7 @@ namespace Flow.Launcher var uri = new Uri(website); if (Uri.CheckSchemeName(uri.Scheme)) { - Process.Start(website); + SearchWeb.NewBrowserWindow(website); } } } @@ -244,10 +240,8 @@ namespace Flow.Launcher if (e.ChangedButton == MouseButton.Left) { var directory = _viewModel.SelectedPlugin.PluginPair.Metadata.PluginDirectory; - if (!string.IsNullOrEmpty(directory) && Directory.Exists(directory)) - { - Process.Start(directory); - } + if (!string.IsNullOrEmpty(directory)) + FilesFolders.OpenLocationInExporer(directory); } } #endregion @@ -269,7 +263,7 @@ namespace Flow.Launcher private void OnRequestNavigate(object sender, RequestNavigateEventArgs e) { - Process.Start(new ProcessStartInfo(e.Uri.AbsoluteUri)); + SearchWeb.NewBrowserWindow(e.Uri.AbsoluteUri); e.Handled = true; } diff --git a/Flow.Launcher/ViewModel/MainViewModel.cs b/Flow.Launcher/ViewModel/MainViewModel.cs index 85eb638d4..c677d7c71 100644 --- a/Flow.Launcher/ViewModel/MainViewModel.cs +++ b/Flow.Launcher/ViewModel/MainViewModel.cs @@ -17,6 +17,7 @@ using Flow.Launcher.Infrastructure.Hotkey; using Flow.Launcher.Infrastructure.Storage; using Flow.Launcher.Infrastructure.UserSettings; using Flow.Launcher.Plugin; +using Flow.Launcher.Plugin.SharedCommands; using Flow.Launcher.Storage; namespace Flow.Launcher.ViewModel @@ -130,7 +131,7 @@ namespace Flow.Launcher.ViewModel StartHelpCommand = new RelayCommand(_ => { - Process.Start("http://doc.wox.one/"); + SearchWeb.NewBrowserWindow("https://github.com/Flow-Launcher/Flow.Launcher/wiki/Flow-Launcher/"); }); OpenResultCommand = new RelayCommand(index => diff --git a/Plugins/Flow.Launcher.Plugin.Folder/Main.cs b/Plugins/Flow.Launcher.Plugin.Folder/Main.cs index 84a83b666..4283fe7f7 100644 --- a/Plugins/Flow.Launcher.Plugin.Folder/Main.cs +++ b/Plugins/Flow.Launcher.Plugin.Folder/Main.cs @@ -7,6 +7,7 @@ using System.Windows; using System.Windows.Controls; using Flow.Launcher.Infrastructure; using Flow.Launcher.Infrastructure.Storage; +using Flow.Launcher.Plugin.SharedCommands; namespace Flow.Launcher.Plugin.Folder { @@ -18,8 +19,7 @@ namespace Flow.Launcher.Plugin.Folder public const string CopyImagePath = "Images\\copy.png"; private string DefaultFolderSubtitleString = "Ctrl + Enter to open the directory"; - - private const string _fileExplorerProgramName = "explorer"; + private static List _driverNames; private PluginInitContext _context; @@ -103,7 +103,7 @@ namespace Flow.Launcher.Plugin.Folder { try { - Process.Start(_fileExplorerProgramName, path); + FilesFolders.OpenLocationInExporer(path); return true; } catch (Exception ex) @@ -255,7 +255,7 @@ namespace Flow.Launcher.Plugin.Folder { try { - Process.Start(_fileExplorerProgramName, filePath); + FilesFolders.OpenLocationInExporer(filePath); } catch (Exception ex) { @@ -286,7 +286,7 @@ namespace Flow.Launcher.Plugin.Folder Score = 500, Action = c => { - Process.Start(_fileExplorerProgramName, search); + FilesFolders.OpenLocationInExporer(search); return true; } };