-
Notifications
You must be signed in to change notification settings - Fork 0
/
Form3.cs
109 lines (99 loc) · 3.59 KB
/
Form3.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
using Microsoft.Win32;
using System;
using System.Diagnostics;
using System.Drawing;
using System.Windows.Forms;
namespace Process_Digger
{
public partial class FormNewProcess : Form
{
public FormNewProcess()
{
InitializeComponent();
}
private void button2_Click(object sender, EventArgs e)
{
this.Close();
}
private void button1_Click(object sender, EventArgs e)
{
processStart();
}
private void textProcessName_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == (char)13)
{
processStart();
}
}
void processStart()
{
try
{
if (textProcessName.Text != "")
{
if (checkStartSystem.Checked)
{
Process proc = new Process();
proc.StartInfo.FileName = textProcessName.Text;
proc.StartInfo.UseShellExecute = true;
proc.StartInfo.Verb = "runas";
proc.Start();
}
else
{
Process.Start(textProcessName.Text);
}
}
else { MessageBox.Show($"Введите название процесса", "Process Digger - Ошибка запуска процесса", MessageBoxButtons.OK, MessageBoxIcon.Error); }
}
catch
{ MessageBox.Show($"Процесс \"{textProcessName.Text}\" не удалось запустить. Проверьте название", "Process Digger - Ошибка запуска процесса", MessageBoxButtons.OK, MessageBoxIcon.Error); }
}
private void FormNewProcess_Load(object sender, EventArgs e)
{
this.TopMost = Properties.Settings.Default.topMost;
setTheme();
}
void setTheme()
{
switch (Properties.Settings.Default.theme)
{
case 0: //авто
{
try
{
RegistryKey lightThemeStatus = Registry.CurrentUser.OpenSubKey("SOFTWARE").OpenSubKey("Microsoft").OpenSubKey("Windows").OpenSubKey("CurrentVersion").OpenSubKey("Themes").OpenSubKey("Personalize");
if (Convert.ToInt32(lightThemeStatus.GetValue("AppsUseLightTheme")) == 0)
{
setDarkTheme();
}
}
catch { }
break;
}
case 2: //темная
{
setDarkTheme();
break;
}
case 3: //черная(AMOLED)
{
break;
}
}
}
void setDarkTheme()
{
this.BackColor = Color.FromArgb(25, 25, 25);
labelEnterProcess.ForeColor = Color.White;
checkStartSystem.ForeColor = Color.White;
textProcessName.ForeColor = Color.White;
textProcessName.BackColor = Color.FromArgb(32, 32, 32);
btnStart.ForeColor = Color.White;
btnStart.BackColor = Color.FromArgb(32, 32, 32);
btnCancel.ForeColor = Color.White;
btnCancel.BackColor = Color.FromArgb(32, 32, 32);
}
}
}