-
Notifications
You must be signed in to change notification settings - Fork 2
/
GametokenDialog.cs
74 lines (62 loc) · 2.25 KB
/
GametokenDialog.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
using System;
using System.Drawing;
using System.Windows.Forms;
namespace CardboardLauncher
{
public partial class GametokenDialog : Form
{
public string gameToken = "";
private bool drag = false; // determine if we should be moving the form
private Point startPoint = new Point(0, 0); // also for the moving
public GametokenDialog()
{
InitializeComponent();
this.Text = LauncherInfo.gameName + " Launcher";
launcherTitle.Text = LauncherInfo.gameName + " Launcher";
}
private void GametokenDialog_FormClosing(object sender, FormClosingEventArgs e)
{
if(gameTokenBox.Text.Length.Equals(64)) gameToken = gameTokenBox.Text;
}
private void GametokenDialog_Load(object sender, EventArgs e)
{
gameTokenBox.Text = gameToken;
}
private void gameTokenBox_TextChanged(object sender, EventArgs e)
{
gameTokenBtn.Enabled = gameTokenBox.Text.Length.Equals(64);
}
private void closeBtn_MouseClick(object sender, MouseEventArgs e)
{
this.Close();
}
private void closeBtn_MouseDown(object sender, MouseEventArgs e)
{
closeBtn.BackgroundImage = CardboardLauncher.Properties.Resources.close_click;
}
private void closeBtn_MouseUp(object sender, MouseEventArgs e)
{
closeBtn.BackgroundImage = CardboardLauncher.Properties.Resources.close;
}
private void Title_MouseUp(object sender, MouseEventArgs e)
{
this.drag = false;
}
private void Title_MouseDown(object sender, MouseEventArgs e)
{
this.startPoint = e.Location;
this.drag = true;
}
private void Title_MouseMove(object sender, MouseEventArgs e)
{
if(this.drag)
{ // if we should be dragging it, we need to figure out some movement
Point p1 = new Point(e.X, e.Y);
Point p2 = this.PointToScreen(p1);
Point p3 = new Point(p2.X - this.startPoint.X,
p2.Y - this.startPoint.Y);
this.Location = p3;
}
}
}
}