private void checkBox1_CheckedChanged(object sender, EventArgs e) {//开机启动选择框改变事件 Log.debug("CheckedChanged value:" + checkBox1.Checked); Log.debug("ExecutablePath:" + Application.ExecutablePath); AutoRun.setAutoRun(appName, Application.ExecutablePath, checkBox1.Checked); RegConfig.saveValue("autorun", checkBox1.Checked ? 1 : 0); }
private void InitComponent() { checkBox1.Checked = RegConfig.getValue("autorun", 0) == 1; checkBox2.Checked = RegConfig.getValue("hasRegisterHotKey", 0) == 1; setHotKey(); label2.Text = "启动程序 : " + RegConfig.getValue("openFile", "cmd"); //设置自启动 AutoRun.setAutoRun(appName, Application.ExecutablePath, checkBox1.Checked); //注册热键 if (RegConfig.getValue("hasRegisterHotKey", 0) == 1) { registerHotKey(); } //隐藏主窗口 if (RegConfig.getValue("hide", 0) == 1) {//这里之所以用一个线程是因为程序刚启动的时候调用隐藏窗口不起作用 new Thread(new ThreadStart(delyHide)).Start(); } }