-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathSettingsWindow.cs
More file actions
62 lines (53 loc) · 1.87 KB
/
SettingsWindow.cs
File metadata and controls
62 lines (53 loc) · 1.87 KB
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
using Microsoft.Win32;
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;
namespace deskdecorator
{
public partial class SettingsWindow : Form
{
public SettingsWindow()
{
InitializeComponent();
comboBox1.SelectedIndex = Program.gLanguage;
//pre-check/uncheck the box for autostart
if (tools.Utils.IsInStartup("DeskDecorator")) checkBox1.Checked = true;
}
private void checkBox1_CheckedChanged(object sender, EventArgs e)
{
if (checkBox1.Checked && !tools.Utils.IsInStartup("DeskDecorator"))
{
tools.Utils.AddToStartup("DeskDecorator");
}
else if (!checkBox1.Checked && tools.Utils.IsInStartup("DeskDecorator"))
{
tools.Utils.RemoveFromStartup("DeskDecorator");
}
}
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
int selectedLang = comboBox1.SelectedIndex;
if (Program.gLanguage == selectedLang) return;
switch(selectedLang)
{
case 0:
var key = Registry.CurrentUser.CreateSubKey(@"Software\DeskDecorator");
key?.SetValue("Language", 0, RegistryValueKind.DWord);
break;
case 1:
key = Registry.CurrentUser.CreateSubKey(@"Software\DeskDecorator");
key?.SetValue("Language", 1, RegistryValueKind.DWord);
break;
}
Program.gLanguage = selectedLang;
Application.Restart();
Application.Exit(); // Clean shutdown
}
}
}