-
Notifications
You must be signed in to change notification settings - Fork 0
/
Settings.cs
212 lines (188 loc) · 6.95 KB
/
Settings.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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Security.Cryptography;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Net.Mail;
using System.Net;
using System.Drawing.Drawing2D;
namespace PcComponentsMonitor
{
public partial class Settings : Form
{
private bool dont = false;
private bool enableMoving = false;
private Point initialClickedPoint = new Point();
public Settings()
{
InitializeComponent();
}
private void Settings_Load(object sender, EventArgs e)
{
//Change the checks state
chbxSendNotifactionns.Checked = Properties.Settings.Default.sendMessage;
dont = true;
checkBox1.Checked = Properties.Settings.Default.Darkmode;
comboBox1.Text = Properties.Settings.Default.Position;
comboBox2.Text = Properties.Settings.Default.DefaultPanel;
chcIgnoreTskbar.Checked = Properties.Settings.Default.IgnoreTaskbar;
dont = false;
if (Properties.Settings.Default.Darkmode)
{
this.BackColor = Color.FromArgb(41, 41, 41);
this.ForeColor = Color.White;
}
}
private void chbxSendNotifactionns_CheckedChanged(object sender, EventArgs e)
{
//send notifications setting
CheckBox box = sender as CheckBox;
Properties.Settings.Default.sendMessage = box.Checked;
Properties.Settings.Default.Save();
}
private void btnSettings_Click(object sender, EventArgs e)
{
this.Close();
}
private void checkBox1_CheckedChanged(object sender, EventArgs e)
{
//Dark mode setting
CheckBox check = sender as CheckBox;
Properties.Settings.Default.Darkmode = check.Checked;
Properties.Settings.Default.Save();
if (Properties.Settings.Default.Darkmode)
{
this.BackColor = Color.FromArgb(41, 41, 41);
this.ForeColor = Color.White;
this.panelName.ForeColor = ForeColor;
this.btnExit.BackColor = Color.FromArgb(55, 55, 55);
this.btnExit.FlatAppearance.BorderColor = Color.FromArgb(55, 55, 55);
this.btnHide.BackColor = Color.FromArgb(55, 55, 55);
this.btnHide.FlatAppearance.BorderColor = Color.FromArgb(55, 55, 55);
this.panelName.BackColor = Color.FromArgb(55, 55, 55);
}
else
{
this.BackColor = Color.White;
this.ForeColor = Color.Black;
this.panelName.ForeColor = ForeColor;
this.btnExit.BackColor = Color.FromArgb(224, 224, 224);
this.btnExit.FlatAppearance.BorderColor = Color.FromArgb(224, 224, 224);
this.btnHide.BackColor = Color.FromArgb(224, 224, 224);
this.btnHide.FlatAppearance.BorderColor = Color.FromArgb(224, 224, 224);
this.panelName.BackColor = Color.FromArgb(224, 224, 224);
}
}
//When user change position setting
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
if (dont)
{
return;
}
ComboBox comboBox = sender as ComboBox;
btnApply.Visible = true;
Properties.Settings.Default.Position = comboBox.Text;
Properties.Settings.Default.DefualtPosY = 0;
Properties.Settings.Default.DefaultPosX = 0;
Properties.Settings.Default.Save();
}
//Button apply click event
private void btnApply_Click(object sender, EventArgs e)
{
if (Properties.Settings.Default.ChangeDefaultPosition)
{
Properties.Settings.Default.ChangeDefaultPosition = false;
Properties.Settings.Default.Save();
App.reason = "change pos and apply";
this.Close();
}
App.reason = "apply";
this.Close();
}
//Button ignore taskbar click event
private void chcIgnoreTskbar_CheckedChanged(object sender, EventArgs e)
{
if (dont)
{
return;
}
CheckBox checkBox = sender as CheckBox;
Properties.Settings.Default.IgnoreTaskbar = checkBox.Checked;
btnApply.Visible = true;
Properties.Settings.Default.Save();
}
//Button exit click event
private void btnExit_Click(object sender, EventArgs e)
{
this.Close();
}
//Button hide click event
private void btnHide_Click(object sender, EventArgs e)
{
this.WindowState = FormWindowState.Minimized;
}
//When user whants to move the window
private void panelName_MouseDown(object sender, MouseEventArgs e)
{
enableMoving = true;
initialClickedPoint = e.Location;
}
private void panelName_MouseUp(object sender, MouseEventArgs e)
{
enableMoving = false;
}
private void panelName_MouseMove(object sender, MouseEventArgs e)
{
if (enableMoving)
{
this.Location = new Point(e.X + this.Left - initialClickedPoint.X,
e.Y + this.Top - initialClickedPoint.Y);
}
}
//Let user to change defualt position
private void checkBox2_CheckedChanged(object sender, EventArgs e)
{
Properties.Settings.Default.ChangeDefaultPosition = true;
Properties.Settings.Default.Save();
btnApply.Visible=true;
}
private void imgHelpIgnerTskbr_MouseHover(object sender, EventArgs e)
{
panelHelpChngDfltPos.Visible = true;
}
private void imgHelpIgnerTskbr_MouseLeave(object sender, EventArgs e)
{
panelHelpChngDfltPos.Visible = false;
}
private void btnChangelog_Click(object sender, EventArgs e)
{
Form changelog = new Changelog();
changelog.Show();
}
private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
{
if (dont)
{
return;
}
ComboBox cb = sender as ComboBox;
Properties.Settings.Default.DefaultPanel = cb.Text;
Properties.Settings.Default.Save();
btnApply.Visible = true;
}
private void pictureBox1_MouseHover(object sender, EventArgs e)
{
pnlHelpDefPnl.Visible = true;
}
private void pictureBox1_MouseLeave(object sender, EventArgs e)
{
pnlHelpDefPnl.Visible = false;
}
}
}