private void chkAutoRun_CheckedChanged(object sender, EventArgs e) { if (chkAutoRun.Checked) { AutoRunHelper.SetAutoRun(Application.StartupPath + "\\Nikita.Assist.WcfHost.exe", true); MessageBox.Show(@"开启启动设置成功,下次开机后会自动启动服务!"); } if (!chkAutoRun.Checked) { AutoRunHelper.SetAutoRun(Application.StartupPath + "\\Nikita.Assist.WcfHost.exe", false); MessageBox.Show(@"取消开机启动成功!"); } }
private void chkAutoRun_CheckedChanged(object sender, EventArgs e) { try { if (chkAutoRun.Checked) { AutoRunHelper.SetAutoRun(Application.StartupPath + "\\H.M.WcfDataHost.exe", true); MessageBox.Show(@"开启启动设置成功,下次开机后会自动启动服务!"); } if (!chkAutoRun.Checked) { AutoRunHelper.SetAutoRun(Application.StartupPath + "\\H.M.WcfDataHost.exe", false); MessageBox.Show(@"取消开机启动成功!"); } } catch (Exception ex) { throw ex; } }