FormHotKey.cs

(开头部分) 3KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.IO;
using System.Windows.Forms;

namespace KeyGo
{
    public partial class FormHotKey : Form
    {
        public FormHotKey()
        {
            InitializeComponent();
        }

        public HotKeyItem HotKeyItem { get; set; }

        private void FormHotKey_Load(object sender, EventArgs e)
        {
            if (HotKeyItem != null)
            {
                TxtProcessName.Text = HotKeyItem.ProcessName;
                TxtStartupPath.Text = HotKeyItem.StartupPath;
                TxtHotKey.Text      = HotKeyItem.HotKey;
            }
        }

        private void BtnAccept_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(TxtProcessName.Text))
            {
                MessageBox.Show("请设置进程名", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (!string.IsNullOrWhiteSpace(TxtStartupPath.Text) && !File.Exists(TxtStartupPath.Text))
            {
                MessageBox.Show("请选择有效的启动路径", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (string.IsNullOrEmpty(TxtHotKey.Text))
            {
                MessageBox.Show("请设置快捷键", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            bool Modified = true;

            if (HotKeyItem == null)
                HotKeyItem = new HotKeyItem();
            else
                Modified = !(HotKeyItem.ProcessName == TxtProcessName.Text && HotKeyItem.StartupPath == TxtStartupPath.Text && HotKeyItem.HotKey == TxtHotKey.Text);

            if (Modified)
            {
                HotKeyItem.ProcessName = TxtProcessName.Text.Trim();
                HotKeyItem.StartupPath = TxtStartupPath.Text.Trim();
                HotKeyItem.HotKey = TxtHotKey.Text;
                DialogResult = DialogResult.OK;
            }
            else
            {
                DialogResult = DialogResult.Cancel;
后面还有 55 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。