VSoft/Source/VSoft_Dll/Config/frmSetting.cs
鑫Intel 150b39ca18 ### 2021-09-07更新
------

#### VSoft    V1.0.2109.0701
- *.[新增]新增支持设置软件全局快捷键。
2021-09-07 17:29:44 +08:00

84 lines
3.1 KiB
C#

using ryCommon;
using ryCommonDb;
using ryControls;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using VSoft.Prams;
namespace VSoft.Config
{
public partial class FrmSetting : Skins.SKinForm
{
public FrmSetting()
{
InitializeComponent();
}
private void FrmSetting_Resize(object sender, EventArgs e)
{
}
private void BtnCancel_Click(object sender, EventArgs e)
{
this.DialogResult = DialogResult.Cancel;
}
private void BtnOK_Click(object sender, EventArgs e)
{
if (hotkeyTextBox1.HaveHotKey)
{
IDbInterface db = Itrycn_Db.CreateDataProvider(Itrycn_Db.dataType);
if (db.ConnDb(Itrycn_Db.SQLConnStr) == 1)
{
var ds = db.ReadData("select * from Softs where Hotkey='" + hotkeyTextBox1.HotKey + "' limit 1");
if (ds.HaveData())
{
Msg.ShowMsg("当前热键已经存在,请更换热键。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
ds.Dispose(); return;
}
ds.Dispose();
}
db.Free();
Config.Soft_Config.SetHotKeyList("showmain", "显示主界面", hotkeyTextBox1.HotKey);
}
else
{
Config.Soft_Config.RemoveHotKeyList("showmain");
}
mySetting.Save();
ryCommon.RyRegedit.RegRoot = Microsoft.Win32.RegistryHive.CurrentUser;
ryCommon.RyRegedit.SetAutoRun(ChkAutoRun.Checked, Soft_Info.Soft_Id, "\"" + Application.ExecutablePath.Replace("/","\\") + "\" "+ Soft_Info.Soft_Pram);
DialogResult = DialogResult.OK;
}
ryControls.RySetting mySetting = new ryControls.RySetting();
private void FrmSetting_Load(object sender, EventArgs e)
{
mySetting.FilePath = Soft_Info.UserDataFolder + "\\Setting.xml";
mySetting.Add("ShowMainHotKey", hotkeyTextBox1, "1+88");
mySetting.Add("OpenByClick", ChkOpenByClick);
mySetting.Add("HideAfterRun", ChkHideAfterRun,true);
mySetting.Add("ShowMainMouseKeyOn", ChkMouseKey, true);
mySetting.Add("ShowMainMouseKey", CbbMouseKeyShow, 0);
mySetting.Read();
ryCommon.RyRegedit.RegRoot = Microsoft.Win32.RegistryHive.CurrentUser;
ChkAutoRun.Checked = ryCommon.RyRegedit.IsAutoRun(Soft_Info.Soft_Id, "\"" + Application.ExecutablePath.Replace("/", "\\") + "\" "+ Soft_Info.Soft_Pram);
}
private void CbbMouseKeyShow_SelectedIndexChanged(object sender, EventArgs e)
{
}
private void ChkMouseKey_CheckedChanged(object sender, EventArgs e)
{
CbbMouseKeyShow.Enabled = ChkMouseKey.Checked;
}
}
}