aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS.WinForms/Applications
diff options
context:
space:
mode:
authorlempamo <[email protected]>2017-02-25 12:18:08 -0500
committerlempamo <[email protected]>2017-02-25 12:18:08 -0500
commitd23d4826f0302770284f51966e6b24290fab52d3 (patch)
tree8205e40ae5ebe10ab0c78acd225a06c9da558e4c /ShiftOS.WinForms/Applications
parent6a50e9fdda42b8a5cc23594e87b1a6cc2a39cc4c (diff)
downloadshiftos_thereturn-d23d4826f0302770284f51966e6b24290fab52d3.tar.gz
shiftos_thereturn-d23d4826f0302770284f51966e6b24290fab52d3.tar.bz2
shiftos_thereturn-d23d4826f0302770284f51966e6b24290fab52d3.zip
Added plus & equals functionality
Diffstat (limited to 'ShiftOS.WinForms/Applications')
-rw-r--r--ShiftOS.WinForms/Applications/Calculator.Designer.cs1
-rw-r--r--ShiftOS.WinForms/Applications/Calculator.cs24
2 files changed, 24 insertions, 1 deletions
diff --git a/ShiftOS.WinForms/Applications/Calculator.Designer.cs b/ShiftOS.WinForms/Applications/Calculator.Designer.cs
index 507e382..1f9008e 100644
--- a/ShiftOS.WinForms/Applications/Calculator.Designer.cs
+++ b/ShiftOS.WinForms/Applications/Calculator.Designer.cs
@@ -188,6 +188,7 @@ namespace ShiftOS.WinForms.Applications
this.buttonEquals.TabIndex = 12;
this.buttonEquals.Text = "=";
this.buttonEquals.UseVisualStyleBackColor = true;
+ this.buttonEquals.Click += new System.EventHandler(this.buttonEquals_Click);
//
// buttonPlus
//
diff --git a/ShiftOS.WinForms/Applications/Calculator.cs b/ShiftOS.WinForms/Applications/Calculator.cs
index ee5c2e3..c79494f 100644
--- a/ShiftOS.WinForms/Applications/Calculator.cs
+++ b/ShiftOS.WinForms/Applications/Calculator.cs
@@ -136,14 +136,36 @@ namespace ShiftOS.WinForms.Applications
private void buttonPlus_Click(object sender, EventArgs e)
{
- if (operationnumber == 0 && activeoperation != 1)
+ if (operationnumber == 0 && activeoperation == 0)
{
operationnumber = currentnumber;
activeoperation = 1;
} else
{
+ solve();
+ operationnumber = currentnumber;
+ activeoperation = 1;
+ }
+ }
+
+ private void solve()
+ {
+ switch (activeoperation)
+ {
+ case 1:
+ numBox.Text = (currentnumber + operationnumber).ToString();
+ break;
+ default:
+ break;
}
}
+
+ private void buttonEquals_Click(object sender, EventArgs e)
+ {
+ solve();
+ operationnumber = 0;
+ activeoperation = 0;
+ }
}
}