private void TriSwitch_Click(object sender, EventArgs e) { swap = swap * -1; if (swap < 0) { SpecialCase tri = new SpecialCase(a, s); NonRightSolve(tri); tri.TriType = 2; } else { NonRight tri = new NonRight(a, s); NonRightSolve(tri); } }
/// <summary> /// This grabs the variables from their textboxes and assigns them into an array, using a counter variable /// to ensure the proper amount of information is provided. /// </summary> private void Solve() { { WarningLabel.Text = ""; WarningLabel.Visible = false; TriSwitch.Visible = false; int i = 0; i += BoxStatus_enter(Side1); i += BoxStatus_enter(Side2); i += BoxStatus_enter(Side3); i += BoxStatus_enter(Angle1); i += BoxStatus_enter(Angle2); i += BoxStatus_enter(Angle3); if (i < 3) { WarningLabel.Text = string.Concat("Please enter at least 3 fields. "); WarningLabel.Visible = true; } else if (Side1.Text.Equals(String.Empty) && Side2.Text.Equals(string.Empty) && Side3.Text.Equals(string.Empty)) { WarningLabel.Text = "Please enter at least one side."; WarningLabel.Visible = true; } else { s[0] = assignment(Side1); s[1] = assignment(Side2); s[2] = assignment(Side3); a[0] = assignment(Angle1); a[1] = assignment(Angle2); a[2] = assignment(Angle3); if (a.Contains(90)) { RightTriangle tri = new RightTriangle(a, s); RightSolve(tri); } else { NonRight tri = new NonRight(a, s); NonRightSolve(tri); } } } }