common helper for execute shell process from run plugins (#9538)

This commit is contained in:
Davide Giacometti
2021-02-23 09:53:08 +01:00
committed by GitHub
parent 20a922ce21
commit 571bceb386
17 changed files with 77 additions and 128 deletions

View File

@@ -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;
},
});

View File

@@ -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>

View File

@@ -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>