Browse Source

自动更新

liufei 4 years ago
parent
commit
9f24601ff2

+ 9 - 7
App.config

@@ -1,21 +1,23 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
 <configuration>
     <startup> 
-        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
+        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/>
     </startup>
   <runtime>
     <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
       <dependentAssembly>
-        <assemblyIdentity name="CommonServiceLocator" publicKeyToken="489b6accfaf20ef0" culture="neutral" />
-        <bindingRedirect oldVersion="0.0.0.0-2.0.6.0" newVersion="2.0.6.0" />
+        <assemblyIdentity name="CommonServiceLocator" publicKeyToken="489b6accfaf20ef0" culture="neutral"/>
+        <bindingRedirect oldVersion="0.0.0.0-2.0.6.0" newVersion="2.0.6.0"/>
       </dependentAssembly>
     </assemblyBinding>
   </runtime>
 	<appSettings>
-		<add key="Version" value="1.0-beta"/>
+		<add key="Version" value="0.1-beta"/>
+		
 		<add key="GitHubUrl" value="https://github.com/Demo-Liu/GeekDesk"/>
 		<add key="GiteeUrl" value="https://gitee.com/demo_liu/GeekDesk/tree/master"/>
-		<add key="GitHubUpdateUrl" value="https://github.com/Demo-Liu/GeekDesk/blob/master/Update.json"/>
-		<add key="GiteeUpdateUrl" value="https://gitee.com/demo_liu/GeekDesk/blob/master/Update.json"/>
+		
+		<add key="GitHubUpdateUrl" value="https://demo-liu.github.io/GeekDesk/Update.json"/>
+		<add key="GiteeUpdateUrl" value="https://demo-liu.github.io/GeekDesk/Update.json"/>
 	</appSettings>
 </configuration>

+ 138 - 1
App.xaml.cs

@@ -1,4 +1,8 @@
-using System.Windows;
+using Microsoft.Win32;
+using System;
+using System.IO;
+using System.Windows;
+using System.Windows.Threading;
 
 namespace GeekDesk
 {
@@ -7,5 +11,138 @@ namespace GeekDesk
     /// </summary>
     public partial class App : Application
     {
+        System.Threading.Mutex mutex;
+        private void App_Startup(object sender, StartupEventArgs e)
+        {
+            bool ret;
+            mutex = new System.Threading.Mutex(true, "GeekDesk", out ret);
+
+            if (!ret)
+            {
+                MessageBox.Show("已有一个客户端正在运行,请先结束原来客户端!");
+                Environment.Exit(0);
+            }
+            #region 设置程序开机自动运行(+注册表项)
+            try
+            {
+                //SetSelfStarting(true, "GeekDesk.exe");
+            }
+            catch (Exception ex)
+            {
+            }
+
+            #endregion
+        }
+
+
+
+        #region 注册表开机自启动
+
+
+        /// <summary>
+        /// 开机自动启动
+        /// </summary>
+        /// <param name="started">设置开机启动,或取消开机启动</param>
+        /// <param name="exeName">注册表中的名称</param>
+        /// <returns>开启或停用是否成功</returns>
+        public bool SetSelfStarting(bool started, string exeName)
+        {
+            RegistryKey key = null;
+            try
+            {
+                string exeDir = System.Windows.Forms.Application.ExecutablePath;
+                //RegistryKey HKLM = Registry.CurrentUser;
+                //key = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);//打开注册表子项
+                key = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);//打开注册表子项
+
+                if (key == null)//如果该项不存在的话,则创建该子项
+                {
+                    key = Registry.LocalMachine.CreateSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run");
+                }
+                if (started)
+                {
+                    try
+                    {
+                        object ob = key.GetValue(exeName, -1);
+
+                        if (!ob.ToString().Equals(exeDir))
+                        {
+                            if (!ob.ToString().Equals("-1"))
+                            {
+                                key.DeleteValue(exeName);//取消开机启动
+                            }
+                            key.SetValue(exeName, exeDir);//设置为开机启动
+                        }
+                        key.Close();
+
+                    }
+                    catch (Exception ex)
+                    {
+                        return false;
+                    }
+                }
+                else
+                {
+                    try
+                    {
+                        key.DeleteValue(exeName);//取消开机启动
+                        key.Close();
+                    }
+                    catch (Exception ex)
+                    {
+                        return false;
+                    }
+                }
+                return true;
+            }
+            catch (Exception ex)
+            {
+                if (key != null)
+                {
+                    key.Close();
+                }
+                return false;
+            }
+        }
+
+        #endregion
     }
