Add error info when file/application can't be open

1. Fix #492
2. FIx #478
This commit is contained in:
bao-qian
2016-03-27 02:49:05 +01:00
parent 0538d082dc
commit 95becde93d
3 changed files with 51 additions and 23 deletions

View File

@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Linq;
@@ -56,13 +57,24 @@ namespace Wox.Plugin.Everything
r.IcoPath = GetIconPath(s);
r.Action = c =>
{
_context.API.HideApp();
Process.Start(new ProcessStartInfo
bool hide;
try
{
FileName = path,
UseShellExecute = true
});
return true;
Process.Start(new ProcessStartInfo
{
FileName = path,
UseShellExecute = true
});
hide = true;
}
catch (Win32Exception)
{
var name = $"Plugin: {_context.CurrentPluginMetadata.Name}";
var message = "Can't open this file";
_context.API.ShowMsg(name, message, string.Empty);
hide = false;
}
return hide;
};
r.ContextData = s;
results.Add(r);