Esempio n. 1
0
        //Setter og lagrer strøminstillinger
        private void button9_Click(object sender, EventArgs e)
        {
            var         powercmd   = new functions();
            RegistryKey NAVinfoKey = Registry.CurrentUser.OpenSubKey(@"Software\NAVinfo", true);

            if (checkedListBox1.SelectedIndex == 0)
            {
                var runpowercmd = powercmd.ExecuteCommand("c:\\windows\\system32\\powercfg.exe", "-setacvalueindex 381b4222-f694-41f0-9685-ff5bb260df2e 4f971e89-eebd-4455-a8de-9e59040e7347 5ca83367-6e45-459f-a27b-476b1d01c936 0");
                NAVinfoKey.SetValue("stromvalgAC", "0");
            }
            else if (checkedListBox1.SelectedIndex == 1)
            {
                var runpowercmd = powercmd.ExecuteCommand("c:\\windows\\system32\\powercfg.exe", "-setacvalueindex 381b4222-f694-41f0-9685-ff5bb260df2e 4f971e89-eebd-4455-a8de-9e59040e7347 5ca83367-6e45-459f-a27b-476b1d01c936 1");
                NAVinfoKey.SetValue("stromvalgAC", "1");
            }
            else if (checkedListBox1.SelectedIndex == 2)
            {
                var runpowercmd = powercmd.ExecuteCommand("c:\\windows\\system32\\powercfg.exe", "-setacvalueindex 381b4222-f694-41f0-9685-ff5bb260df2e 4f971e89-eebd-4455-a8de-9e59040e7347 5ca83367-6e45-459f-a27b-476b1d01c936 2");
                NAVinfoKey.SetValue("stromvalgAC", "2");
            }
            else if (checkedListBox1.SelectedIndex == 3)
            {
                var runpowercmd = powercmd.ExecuteCommand("c:\\windows\\system32\\powercfg.exe", "-setacvalueindex 381b4222-f694-41f0-9685-ff5bb260df2e 4f971e89-eebd-4455-a8de-9e59040e7347 5ca83367-6e45-459f-a27b-476b1d01c936 3");
                NAVinfoKey.SetValue("stromvalgAC", "3");
            }


            if (checkedListBox2.SelectedIndex == 0)
            {
                var runpowercmd = powercmd.ExecuteCommand("c:\\windows\\system32\\powercfg.exe", "-setdcvalueindex 381b4222-f694-41f0-9685-ff5bb260df2e 4f971e89-eebd-4455-a8de-9e59040e7347 5ca83367-6e45-459f-a27b-476b1d01c936 0");
                NAVinfoKey.SetValue("stromvalgDC", "0");
            }
            else if (checkedListBox2.SelectedIndex == 1)
            {
                var runpowercmd = powercmd.ExecuteCommand("c:\\windows\\system32\\powercfg.exe", "-setdcvalueindex 381b4222-f694-41f0-9685-ff5bb260df2e 4f971e89-eebd-4455-a8de-9e59040e7347 5ca83367-6e45-459f-a27b-476b1d01c936 1");
                NAVinfoKey.SetValue("stromvalgDC", "1");
            }
            if (checkedListBox2.SelectedIndex == 2)
            {
                var runpowercmd = powercmd.ExecuteCommand("c:\\windows\\system32\\powercfg.exe", "-setdcvalueindex 381b4222-f694-41f0-9685-ff5bb260df2e 4f971e89-eebd-4455-a8de-9e59040e7347 5ca83367-6e45-459f-a27b-476b1d01c936 2");
                NAVinfoKey.SetValue("stromvalgDC", "2");
            }
            if (checkedListBox2.SelectedIndex == 3)
            {
                var runpowercmd = powercmd.ExecuteCommand("c:\\windows\\system32\\powercfg.exe", "-setdcvalueindex 381b4222-f694-41f0-9685-ff5bb260df2e 4f971e89-eebd-4455-a8de-9e59040e7347 5ca83367-6e45-459f-a27b-476b1d01c936 3");
                NAVinfoKey.SetValue("stromvalgDC", "3");
            }

            button9.Text = "Lagret OK";
        }
Esempio n. 2
0
        private void button17_Click(object sender, EventArgs e)
        {
            button17.BackColor = Color.Orange;
            button17.Text      = "Resetter..";
            var command  = new functions();
            var resettSM = command.ExecuteCommand("powershell", "-executionpolicy bypass c:\\Windows\\Mob\\ResetStartmenyPS.ps1");

            if (resettSM)
            {
                button17.BackColor = Color.Green;
                button17.Text      = "OK";
            }
            if (!(resettSM))
            {
                button17.BackColor = Color.Red;
                button17.Text      = "Feilet";
                textBox2.Text      = "Restting av Start-Menyen feilet";
            }
        }
Esempio n. 3
0
        private void button10_Click(object sender, EventArgs e)
        {
            var         command    = new functions();
            RegistryKey NAVinfoKey = Registry.CurrentUser.OpenSubKey(@"Software\NAVinfo", true);

            try
            {
                var resett = command.ExecuteCommand("c:\\windows\\system32\\powercfg.exe", "-restoredefaultschemes");
                button10.Text = "Resatt";
                NAVinfoKey.SetValue("stromvalgAC", "1");
                NAVinfoKey.SetValue("stromvalgDC", "2");
                if (!(resett))
                {
                    button10.Text = "Feilet";
                }
            }
            catch
            {
                button10.Text = "Feilet";
            }
        }