+    //    private void WriteLog(object exception)
+    //    {
+    //        Exception ex = exception as Exception;
+
+    //        using (FileStream fs = File.Open(".//ErrorLog.txt", FileMode.OpenOrCreate, FileAccess.ReadWrite))
+    //        {
+    //            fs.Seek(0, SeekOrigin.End);
+    //            byte[] buffer = Encoding.Default.GetBytes("-------------------------------------------------------\r\n");
+    //            fs.Write(buffer, 0, buffer.Length);
+
+    //            buffer = Encoding.Default.GetBytes(DateTime.Now.ToString() + "\r\n");
+    //            fs.Write(buffer, 0, buffer.Length);
+
+    //            if (ex != null)
+    //            {
+    //                buffer = Encoding.Default.GetBytes("成员名: " + ex.TargetSite + "\r\n");
+    //                fs.Write(buffer, 0, buffer.Length);
+
+    //                buffer = Encoding.Default.GetBytes("引发异常的类: " + ex.TargetSite.DeclaringType + "\r\n");
+    //                fs.Write(buffer, 0, buffer.Length);
+
+    //                buffer = Encoding.Default.GetBytes("异常信息: " + ex.Message + "\r\n");
+    //                fs.Write(buffer, 0, buffer.Length);
+
+    //                buffer = Encoding.Default.GetBytes("引发异常的程序集或对象: " + ex.Source + "\r\n");
+    //                fs.Write(buffer, 0, buffer.Length);
+
+    //                buffer = Encoding.Default.GetBytes("栈:" + ex.StackTrace + "\r\n");
+    //                fs.Write(buffer, 0, buffer.Length);
+    //            }
+    //            else
+    //            {
+    //                buffer = Encoding.Default.GetBytes("应用程序错误: " + exception.ToString() + "\r\n");
+    //                fs.Write(buffer, 0, buffer.Length);
+    //            }
+    //        }
+
+    //}
 }

+ 0 - 1
Control/UserControls/Config/MotionControl.xaml.cs

@@ -1,7 +1,6 @@
 using GeekDesk.Control.Windows;
 using GeekDesk.Util;
 using GeekDesk.ViewModel;
-using GlobalHotKey;
 using HandyControl.Data;
 using Microsoft.Win32;
 using System;

+ 1 - 1
Control/UserControls/PannelCard/RightCardControl.xaml.cs

@@ -173,7 +173,7 @@ namespace GeekDesk.Control.UserControls.PannelCard
             {
                 string path = (string)obj;
 
-                string base64 = ImageUtil.FileImageToBase64(path, ImageFormat.Jpeg);
+                //string base64 = ImageUtil.FileImageToBase64(path, ImageFormat.Jpeg);
 
                 IconInfo iconInfo = new IconInfo
                 {

+ 0 - 1
Control/Windows/ConfigWindow.xaml.cs

@@ -1,5 +1,4 @@
 
-using GalaSoft.MvvmLight.Command;
 using GeekDesk.Control.UserControls;
 using GeekDesk.Control.UserControls.Config;
 using GeekDesk.ViewModel;

+ 31 - 3
Control/Windows/UpdateWindow.xaml

@@ -4,13 +4,41 @@
         xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
         xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
         xmlns:local="clr-namespace:GeekDesk.Control.Windows"
+        xmlns:hc="https://handyorg.github.io/handycontrol"
         mc:Ignorable="d"
-        Title="UpdateWindow" Height="450" Width="800"
+        Title="UpdateWindow" Height="300" Width="450"
         WindowStyle="None"
         AllowsTransparency="True"
         Background="Transparent" ShowInTaskbar="False">
-    <Border Background="White">
-        
+    <Border Background="AliceBlue" MouseDown="DragMove">
+        <StackPanel HorizontalAlignment="Center">
+            <hc:Card BorderThickness="0" Effect="{DynamicResource EffectShadow2}" Margin="20,20,20,0">
+                <!--Card 的内容部分-->
+                <Border CornerRadius="4,4,0,0" Height="160">
+                    <StackPanel>
+                        <TextBlock Margin="10" x:Name="MsgTitle" TextWrapping="Wrap" FontSize="16" HorizontalAlignment="Left" Style="{DynamicResource TextBlockLargeBold}" Text="测试"/>
+                        <TextBlock Margin="15" x:Name="Msg" TextWrapping="Wrap" VerticalAlignment="Center" Text=""/>
+                    </StackPanel>
+                </Border>
+                <!--Card 的尾部部分-->
+                <hc:Card.Footer>
+                    <StackPanel Margin="10" Width="420">
+                        <!--Card 的一级内容-->
+                        <TextBlock TextWrapping="NoWrap" x:Name="Title"  Style="{DynamicResource TextBlockLargeBold}" TextTrimming="CharacterEllipsis" 
+                                       Text="" 
+                                       HorizontalAlignment="Left"/>
+                        <!--Card 的二级内容-->
+                        <TextBlock TextWrapping="NoWrap" x:Name="SubTitle" Style="{DynamicResource TextBlockDefault}" TextTrimming="CharacterEllipsis" 
+                                       Margin="0,6,0,0"
+                                       HorizontalAlignment="Left"/>
+                    </StackPanel>
+                </hc:Card.Footer>
+            </hc:Card>
+            <hc:UniformSpacingPanel Spacing="100" HorizontalAlignment="Center" Margin="0,10,0,0">
+                <Button Content="暂不更新" Click="Close_Click" />
+                <Button Content="前往更新" Click="Confirm_Click" Background="#5BC0DE" Foreground="White" RenderTransformOrigin="0.696,0.45"/>
+            </hc:UniformSpacingPanel>
+        </StackPanel>
         
     </Border>
 </Window>

+ 83 - 3
Control/Windows/UpdateWindow.xaml.cs

@@ -1,5 +1,11 @@
-using System;
+using GeekDesk.Constant;
+using GeekDesk.Util;
+using GeekDesk.ViewModel;
+using Newtonsoft.Json.Linq;
+using System;
 using System.Collections.Generic;
+using System.Configuration;
+using System.Diagnostics;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
@@ -19,9 +25,83 @@ namespace GeekDesk.Control.Windows
     /// </summary>
     public partial class UpdateWindow : Window
     {
-        public UpdateWindow()
+        private static AppConfig appConfig = MainWindow.appData.AppConfig;
+        private static string githubUrl = "";
+        private static string giteeUrl = "";
+        private UpdateWindow(JObject jo)
         {
-            InitializeComponent();
+            try
+            {
+                WindowStartupLocation = WindowStartupLocation.CenterScreen;
+                InitializeComponent();
+                DataHandle(jo);
+            }
+            catch (Exception)
+            {
+
+            }
+           
+        }
+
+        /// <summary>
+        /// 移动窗口
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        private void DragMove(object sender, System.Windows.Input.MouseButtonEventArgs e)
+        {
+            if (e.LeftButton == MouseButtonState.Pressed)
+            {
+                DragMove();
+            }
+        }
+
+
+        private void DataHandle(JObject jo)
+        {
+            Title.Text = StringUtil.IsEmpty(jo["title"]) ? "" : jo["title"].ToString();
+            SubTitle.Text = StringUtil.IsEmpty(jo["subTitle"]) ? "" : jo["subTitle"].ToString();
+            MsgTitle.Text = StringUtil.IsEmpty(jo["msgTitle"]) ? "" : jo["msgTitle"].ToString();
+            JArray ja = JArray.Parse(StringUtil.IsEmpty(jo["msg"]) ? "[]" : jo["msg"].ToString());
+            githubUrl = StringUtil.IsEmpty(jo["githubUrl"]) ? ConfigurationManager.AppSettings["GitHubUrl"] : jo["githubUrl"].ToString();
+            giteeUrl = StringUtil.IsEmpty(jo["giteeUrl"]) ? ConfigurationManager.AppSettings["GiteeUrl"] : jo["giteeUrl"].ToString();
+            string msg = "";
+            for (int i=0; i<ja.Count; i++)
+            {
+                msg += "•" + ja[i].ToString() + "\n";
+            }
+            Msg.Text = msg;
+        }
+
+        private void Close_Click(object sender, RoutedEventArgs e)
+        {
+            this.Close();
+        }
+
+        private void Confirm_Click(object sender, RoutedEventArgs e)
+        {
+            string packageUrl;
+            switch (appConfig.UpdateType)
+            {
+                case UpdateType.GitHub:
+                    packageUrl = githubUrl;
+                    break;
+                default:
+                    packageUrl = giteeUrl;
+                    break;
+            }
+            Process.Start(packageUrl);
+            this.Close();
+        }
+
+        private static System.Windows.Window window = null;
+        public static void Show(JObject jo)
+        {
+            if (window == null || !window.Activate())
+            {
+                window = new UpdateWindow(jo);
+            }
+            window.Show();
         }
     }
 }

+ 7 - 29
GeekDesk.csproj

@@ -46,41 +46,22 @@
   <PropertyGroup>
     <ApplicationIcon>Taskbar.ico</ApplicationIcon>
   </PropertyGroup>
+  <PropertyGroup>
+    <TargetZone>LocalIntranet</TargetZone>
+  </PropertyGroup>
+  <PropertyGroup>
+    <GenerateManifests>false</GenerateManifests>
+  </PropertyGroup>
   <ItemGroup>
-    <Reference Include="Apex.WinForms, Version=1.6.0.0, Culture=neutral, PublicKeyToken=98d06957926c086d, processorArchitecture=MSIL">
-      <HintPath>packages\SharpShellTools.2.2.0.0\lib\Apex.WinForms.dll</HintPath>
-    </Reference>
     <Reference Include="CommonServiceLocator, Version=2.0.6.0, Culture=neutral, PublicKeyToken=489b6accfaf20ef0, processorArchitecture=MSIL">
       <HintPath>packages\CommonServiceLocator.2.0.6\lib\net45\CommonServiceLocator.dll</HintPath>
     </Reference>
-    <Reference Include="GalaSoft.MvvmLight, Version=5.4.1.0, Culture=neutral, PublicKeyToken=e7570ab207bcb616, processorArchitecture=MSIL">
-      <HintPath>packages\MvvmLightLibs.5.4.1.1\lib\net45\GalaSoft.MvvmLight.dll</HintPath>
-    </Reference>
-    <Reference Include="GalaSoft.MvvmLight.Extras, Version=5.4.1.0, Culture=neutral, PublicKeyToken=669f0b5e8f868abf, processorArchitecture=MSIL">
-      <HintPath>packages\MvvmLightLibs.5.4.1.1\lib\net45\GalaSoft.MvvmLight.Extras.dll</HintPath>
-    </Reference>
-    <Reference Include="GalaSoft.MvvmLight.Platform, Version=5.4.1.0, Culture=neutral, PublicKeyToken=5f873c45e98af8a1, processorArchitecture=MSIL">
-      <HintPath>packages\MvvmLightLibs.5.4.1.1\lib\net45\GalaSoft.MvvmLight.Platform.dll</HintPath>
-    </Reference>
-    <Reference Include="GlobalHotKey, Version=1.1.0.0, Culture=neutral, processorArchitecture=MSIL">
-      <HintPath>packages\GlobalHotKey.1.1.0\lib\GlobalHotKey.dll</HintPath>
-    </Reference>
     <Reference Include="HandyControl, Version=3.1.0.0, Culture=neutral, PublicKeyToken=45be8712787a1e5b, processorArchitecture=MSIL">
       <HintPath>packages\HandyControl.3.1.0\lib\net472\HandyControl.dll</HintPath>
     </Reference>
     <Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
       <HintPath>packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
     </Reference>
-    <Reference Include="ServerManager, Version=2.2.0.0, Culture=neutral, processorArchitecture=x86">
-      <HintPath>packages\SharpShellTools.2.2.0.0\lib\ServerManager.exe</HintPath>
-    </Reference>
-    <Reference Include="SharpShell, Version=2.2.0.0, Culture=neutral, PublicKeyToken=f14dc899472fe6fb, processorArchitecture=MSIL">
-      <HintPath>packages\SharpShellTools.2.2.0.0\lib\SharpShell.dll</HintPath>
-    </Reference>
-    <Reference Include="srm, Version=2.2.0.0, Culture=neutral, PublicKeyToken=68bd4561cc3495fc, processorArchitecture=MSIL">
-      <HintPath>packages\SharpShellTools.2.2.0.0\lib\srm.exe</HintPath>
-      <Private>True</Private>
-    </Reference>
     <Reference Include="System" />
     <Reference Include="System.Configuration" />
     <Reference Include="System.Data" />
@@ -89,9 +70,6 @@
       <HintPath>packages\System.Drawing.Common.6.0.0-preview.3.21201.4\lib\net461\System.Drawing.Common.dll</HintPath>
     </Reference>
     <Reference Include="System.Windows.Forms" />
-    <Reference Include="System.Windows.Interactivity, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
-      <HintPath>packages\MvvmLightLibs.5.4.1.1\lib\net45\System.Windows.Interactivity.dll</HintPath>
-    </Reference>
     <Reference Include="System.Xml" />
     <Reference Include="Microsoft.CSharp" />
     <Reference Include="System.Core" />
@@ -187,7 +165,6 @@
     <Compile Include="Converts\MenuWidthConvert.cs" />
     <Compile Include="Util\MouseUtil.cs" />
     <Compile Include="Util\MouseUtilities.cs" />
-    <Compile Include="Util\ShellContextMenu.cs" />
     <Compile Include="Util\StringUtil.cs" />
     <Compile Include="Util\SvgToGeometry.cs" />
     <Compile Include="Util\SystemIcon.cs" />
@@ -297,6 +274,7 @@
       <LastGenOutput>Resources.Designer.cs</LastGenOutput>
     </EmbeddedResource>
     <Resource Include="Resource\Iconfont\iconfont.json" />
+    <None Include="Properties\app.manifest" />
     <None Include="Update.json" />
     <None Include="packages.config" />
     <None Include="Properties\Settings.settings">

+ 16 - 18
MainWindow.xaml.cs

@@ -7,9 +7,7 @@ using GeekDesk.Task;
 using GeekDesk.Thread;
 using GeekDesk.Util;
 using GeekDesk.ViewModel;
-using GlobalHotKey;
 using HandyControl.Data;
-using SharpShell.SharpContextMenu;
 using System;
 using System.Collections.ObjectModel;
 using System.Diagnostics;
@@ -36,7 +34,6 @@ namespace GeekDesk
         public static int hotKeyId = -1;
         public static int toDoHotKeyId = -1;
         public static MainWindow mainWindow;
-        public HotKeyManager hkm = new HotKeyManager();
         public MainWindow()
         {
             LoadData();
@@ -46,7 +43,6 @@ namespace GeekDesk
             this.Loaded += Window_Loaded;
             this.SizeChanged += MainWindow_Resize;
             ToDoTask.BackLogCheck();
-            UpdateThread.Update();
         }
 
         private void LoadData()
@@ -73,6 +69,8 @@ namespace GeekDesk
             }
             RegisterHotKey(true);
             //RegisterCreateToDoHotKey(true);
