private void toolStripBtnOpenAutoRun_Click(object sender, EventArgs e) { try { if (toolStripBtnOpenAutoRun.Text == "开机自启(√)") { HelperTools.StartupAutoRun(false); toolStripBtnOpenAutoRun.Text = "开机自启(x)"; toolStripBtnOpenAutoRun.Image = Resources.Red; HelperTools.UpdateAppConfig("OpenRun", Boolean.FalseString); SetLogText("关闭开机自启"); } else if (toolStripBtnOpenAutoRun.Text == "开机自启(x)") { HelperTools.StartupAutoRun(true); HelperTools.UpdateAppConfig("OpenRun", Boolean.TrueString); toolStripBtnOpenAutoRun.Text = "开机自启(√)"; toolStripBtnOpenAutoRun.Image = Resources.Green; SetLogText("设置开机自启"); } } catch (Exception ex) { Log.Error(ex.Message); SetLogText("设置失败"); } }
private void IniSetOpenRun() { if (HelperTools.GetConfigString("OpenRun") == Boolean.FalseString) { toolStripBtnOpenAutoRun.Text = "开机自启(x)"; toolStripBtnOpenAutoRun.Image = Resources.Red; } else if (HelperTools.GetConfigString("OpenRun") == Boolean.TrueString) { toolStripBtnOpenAutoRun.Text = "开机自启(√)"; toolStripBtnOpenAutoRun.Image = Resources.Green; } }