Beispiel #1
0
        /// <summary>
        /// 保存设置
        /// </summary>
        private void Button2_Click(object sender, EventArgs e)
        {
            Regedit.Save("Software\\tty228\\udp_turn_off", "countdown", textBox1.Text);
            Regedit.Save("Software\\tty228\\udp_turn_off", "port", textBox2.Text);
            Regedit.Save("Software\\tty228\\udp_turn_off", "msg", textBox3.Text);
            switch (comboBox1.Text)
            {
            case "关机":
                关机ToolStripMenuItem_Click(null, null);
                break;

            case "休眠":
                休眠ToolStripMenuItem_Click(null, null);
                break;

            case "睡眠":
                睡眠ToolStripMenuItem_Click(null, null);
                break;

            case "锁定":
                锁定ToolStripMenuItem_Click(null, null);
                break;

            default:
                关机ToolStripMenuItem_Click(null, null);
                break;
            }
            if (checkBox1.Checked != 开机启动ToolStripMenuItem.Checked)
            {
                开机启动ToolStripMenuItem_Click(null, null);
            }
            Application.Restart();
        }
Beispiel #2
0
 private void 锁定ToolStripMenuItem_Click(object sender, EventArgs e)
 {
     关机ToolStripMenuItem.Checked = false;
     休眠ToolStripMenuItem.Checked = false;
     睡眠ToolStripMenuItem.Checked = false;
     锁定ToolStripMenuItem.Checked = true;
     comboBox1.Text = "锁定";
     Regedit.Save("Software\\tty228\\udp_turn_off", "Shutdown_Options", "LockWorkStation");
 }
Beispiel #3
0
 private void 开机启动ToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (开机启动ToolStripMenuItem.Checked == false)
     {
         checkBox1.Checked             = true;
         开机启动ToolStripMenuItem.Checked = true;
         Regedit.Save("Software\\Microsoft\\Windows\\CurrentVersion\\Run", "udp_turn_off", Process.GetCurrentProcess().MainModule.FileName);
     }
     else
     {
         checkBox1.Checked             = false;
         开机启动ToolStripMenuItem.Checked = false;
         Regedit.Delete("Software\\Microsoft\\Windows\\CurrentVersion\\Run", "udp_turn_off");
     }
 }