-
Notifications
You must be signed in to change notification settings - Fork 0
/
FormMain.cs
64 lines (59 loc) · 1.81 KB
/
FormMain.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
using System;
using System.Drawing;
using System.Windows.Forms;
namespace anxiety
{
public partial class FormMain : Form
{
private readonly Random random;
public FormMain()
{
InitializeComponent();
random = new Random();
}
private void DisplayWarning()
{
MessageBox.Show("", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
}
private void SetTimerWarningInterval()
{
int type = random.Next(3);
int interval;
switch(type)
{
case 2:
interval = random.Next(300, 1000);
break;
case 3:
interval = random.Next(1000, 60000);
break;
case 0:
case 1:
default:
interval = random.Next(15, 300);
break;
}
TimerWarning.Interval = interval * 100;
}
private void TimerWarning_Tick(object sender, EventArgs e)
{
TimerWarning.Enabled = false;
TimerWarning.Stop();
DisplayWarning();
SetTimerWarningInterval();
TimerWarning.Enabled = true;
TimerWarning.Start();
}
private void TimerMoveEyes_Tick(object sender, EventArgs e)
{
TimerMoveEyes.Enabled = false;
TimerMoveEyes.Stop();
int x = random.Next(SystemInformation.VirtualScreen.Width);
int y = random.Next(SystemInformation.VirtualScreen.Height);
Location = new Point(x, y);
TimerMoveEyes.Interval = random.Next(15, 300) * 100;
TimerMoveEyes.Enabled = true;
TimerMoveEyes.Start();
}
}
}