From f3ad091c933e3000e2887cacce309060a28ca169 Mon Sep 17 00:00:00 2001 From: GUOxingyu3018 Date: Wed, 11 Oct 2017 10:24:51 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E6=A3=80=E6=B5=8BCitrix=E6=8F=92=E4=BB=B6?= =?UTF-8?q?=E6=98=AF=E5=90=A6=E5=AD=98=E5=9C=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 通过对localmachine和currentuser的注册表进行检测来确定插件是否存在 --- CenterView/CenterView.csproj | 2 ++ CenterView/CkCitrix.cs | 46 +++++++++++++++++++++++++++++++++++ CenterView/MainWindow.xaml | 11 +++------ CenterView/MainWindow.xaml.cs | 20 +++++++++++++++ 4 files changed, 71 insertions(+), 8 deletions(-) create mode 100644 CenterView/CkCitrix.cs diff --git a/CenterView/CenterView.csproj b/CenterView/CenterView.csproj index 5314fc6..3ad8a4c 100644 --- a/CenterView/CenterView.csproj +++ b/CenterView/CenterView.csproj @@ -37,6 +37,7 @@ + @@ -71,6 +72,7 @@ App.xaml Code + MainWindow.xaml Code diff --git a/CenterView/CkCitrix.cs b/CenterView/CkCitrix.cs new file mode 100644 index 0000000..d6ebe1f --- /dev/null +++ b/CenterView/CkCitrix.cs @@ -0,0 +1,46 @@ +using Microsoft.Win32; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.ComponentModel; + +namespace CenterView +{ + public class CkCitrix + { + //检测citrix是否存在 + public static bool CheckCitrix() + { + List subkeyNames = new List(); + //当前用户 + RegistryKey CurrentUserhkml = Registry.CurrentUser; + RegistryKey CurrentUsersoftware = CurrentUserhkml.OpenSubKey("SOFTWARE"); + subkeyNames = CurrentUsersoftware.GetSubKeyNames().ToList(); + if (subkeyNames.Contains("Citrix")) + { + CurrentUserhkml.Close(); + return true; + } + else + { + CurrentUserhkml.Close(); + } + //本机安装 + RegistryKey LocalMachinehkml = Registry.LocalMachine; + RegistryKey LocalMachinesoftware = LocalMachinehkml.OpenSubKey("SOFTWARE"); + subkeyNames = LocalMachinesoftware.GetSubKeyNames().ToList(); + if (subkeyNames.Contains("Citrix")) + { + LocalMachinehkml.Close(); + return true; + } + else + { + + LocalMachinehkml.Close(); + return false; + } + } + } +} diff --git a/CenterView/MainWindow.xaml b/CenterView/MainWindow.xaml index bbeeafd..7fbefd4 100644 --- a/CenterView/MainWindow.xaml +++ b/CenterView/MainWindow.xaml @@ -2,7 +2,7 @@ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid" x:Name="window" mc:Ignorable="d" - Title="MainWindow" Height="720" Width="900" Style="{DynamicResource NoResize_window}" MouseLeftButtonDown="Window_MouseLeftButtonDown"> + Title="MainWindow" Height="720" Width="900" Style="{DynamicResource NoResize_window}" MouseLeftButtonDown="Window_MouseLeftButtonDown" Loaded="window_Loaded"> @@ -226,14 +226,9 @@ - - - - - - - + + diff --git a/CenterView/MainWindow.xaml.cs b/CenterView/MainWindow.xaml.cs index 4edd24c..2433291 100644 --- a/CenterView/MainWindow.xaml.cs +++ b/CenterView/MainWindow.xaml.cs @@ -12,6 +12,8 @@ using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; +using System.ComponentModel; +using Microsoft.Win32; namespace CenterView { @@ -61,5 +63,23 @@ private void ksl_Click(object sender, RoutedEventArgs e) //list1.Items.Add("扫描k盘中..."); //list1.Items.Add("扫描完毕"); } + + + private void window_Loaded(object sender, RoutedEventArgs e) + { + //显示citrix插件是否安装 + { + var isExistCkCitrix = CkCitrix.CheckCitrix(); + if (isExistCkCitrix) + { + citrix.Text = "Ctrix已安装"; + } + else + { + citrix.Text = "Citrix未安装"; + } + } + } + } } From 504b3806f23603dc6c893c256c5348262a526852 Mon Sep 17 00:00:00 2001 From: GUOxingyu3018 Date: Thu, 12 Oct 2017 09:09:17 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E6=8F=92=E4=BB=B6=E6=A3=80=E6=B5=8B?= =?UTF-8?q?=EF=BC=8C=E9=80=9A=E8=BF=87=E6=A3=80=E6=9F=A5=E6=B3=A8=E5=86=8C?= =?UTF-8?q?=E8=A1=A8=E5=AE=9E=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CenterView/MainWindow.xaml | 580 +++++++++++++++++----------------- CenterView/MainWindow.xaml.cs | 171 +++++----- 2 files changed, 376 insertions(+), 375 deletions(-) diff --git a/CenterView/MainWindow.xaml b/CenterView/MainWindow.xaml index 7fbefd4..e00e02d 100644 --- a/CenterView/MainWindow.xaml +++ b/CenterView/MainWindow.xaml @@ -1,290 +1,290 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -