-
Notifications
You must be signed in to change notification settings - Fork 0
/
IntroForm.cs
77 lines (62 loc) · 2.61 KB
/
IntroForm.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
using System;
using System.Windows.Forms;
namespace BMI_Calculator
{
public partial class IntroForm : Form
{
public IntroForm()
{
InitializeComponent();
}
//Create variables to store info
//Imperial
public static decimal imperialH;
public static decimal imperialW;
public static double imperialbmi;
public static string imperialcategory;
//Metric
public static decimal metricH;
public static decimal metricW;
public static double metricbmi;
public static string metriccategory;
//If the Imperial radio button is checked the Imperial group is available
public void imperialRadio_CheckedChanged(object sender, EventArgs e)
{
imperialGroup.Enabled = imperialRadio.Checked;
}
//If the Metric radio button is checked the Metric group is available
public void metricRadio_CheckedChanged(object sender, EventArgs e)
{
metricGroup.Enabled = metricRadio.Checked;
}
//On submit open new window
private void submitButton_Click(object sender, EventArgs e)
{
//store values to be used for calculation and the next window
//Imperial
imperialH = heightIn.Value; //store value of height into variable
imperialW = weightLbs.Value;//store value of weight in to variable
imperialbmi = Program.imperial((double)heightIn.Value, (double)weightLbs.Value);//Call fucntion in Program
imperialcategory = Program.BmiCategory(imperialbmi);//Call function in Program
//Metric
metricH = heightCm.Value;
metricW = weightKg.Value;
metricbmi = Program.metric((double)heightCm.Value, (double)weightKg.Value); ;
metriccategory = Program.BmiCategory(metricbmi);
//Open BMI chart
BMITable openBMITable = new BMITable(); //this is the change, code for redirect
openBMITable.Show();
//Opens a different window depending if metric or imperial is chosen
if (imperialRadio.Checked == true)
{
ImperialResultForm openImperialResultForm = new ImperialResultForm(); //this is the change, code for redirect
openImperialResultForm.Show();
}
else if (metricRadio.Checked == true)
{
MetricResultForm openMetricResultForm = new MetricResultForm(); //this is the change, code for redirect
openMetricResultForm.Show();
}
}
}
}