From 85ad6a6bc47b9e54f24f449a50538a31f6f0bd41 Mon Sep 17 00:00:00 2001 From: BookerLiu Date: Fri, 14 Apr 2023 18:02:18 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=85=20=E4=BC=98=E5=8C=96everything?= =?UTF-8?q?=E6=90=9C=E7=B4=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- MainWindow.xaml.cs | 1 - Plugins/EveryThing/EveryThingUtil.cs | 17 +++++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/MainWindow.xaml.cs b/MainWindow.xaml.cs index e811082..d349664 100644 --- a/MainWindow.xaml.cs +++ b/MainWindow.xaml.cs @@ -150,7 +150,6 @@ namespace GeekDesk { SearchResControl control = obj as SearchResControl; control.VerticalUFG.Visibility = Visibility.Collapsed; - control.SearchListBox.Items.Clear(); } } diff --git a/Plugins/EveryThing/EveryThingUtil.cs b/Plugins/EveryThing/EveryThingUtil.cs index bfea1b8..b729f91 100644 --- a/Plugins/EveryThing/EveryThingUtil.cs +++ b/Plugins/EveryThing/EveryThingUtil.cs @@ -93,7 +93,6 @@ namespace GeekDesk.Plugins.EveryThing string pluginsPath = Constants.PLUGINS_PATH; bool Is64Bit = Environment.Is64BitOperatingSystem; string everyThingPath = pluginsPath + "/EveryThing/" + (Is64Bit ? 64 : 32) + "/EveryThing.exe"; - string installUtilPath = "C:\\Windows\\Microsoft.NET\\Framework" + (Is64Bit ? "64" : "") + "\\v4.0.30319\\InstallUtil.exe"; Process p = new Process(); p.StartInfo.FileName = everyThingPath; @@ -101,12 +100,14 @@ namespace GeekDesk.Plugins.EveryThing switch(type) { default: + p.StartInfo.Verb = "runas"; arg = "-start-service"; break; case ServiceType.STOP: arg = "-stop-service"; break; case ServiceType.INSTALL: + p.StartInfo.Verb = "runas"; arg = "-install-service"; break; case ServiceType.UNINSTALL: @@ -150,12 +151,16 @@ namespace GeekDesk.Plugins.EveryThing catch (Exception e) { } try { - if (uninstall) + if (GetService("Everything") != null) { - EveryThingService(ServiceType.UNINSTALL); - } else - { - EveryThingService(ServiceType.STOP); + if (uninstall) + { + EveryThingService(ServiceType.UNINSTALL); + } + else + { + EveryThingService(ServiceType.STOP); + } } } catch (Exception e) { }