-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHomePage.cs
More file actions
110 lines (97 loc) · 3.66 KB
/
HomePage.cs
File metadata and controls
110 lines (97 loc) · 3.66 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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
using System;
using System.Drawing;
using System.Windows.Forms;
namespace SortingVisualiser
{
public partial class HomePage : Form
{
//colours used for sort page
public static Color PrimaryColour { get; private set; }
public static Color SecondaryColour { get; private set; }
public HomePage()
{
InitializeComponent();
PrimaryColour = Color.FromArgb(255, 66, 133, 244);
SecondaryColour = Color.FromArgb(255, 219, 68, 55);
}
private void DataBtn_Click(object sender, EventArgs e)
{
DataPage data = new DataPage();
data.Size = new Size(this.Size.Width, this.Size.Height);
data.Location = new Point(this.Location.X, this.Location.Y);
data.Show();
SortPanel.Height = SortPanel.MinimumSize.Height;
this.Hide();
}
private void GameBtn_Click(object sender, EventArgs e)
{
GamePage game = new GamePage();
game.Size = new Size(this.Size.Width, this.Size.Height);
game.Location = new Point(this.Location.X, this.Location.Y);
game.Show();
SortPanel.Height = SortPanel.MinimumSize.Height;
this.Hide();
}
private void SortBtn_Click(object sender, EventArgs e)
{
//shows and hides sorting algorithms
if (SortPanel.Height == SortPanel.MaximumSize.Height)
{
SortPanel.Height = SortPanel.MinimumSize.Height;
}
else
{
SortPanel.Height = SortPanel.MaximumSize.Height;
}
}
private void BubbleSortBtn_Click(object sender, EventArgs e)
{
CreateSortPage(SortingName.Bubble);
}
private void MergeSortBtn_Click(object sender, EventArgs e)
{
CreateSortPage(SortingName.Merge);
}
private void QuickSortBtn_Click(object sender, EventArgs e)
{
CreateSortPage(SortingName.Quick);
}
private void RadixSortBtn_Click(object sender, EventArgs e)
{
CreateSortPage(SortingName.Radix);
}
private void InsertionSortBtn_Click(object sender, EventArgs e)
{
CreateSortPage(SortingName.Insertion);
}
private void SelectionSortBtn_Click(object sender, EventArgs e)
{
CreateSortPage(SortingName.Selection);
}
private void CreateSortPage(SortingName name)
{
SortPage sort = new SortPage(name);
sort.Size = new Size(this.Size.Width, this.Size.Height);
sort.Location = new Point(this.Location.X, this.Location.Y);
sort.Show();
SortPanel.Height = SortPanel.MinimumSize.Height;
this.Hide();
}
private void ColourBtn1_Click(object sender, EventArgs e)
{
//allows user to select colour
colorDialog1.ShowDialog();
//allows access to be used by bars and makes it the border colour
PrimaryColour = colorDialog1.Color;
ColourBtn1.FlatAppearance.BorderColor = colorDialog1.Color;
}
private void ColourBtn2_Click(object sender, EventArgs e)
{
//allows user to select colour
colorDialog2.ShowDialog();
//allows access to be used by bars and makes it the border colour
SecondaryColour = colorDialog2.Color;
ColourBtn2.FlatAppearance.BorderColor = colorDialog2.Color;
}
}
}