public void Enqueue(Calculation calculation) { Calculations.Enqueue(calculation); if (Calculations.Count > StackSize) { Calculations.Dequeue(); } }
private void Button_Click(object sender, RoutedEventArgs e) { Calculation c = new Calculation(calculationInput.Text); string result_list; try { c.calculate(); result_list = calculationInput.Text + " = " + c.getResult();// + "\n" + calculationOutput.Text; } catch (InvalidTokenException ite) { result_list = calculationInput.Text.Trim() + " ---> ERROR"; #if ERRORMESSAGES result_list += ": "+ite.Message; #endif } catch (Exception ex) { result_list = calculationInput.Text.Trim() + " ---> ERROR"; #if ERRORMESSAGES result_list += ": " + ex.Message; #endif } //calculationOutput.Items.Insert(0, result_list); //calculationOutput.Text = "+\n3\t4"; calculationOutput.Text = result_list + '\n' + calculationOutput.Text; }
public Presenter(Form1 form1) { this.calc = new Calculation(); this.form1 = form1; this.form1.Calculate += Form1_Calculate; }
public Calculation(Calculation previous) { number1 = previous.number1; number2 = previous.number2; @operator = previous.@operator; }
/// <summary> /// Initializes a new instance of the <see cref="frmAddStrip"/> class. /// </summary> public frmAddStrip() { InitializeComponent(); calculation = new Calculation(lstCalculationLines); }
//clear display private void clearClick(object sender, RoutedEventArgs e) { setDisplay(" "); newCalc = new Calculation(); }
//turn calculator off private void offClick(object sender, RoutedEventArgs e) { setDisplay("Off"); newCalc = new Calculation(); isOff = true; }