This repository has been archived by the owner on Mar 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
start.cs
106 lines (96 loc) · 3.19 KB
/
start.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
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Microsoft.Win32;
using static System.Environment;
using System.Diagnostics;
namespace DatShell
{
public partial class start : Form
{
public start()
{
InitializeComponent();
}
private void start_Load(object sender, EventArgs e)
{
if (Environment.OSVersion.Version.Build < 10240)
{
button1.Text = "Control Panel";
button6.Hide();
}
RegistryKey hkcu = Registry.CurrentUser;
RegistryKey checkthemeing = hkcu.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize", true);
string lighttheme = "0";
try
{
lighttheme = checkthemeing.GetValue("SystemUsesLightTheme").ToString();
}
catch { }
if (lighttheme == "0")
{
this.BackColor = Color.FromArgb(49, 49, 49);
label1.ForeColor = Color.FromArgb(255, 255, 255);
label2.ForeColor = Color.FromArgb(255, 255, 255);
groupBox1.ForeColor = Color.FromArgb(255, 255, 255);
button4.ForeColor = Color.FromArgb(0, 0, 0);
button5.ForeColor = Color.FromArgb(0, 0, 0);
}
else
{
this.BackColor = Color.FromArgb(255, 255, 255);
label1.ForeColor = Color.FromArgb(0, 0, 0);
label2.ForeColor = Color.FromArgb(0, 0, 0);
groupBox1.ForeColor = Color.FromArgb(0, 0, 0);
button4.ForeColor = Color.FromArgb(255, 255, 255);
button5.ForeColor = Color.FromArgb(255, 255, 255);
}
label1.Text = "Welcome, " + Environment.UserName.ToString();
}
private void label2_Click(object sender, EventArgs e)
{
this.Close();
}
private void button1_Click(object sender, EventArgs e)
{
if (Environment.OSVersion.Version.Build < 10240)
{
Process.Start("control.exe");
} else
{
Process.Start("ms-settings://");
}
}
private void button2_Click(object sender, EventArgs e)
{
ShellSettings settingsform = new ShellSettings();
settingsform.ShowDialog();
}
private void button3_Click(object sender, EventArgs e)
{
webBrowser1.GoBack();
}
private void button4_Click(object sender, EventArgs e)
{
Process.Start("cmd.exe", "/c shutdown /s /t 0");
}
private void button5_Click(object sender, EventArgs e)
{
Process.Start("cmd.exe", "/c shutdown /r /t 0");
}
private void button6_Click(object sender, EventArgs e)
{
Process.Start("control.exe");
}
private void button8_Click(object sender, EventArgs e)
{
Process.Start("logoff.exe");
}
}
}