+            UpdateThread.Update();
+
         }
 
         /// <summary>
@@ -155,21 +153,21 @@ namespace GeekDesk
             }
         }
 
-        private void DisplayWindowHotKeyPress(object sender, KeyPressedEventArgs e)
-        {
-            if (e.HotKey.Key == Key.Y)
-            {
-                if (this.Visibility == Visibility.Collapsed)
-                {
-                    ShowApp();
-                }
-                else
-                {
-                    this.Visibility = Visibility.Collapsed;
-                }
-            }
+        //private void DisplayWindowHotKeyPress(object sender, KeyPressedEventArgs e)
+        //{
+        //    if (e.HotKey.Key == Key.Y)
+        //    {
+        //        if (this.Visibility == Visibility.Collapsed)
+        //        {
+        //            ShowApp();
+        //        }
+        //        else
+        //        {
+        //            this.Visibility = Visibility.Collapsed;
+        //        }
+        //    }
 
-        }
+        //}
 
 
         void MainWindow_Resize(object sender, System.EventArgs e)

+ 11 - 0
Properties/app.manifest

@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<asmv1:assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:co.v1="urn:schemas-microsoft-com:clickonce.v1">
+  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
+    <security>
+      <applicationRequestMinimum>
+        <defaultAssemblyRequest permissionSetReference="Custom" />
+        <PermissionSet class="System.Security.PermissionSet" version="1" Unrestricted="true" ID="Custom" SameSite="site" />
+      </applicationRequestMinimum>
+    </security>
+  </trustInfo>
+</asmv1:assembly>

