diff --git a/ShiftOS.WinForms/Applications/Calculator.Designer.cs b/ShiftOS.WinForms/Applications/Calculator.Designer.cs index c97c754..507e382 100644 --- a/ShiftOS.WinForms/Applications/Calculator.Designer.cs +++ b/ShiftOS.WinForms/Applications/Calculator.Designer.cs @@ -64,6 +64,9 @@ namespace ShiftOS.WinForms.Applications this.button9 = new System.Windows.Forms.Button(); this.button10 = new System.Windows.Forms.Button(); this.buttonEquals = new System.Windows.Forms.Button(); + this.buttonPlus = new System.Windows.Forms.Button(); + this.buttonMinus = new System.Windows.Forms.Button(); + this.buttonMultiply = new System.Windows.Forms.Button(); this.SuspendLayout(); // // numBox @@ -75,6 +78,7 @@ namespace ShiftOS.WinForms.Applications this.numBox.ReadOnly = true; this.numBox.Size = new System.Drawing.Size(143, 30); this.numBox.TabIndex = 0; + this.numBox.TextChanged += new System.EventHandler(this.numBox_TextChanged); // // button1 // @@ -185,10 +189,41 @@ namespace ShiftOS.WinForms.Applications this.buttonEquals.Text = "="; this.buttonEquals.UseVisualStyleBackColor = true; // + // buttonPlus + // + this.buttonPlus.Location = new System.Drawing.Point(125, 39); + this.buttonPlus.Name = "buttonPlus"; + this.buttonPlus.Size = new System.Drawing.Size(22, 22); + this.buttonPlus.TabIndex = 13; + this.buttonPlus.Text = "+"; + this.buttonPlus.UseVisualStyleBackColor = true; + this.buttonPlus.Click += new System.EventHandler(this.buttonPlus_Click); + // + // buttonMinus + // + this.buttonMinus.Location = new System.Drawing.Point(125, 67); + this.buttonMinus.Name = "buttonMinus"; + this.buttonMinus.Size = new System.Drawing.Size(22, 22); + this.buttonMinus.TabIndex = 14; + this.buttonMinus.Text = "-"; + this.buttonMinus.UseVisualStyleBackColor = true; + // + // buttonMultiply + // + this.buttonMultiply.Location = new System.Drawing.Point(125, 95); + this.buttonMultiply.Name = "buttonMultiply"; + this.buttonMultiply.Size = new System.Drawing.Size(22, 22); + this.buttonMultiply.TabIndex = 15; + this.buttonMultiply.Text = "x"; + this.buttonMultiply.UseVisualStyleBackColor = true; + // // Calculator // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.buttonMultiply); + this.Controls.Add(this.buttonMinus); + this.Controls.Add(this.buttonPlus); this.Controls.Add(this.buttonEquals); this.Controls.Add(this.button10); this.Controls.Add(this.button9); @@ -202,7 +237,7 @@ namespace ShiftOS.WinForms.Applications this.Controls.Add(this.button1); this.Controls.Add(this.numBox); this.Name = "Calculator"; - this.Size = new System.Drawing.Size(171, 176); + this.Size = new System.Drawing.Size(166, 185); this.ResumeLayout(false); this.PerformLayout(); @@ -222,5 +257,8 @@ namespace ShiftOS.WinForms.Applications private System.Windows.Forms.Button button9; private System.Windows.Forms.Button button10; private System.Windows.Forms.Button buttonEquals; + private System.Windows.Forms.Button buttonPlus; + private System.Windows.Forms.Button buttonMinus; + private System.Windows.Forms.Button buttonMultiply; } } diff --git a/ShiftOS.WinForms/Applications/Calculator.cs b/ShiftOS.WinForms/Applications/Calculator.cs index eb2df29..ee5c2e3 100644 --- a/ShiftOS.WinForms/Applications/Calculator.cs +++ b/ShiftOS.WinForms/Applications/Calculator.cs @@ -42,6 +42,9 @@ namespace ShiftOS.WinForms.Applications public partial class Calculator : UserControl, IShiftOSWindow { public bool justopened = false; + private int activeoperation = 0; + private float operationnumber = 0; + private float currentnumber = 0; public Calculator() { @@ -51,6 +54,9 @@ namespace ShiftOS.WinForms.Applications private void prepareButtons() { buttonEquals.Visible = ShiftoriumFrontend.UpgradeInstalled("calc_equals_button"); + buttonPlus.Visible = ShiftoriumFrontend.UpgradeInstalled("calc_plus_button"); + buttonMinus.Visible = ShiftoriumFrontend.UpgradeInstalled("calc_minus_button"); + buttonMultiply.Visible = ShiftoriumFrontend.UpgradeInstalled("calc_multiply_button"); } public void OnLoad() @@ -73,6 +79,11 @@ namespace ShiftOS.WinForms.Applications prepareButtons(); } + private void numBox_TextChanged(object sender, EventArgs e) + { + currentnumber = float.Parse(numBox.Text); + } + private void button1_Click(object sender, EventArgs e) { numBox.Text = numBox.Text + "1"; @@ -122,5 +133,17 @@ namespace ShiftOS.WinForms.Applications { numBox.Text = numBox.Text + "0"; } + + private void buttonPlus_Click(object sender, EventArgs e) + { + if (operationnumber == 0 && activeoperation != 1) + { + operationnumber = currentnumber; + activeoperation = 1; + } else + { + + } + } } } diff --git a/ShiftOS.WinForms/Resources/Shiftorium.txt b/ShiftOS.WinForms/Resources/Shiftorium.txt index 8d2e199..3201cc5 100644 --- a/ShiftOS.WinForms/Resources/Shiftorium.txt +++ b/ShiftOS.WinForms/Resources/Shiftorium.txt @@ -18,6 +18,24 @@ Dependencies: "calculator", Description: "Right now, you can only type numbers, but this equals button opens the door to solving equations!" }, + { + Name: "Calc Plus Button", + Cost: 700, + Dependencies: "calc_equals_button", + Description: "With this extra button, your calculator can now do addition problems!" + }, + { + Name: "Calc Minus Button", + Cost: 700, + Dependencies: "calc_equals_button", + Description: "With this extra button, your calculator can now do subtraction problems!" + }, + { + Name: "Calc Multiply Button", + Cost: 800, + Dependencies: "calc_plus_button", + Description: "You can add numbers together, but it must be tiring to add the same number over and over. This multiplication button will make it easier for you!" + }, { Name: "MUD Fundamentals", Cost: 50,