This repository was archived by the owner on Jul 29, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathManager.cs
More file actions
88 lines (78 loc) · 1.64 KB
/
Manager.cs
File metadata and controls
88 lines (78 loc) · 1.64 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
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
using System;
using System.Windows.Forms;
namespace MovableMap
{
public partial class Manager : Form
{
// Data
private MapImage mapImage;
private int posX;
private int posY;
private bool hide;
public Manager(MapImage mapImage)
{
InitializeComponent();
this.mapImage = mapImage;
Init();
numericUpDown1.Value = posX;
numericUpDown2.Value = posY;
ReloadMap();
}
private void Init()
{
if (!int.TryParse(Settings.Default.posX, out posX))
{
posX = 2890;
}
if (!int.TryParse(Settings.Default.posY, out posY))
{
posY = 1020;
}
if (!bool.TryParse(Settings.Default.Hide.ToString(), out hide))
{
hide = false;
}
}
private void numericUpDown1_ValueChanged(object sender, EventArgs e)
{
if (int.TryParse(numericUpDown1.Value.ToString(), out posX))
{
ReloadMap();
}
}
private void numericUpDown2_ValueChanged(object sender, EventArgs e)
{
if (int.TryParse(numericUpDown2.Value.ToString(), out posY))
{
ReloadMap();
}
}
private void checkBox1_CheckedChanged(object sender, EventArgs e)
{
hide = checkBox1.Checked;
ReloadMap();
}
private void ReloadMap()
{
mapImage.UpdateForm(posX, posY, hide);
}
private void button1_Click(object sender, EventArgs e)
{
Application.Exit();
}
private void resetButton_Click(object sender, EventArgs e)
{
posX = 2890;
posY = 1020;
hide = false;
ReloadMap();
}
private void SaveButton_Click(object sender, EventArgs e)
{
Settings.Default.posX = posX.ToString();
Settings.Default.posY = posY.ToString();
Settings.Default.Hide = hide;
Settings.Default.Save();
}
}
}