Explorar o código

释放启动进程

liufei %!s(int64=3) %!d(string=hai) anos
pai
achega
65d57b69b6
Modificáronse 1 ficheiros con 5 adicións e 8 borrados
  1. 5 8
      Control/UserControls/PannelCard/RightCardControl.xaml.cs

+ 5 - 8
Control/UserControls/PannelCard/RightCardControl.xaml.cs

@@ -122,21 +122,15 @@ namespace GeekDesk.Control.UserControls.PannelCard
             {
                 using (Process p = new Process())
                 {
-                    p.StartInfo.UseShellExecute = true;
-
                     string startArg = icon.StartArg;
 
-                    if (startArg != null && Constants.SYSTEM_ICONS != null
-                        && Constants.SYSTEM_ICONS.ContainsKey(startArg))
+                    if (startArg != null && Constants.SYSTEM_ICONS.ContainsKey(startArg))
                     {
                         StartSystemApp(startArg, type);
                     }
                     else
                     {
                         p.StartInfo.FileName = icon.Path;
-                        //p.StartInfo.CreateNoWindow = false; //设置显示窗口
-                        //p.StartInfo.UseShellExecute = false;//不使用操作系统外壳程序启动进程
-                        //p.StartInfo.ErrorDialog = false;
                         if (!StringUtil.IsEmpty(startArg))
                         {
                             p.StartInfo.Arguments = startArg;
@@ -154,6 +148,9 @@ namespace GeekDesk.Control.UserControls.PannelCard
                                 case IconStartType.ADMIN_STARTUP:
                                     //p.StartInfo.Arguments = "1";//启动参数
                                     p.StartInfo.Verb = "runas";
+                                    p.StartInfo.CreateNoWindow = false; //设置显示窗口
+                                    p.StartInfo.UseShellExecute = false;//不使用操作系统外壳程序启动进程
+                                    p.StartInfo.ErrorDialog = false;
                                     if (appData.AppConfig.AppHideType == AppHideType.START_EXE)
                                     {
                                         //如果开启了贴边隐藏 则窗体不贴边才隐藏窗口
@@ -212,10 +209,10 @@ namespace GeekDesk.Control.UserControls.PannelCard
                                 }
                             }
                         }
-                        icon.Count++;
                         p.Start();
                     }
                 }
+                icon.Count++;
             }
             catch (Exception e)
             {