+ 9 - 5
Thread/UpdateThread.cs

@@ -1,4 +1,5 @@
 using GeekDesk.Constant;
+using GeekDesk.Control.Windows;
 using GeekDesk.Util;
 using GeekDesk.ViewModel;
 using Newtonsoft.Json.Linq;
@@ -9,6 +10,7 @@ using System.Linq;
 using System.Text;
 using System.Threading;
 using System.Threading.Tasks;
+using System.Windows;
 
 namespace GeekDesk.Thread
 {
@@ -46,15 +48,17 @@ namespace GeekDesk.Thread
                     string onlineVersion = jo["version"].ToString();
                     if (onlineVersion.CompareTo(nowVersion) > 0)
                     {
-                        //检测到版本更新
+                        App.Current.Dispatcher.Invoke((Action)(() =>
+                        {
+                            //检测到版本更新
+                            UpdateWindow.Show(jo);
+                        }));
                     }
                 }
-            } catch (Exception)
+            } catch (Exception e)
             {
-
+                MessageBox.Show(e.Message);
             }
-            
-            
         }
     }
 }

+ 7 - 3
Update.json

@@ -1,5 +1,9 @@
 {
-	"version" : "1.0-beta",
-	"msg" : "",
-	"log" : ""
+	"title" : "",
+	"subTitle" : "",
+	"msgTitle" : "",
+	"msg" : [],
+	"githubUrl" : "",
+	"giteeUrl" : "",
+	"version": ""
 }

