diff options
| author | lempamo <[email protected]> | 2017-02-25 12:18:08 -0500 |
|---|---|---|
| committer | lempamo <[email protected]> | 2017-02-25 12:18:08 -0500 |
| commit | d23d4826f0302770284f51966e6b24290fab52d3 (patch) | |
| tree | 8205e40ae5ebe10ab0c78acd225a06c9da558e4c /ShiftOS.WinForms | |
| parent | 6a50e9fdda42b8a5cc23594e87b1a6cc2a39cc4c (diff) | |
| download | shiftos_thereturn-d23d4826f0302770284f51966e6b24290fab52d3.tar.gz shiftos_thereturn-d23d4826f0302770284f51966e6b24290fab52d3.tar.bz2 shiftos_thereturn-d23d4826f0302770284f51966e6b24290fab52d3.zip | |
Added plus & equals functionality
Diffstat (limited to 'ShiftOS.WinForms')
| -rw-r--r-- | ShiftOS.WinForms/Applications/Calculator.Designer.cs | 1 | ||||
| -rw-r--r-- | ShiftOS.WinForms/Applications/Calculator.cs | 24 |
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; + } } } |
