diff --git a/Docs/RunningImage1.png b/Docs/RunningImage1.png index adf0eeb..42cc356 100644 Binary files a/Docs/RunningImage1.png and b/Docs/RunningImage1.png differ diff --git a/KeyGo/FormMain.cs b/KeyGo/FormMain.cs index 6bd7218..5a1acad 100644 --- a/KeyGo/FormMain.cs +++ b/KeyGo/FormMain.cs @@ -4,6 +4,8 @@ using System.IO; using System.Reflection; using System.Windows.Forms; +using Microsoft.Win32; + namespace KeyGo { public partial class FormMain : Form @@ -290,13 +292,39 @@ namespace KeyGo #endregion 托盘图标管理 + #region 开机自启动 + /// /// 设置开机自启动 /// /// if set to true [enable]. private void SetPowerBoot(bool enable) { - // TODO + try + { + if (enable) + { + RegistryKey R_local = Registry.CurrentUser; + RegistryKey R_run = R_local.CreateSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run"); + R_run.SetValue("KeyGo", Application.ExecutablePath); + R_run.Close(); + R_local.Close(); + } + else + { + RegistryKey R_local = Registry.CurrentUser; + RegistryKey R_run = R_local.CreateSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run"); + R_run.DeleteValue("KeyGo", false); + R_run.Close(); + R_local.Close(); + } + } + catch (Exception ex) + { + MessageBox.Show("注册表编辑失败:" + ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); + } } + + #endregion } } \ No newline at end of file diff --git a/KeyGo/KeyGo.csproj b/KeyGo/KeyGo.csproj index 23997af..4e30feb 100644 --- a/KeyGo/KeyGo.csproj +++ b/KeyGo/KeyGo.csproj @@ -55,6 +55,15 @@ prompt true + + LocalIntranet + + + false + + + Properties\app.manifest + @@ -122,6 +131,7 @@ UCHotKeyItem.cs + SettingsSingleFileGenerator Settings.Designer.cs diff --git a/KeyGo/Properties/AssemblyInfo.cs b/KeyGo/Properties/AssemblyInfo.cs index 957e02b..caf2ebe 100644 --- a/KeyGo/Properties/AssemblyInfo.cs +++ b/KeyGo/Properties/AssemblyInfo.cs @@ -5,7 +5,7 @@ using System.Runtime.InteropServices; // 控制。更改这些特性值可修改 // 与程序集关联的信息。 [assembly: AssemblyTitle("KeyGo")] -[assembly: AssemblyDescription("通过注册热键 启动/切换到/最小化 预设应用的小工具")] +[assembly: AssemblyDescription("通过注册热键 启动/切换到/最小化 预设应用的小工具 - 开源地址:https://github.com/jie65535/KeyGo")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("KeyGo")] @@ -31,5 +31,5 @@ using System.Runtime.InteropServices; //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值 //通过使用 "*",如下所示: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("0.1.1")] +[assembly: AssemblyVersion("0.1.2")] [assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/KeyGo/Properties/app.manifest b/KeyGo/Properties/app.manifest new file mode 100644 index 0000000..d66e033 --- /dev/null +++ b/KeyGo/Properties/app.manifest @@ -0,0 +1,69 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file