+ 1 - 1
Util/FileIcon.cs

@@ -47,7 +47,7 @@ namespace GeekDesk.Util
         public static IntPtr GetJumboIcon(int iImage)
         {
             IImageList spiml = null;
-            Guid guil = new Guid(IID_IImageList2);//or IID_IImageList
+            Guid guil = new Guid(IID_IImageList);//or IID_IImageList
 
             Shell32.SHGetImageList(Shell32.SHIL_JUMBO, ref guil, ref spiml);
             IntPtr hIcon = IntPtr.Zero;

+ 2 - 0
Util/HttpUtil.cs

@@ -13,6 +13,8 @@ namespace GeekDesk.Util
         #region Get请求
         public static string Get(string url)
         {
+            ServicePointManager.Expect100Continue = true;
+            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
             //创建Web访问对  象
             HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(url);
             //通过Web访问对象获取响应内容

+ 0 - 23
Util/ShellContextMenu.cs

@@ -1,23 +0,0 @@
-using SharpShell.SharpContextMenu;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows.Forms;
-
-namespace GeekDesk.Util
-{
-    class ShellContextMenu : SharpContextMenu
-    {
-        protected override bool CanShowMenu()
-        {
-            throw new NotImplementedException();
-        }
-
-        protected override ContextMenuStrip CreateMenu()
-        {
-            throw new NotImplementedException();
-        }
-    }
-}

+ 2 - 2
Util/StringUtil.cs

@@ -10,9 +10,9 @@ namespace GeekDesk.Util
     {
 
 
-        public static bool IsEmpty(string str)
+        public static bool IsEmpty(object str)
         {
-            if (str == null || str.Length == 0 || str.Trim().Length == 0)
+            if (str == null || str.ToString().Length == 0 || str.ToString().Trim().Length == 0)
             {
                 return true;
             }

+ 0 - 4
packages.config

@@ -1,11 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <packages>
   <package id="CommonServiceLocator" version="2.0.6" targetFramework="net452" requireReinstallation="true" />
-  <package id="GlobalHotKey" version="1.1.0" targetFramework="net472" />
   <package id="HandyControl" version="3.1.0" targetFramework="net472" />
-  <package id="MvvmLightLibs" version="5.4.1.1" targetFramework="net472" />
   <package id="Newtonsoft.Json" version="13.0.1" targetFramework="net472" />
-  <package id="SharpShell" version="2.7.2" targetFramework="net472" />
-  <package id="SharpShellTools" version="2.2.0.0" targetFramework="net472" />
   <package id="System.Drawing.Common" version="6.0.0-preview.3.21201.4" targetFramework="net472" />
 </packages>