清理代码

This commit is contained in:
筱傑 2021-04-29 13:17:26 +08:00
parent 077b8b1e13
commit c7ac1341cc
7 changed files with 9 additions and 22 deletions

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>
</configuration>

View File

@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.Xml.Serialization;
namespace KeyGo
@ -29,7 +24,6 @@ namespace KeyGo
/// </value>
public bool CloseToHide { get; set; } = true;
/// <summary>
/// Loads the XML.
/// </summary>
@ -68,4 +62,4 @@ namespace KeyGo
}
}
}
}
}

View File

@ -151,6 +151,7 @@ namespace KeyGo
[DllImport("User32.dll")]
private static extern bool ShowWindowAsync(IntPtr hWnd, int cmdShow);
[DllImport("User32.dll")]
private static extern bool ShowWindow(IntPtr hWnd, int cmdShow);

View File

@ -5,7 +5,7 @@ using System.Windows.Forms;
namespace KeyGo
{
public class AppHotKey
public static class AppHotKey
{
/// <summary>
/// 注册热键
@ -17,14 +17,7 @@ namespace KeyGo
public static void RegKey(IntPtr hwnd, int hotKey_id, KeyModifiers keyModifiers, Keys key)
{
if (!RegisterHotKey(hwnd, hotKey_id, keyModifiers, key))
{
throw new Win32Exception();
//int code = Marshal.GetLastWin32Error();
//if (code == 1409)
// MessageBox.Show("热键被占用!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
//else
// MessageBox.Show("注册热键失败!错误代码:" + code.ToString(), "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
/// <summary>
@ -38,7 +31,6 @@ namespace KeyGo
UnregisterHotKey(hwnd, hotKey_id);
}
//如果函数执行成功返回值不为0。
//如果函数执行失败返回值为0。要得到扩展错误信息调用GetLastError。
[DllImport("user32.dll", SetLastError = true)]

View File

@ -12,6 +12,7 @@ namespace KeyGo
}
public HotKeyItem HotKeyItem { get; set; }
private void FormHotKey_Load(object sender, EventArgs e)
{
if (HotKeyItem != null)
@ -110,6 +111,5 @@ namespace KeyGo
TxtStartupPath.Text = frm.FileName;
}
}
}
}

View File

@ -325,6 +325,6 @@ namespace KeyGo
}
}
#endregion
#endregion
}
}

View File

@ -21,7 +21,7 @@ using System.Runtime.InteropServices;
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("09416937-868e-4ee4-80ee-5e6fa81e2811")]
// 程序集的版本信息由下列四个值组成:
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
@ -32,4 +32,4 @@ using System.Runtime.InteropServices;
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.1.2")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]