//this method negates the number if positive and vice versa private void NegateOrNot(object sender, EventArgs e) { var btn = (Button)sender; Action = new NextMove(resultScreen, btn); resultScreen.Text = Action.NegateOrNot(); }
//this method handles all number buttons pressed, including '.' and '+/-' private void buttonClick(object sender, EventArgs e) { var btn = (Button)sender; //the below instantiates a class called NextMove and passes it to 'Action' of the same class type //the class handles negation and checking for '.' in the display of the calculator. Action = new NextMove(resultScreen, btn); if ((resultScreen.Text == "0") || (isOperationPerfomed)) { resultScreen.Clear(); isOperationPerfomed = false; } Action.ContainsDotOrNot(); isOperationPerfomed = false; }