From 353a8ff768dfc26d02e13929d2041be82acdc7b1 Mon Sep 17 00:00:00 2001 From: zsxsoft Date: Sat, 8 Feb 2014 14:37:40 +0800 Subject: [PATCH] Fix crash when UAC blocks the program. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit =_=英语不好连个说明和注释都写不出了 --- Wox.Plugin.System/Programs.cs | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/Wox.Plugin.System/Programs.cs b/Wox.Plugin.System/Programs.cs index 277a39155e..37fd46b462 100644 --- a/Wox.Plugin.System/Programs.cs +++ b/Wox.Plugin.System/Programs.cs @@ -1,5 +1,6 @@ -using System; +using System; using System.Collections.Generic; +using System.ComponentModel; using System.Diagnostics; using System.IO; using System.Linq; @@ -52,7 +53,19 @@ namespace Wox.Plugin.System } else { - Process.Start(c.ExecutePath); + try + { + Process.Start(c.ExecutePath); + } + catch (Win32Exception) + { + //Do nothing. + //It may be caused if UAC blocks the program. + } + catch (Exception e) + { + throw e; + } } } }).ToList(); @@ -127,4 +140,4 @@ namespace Wox.Plugin.System return name; } } -} \ No newline at end of file +}