//加载用户配置 public void UserConfig() { //保存目录 if (String.Equals(Settings.Default.ImagePath, "")) { textBox1.Text = ""; } else { textBox1.Text = Settings.Default.ImagePath; } //开机启动 if (OnBoot.TaskIsExists("one_fuck_one_tu")) { checkBox1.Checked = true; } else { checkBox1.Checked = false; } //自动保存壁纸 if (Settings.Default.SaveImage) { checkBox2.Checked = true; } else { checkBox2.Checked = false; } //更新壁纸自动推出 if (Settings.Default.UpdateClose) { checkBox3.Checked = true; } else { checkBox3.Checked = false; } //分辨率选择,真为1920,假为1366 if (Settings.Default.Resolution) { radioButton1.Checked = true; } else { radioButton2.Checked = true; } //快捷键选择 comboBox1.SelectedIndex = Settings.Default.ComboBox; }
private void checkBox1_CheckedChanged(object sender, EventArgs e) { //开机启启 if (checkBox1.Checked) { string taskname = "one_fuck_one_tu"; if (!OnBoot.TaskIsExists(taskname)) { if (UserAdmin.AdminIsExists()) { string strAssName = Application.ExecutablePath; OnBoot.TaskCreate(taskname, strAssName); } else { //重启获取管理员权限 UserAdmin.Upgrade(); } } } else { string taskname = "one_fuck_one_tu"; if (OnBoot.TaskIsExists(taskname)) { if (UserAdmin.AdminIsExists()) { OnBoot.DeleteTask(taskname); } else { //重启获取管理员权限 UserAdmin.Upgrade(); } } } }