mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-08 20:27:36 +02:00
common helper for execute shell process from run plugins (#9538)
This commit is contained in:
committed by
GitHub
parent
20a922ce21
commit
571bceb386
@@ -4,11 +4,11 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO.Abstractions;
|
||||
using System.Text;
|
||||
using ManagedCommon;
|
||||
using Microsoft.Plugin.Uri.UriHelper;
|
||||
using Wox.Infrastructure;
|
||||
using Wox.Infrastructure.Storage;
|
||||
using Wox.Plugin;
|
||||
using Wox.Plugin.Logger;
|
||||
@@ -67,10 +67,14 @@ namespace Microsoft.Plugin.Uri
|
||||
: DefaultIconPath,
|
||||
Action = action =>
|
||||
{
|
||||
Process.Start(new ProcessStartInfo(uriResultString)
|
||||
if (!Helper.OpenInShell(uriResultString))
|
||||
{
|
||||
UseShellExecute = true,
|
||||
});
|
||||
var title = $"Plugin: {Properties.Resources.Microsoft_plugin_uri_plugin_name}";
|
||||
var message = $"{Properties.Resources.Microsoft_plugin_uri_open_failed}: {uriResultString}";
|
||||
Context.API.ShowMsg(title, message);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
},
|
||||
});
|
||||
|
||||
@@ -60,6 +60,15 @@ namespace Microsoft.Plugin.Uri.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Failed to open URL.
|
||||
/// </summary>
|
||||
public static string Microsoft_plugin_uri_open_failed {
|
||||
get {
|
||||
return ResourceManager.GetString("Microsoft_plugin_uri_open_failed", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Handles urls.
|
||||
/// </summary>
|
||||
|
||||
@@ -117,6 +117,9 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="Microsoft_plugin_uri_open_failed" xml:space="preserve">
|
||||
<value>Failed to open URL</value>
|
||||
</data>
|
||||
<data name="Microsoft_plugin_uri_plugin_description" xml:space="preserve">
|
||||
<value>Handles urls</value>
|
||||
</data>
|
||||
|
||||
Reference in New Issue
Block a user