//Button = private void BtnSummarize_Click(object sender, RoutedEventArgs e) { //We add the button's text to the TbCalculationProgress textblock TbCalculationProgress.Text += "="; //The most recently used operator is required for the right calculation method string CalculationProgress = TbCalculationProgress.Text; for (int i = 0; i < CalculationProgress.Length; i++) { if (CalculationProgress[i].ToString() == "+") { LastOperatorUsedByUser = "******"; } else if (CalculationProgress[i].ToString() == "-") { LastOperatorUsedByUser = "******"; } else if (CalculationProgress[i].ToString() == "/") { LastOperatorUsedByUser = "******"; } else if (CalculationProgress[i].ToString() == "*") { LastOperatorUsedByUser = "******"; } } //Storing the current number which is inside the tbINputNumbers textblock,Adding current number to Memory array //Incrementing MemoryIndex by one //Storing the calculation in the result variable (Rounding the result) //Adding result to Memory and ResultMemory //Incrementing the navigator by one and setting the navigator on this side to the new value //User cannot delete last number of the result, setting NoCalculationsYet to false as we've just calculated CurrentNumber = Convert.ToDouble(TbInputNumbers.Text); Calculations.AddToMemory(CurrentNumber); Result = Calculations.Summarize(LastOperatorUsedByUser); Calculations.IncrementMemoryIndexByOne(); Math.Round(Result, 10); Calculations.AddToMemory(Result); Calculations.AddToResultMemory(Result); Calculations.IncrementResultMemoryIndexByOne(); Calculations.GiveBackResultMemoryValues(); Calculations.IncrementResultMemoryNavigatorByOne(); UserCanDeleteLastNumber = true; NoCalculationsYet = false; //Setting this variable to false as the user can use division or multiplication, because the Memory array is not empty NewCalculation = false; //Setting the ResultMemory textblocks's text to the result TbResultMemory.Text = Result.ToString(); //After the calculation this variable will always be one CalculationIsOnGoing = 1; //Setting the TbCalculationProgress's text to default TbCalculationProgress.Text = ""; //Setting the TbInputNumbers Textblock's text to default after every calculation TbInputNumbers.Text = "0"; }