From 7070587e18532e25f538e32f54a51cf2e31cae87 Mon Sep 17 00:00:00 2001 From: lempamo Date: Sat, 25 Feb 2017 10:40:41 -0500 Subject: [PATCH 1/2] calc update 3 --- .../Applications/Calculator.Designer.cs | 2 +- ShiftOS.WinForms/Applications/Calculator.cs | 8 +++---- ShiftOS.WinForms/Resources/Shiftorium.txt | 22 ++++++++++++++++++- 3 files changed, 26 insertions(+), 6 deletions(-) diff --git a/ShiftOS.WinForms/Applications/Calculator.Designer.cs b/ShiftOS.WinForms/Applications/Calculator.Designer.cs index d505e1a..f7a6e52 100644 --- a/ShiftOS.WinForms/Applications/Calculator.Designer.cs +++ b/ShiftOS.WinForms/Applications/Calculator.Designer.cs @@ -193,7 +193,7 @@ namespace ShiftOS.WinForms.Applications this.Controls.Add(this.button1); this.Controls.Add(this.numBox); this.Name = "Calculator"; - this.Size = new System.Drawing.Size(150, 149); + this.Size = new System.Drawing.Size(186, 190); this.Load += new System.EventHandler(this.Template_Load); this.ResumeLayout(false); this.PerformLayout(); diff --git a/ShiftOS.WinForms/Applications/Calculator.cs b/ShiftOS.WinForms/Applications/Calculator.cs index ac09567..f7eed4a 100644 --- a/ShiftOS.WinForms/Applications/Calculator.cs +++ b/ShiftOS.WinForms/Applications/Calculator.cs @@ -62,17 +62,17 @@ namespace ShiftOS.WinForms.Applications public void OnLoad() { - throw new NotImplementedException(); + } public void OnSkinLoad() { - throw new NotImplementedException(); + } public bool OnUnload() { - throw new NotImplementedException(); + return true; } public void OnUpgrade() @@ -82,7 +82,7 @@ namespace ShiftOS.WinForms.Applications private void button1_Click(object sender, EventArgs e) { - numBox.Text = "" + "1"; + numBox.Text = numBox.Text + "1"; } } } diff --git a/ShiftOS.WinForms/Resources/Shiftorium.txt b/ShiftOS.WinForms/Resources/Shiftorium.txt index c75372e..b81e469 100644 --- a/ShiftOS.WinForms/Resources/Shiftorium.txt +++ b/ShiftOS.WinForms/Resources/Shiftorium.txt @@ -700,6 +700,26 @@ Cost: 2500, Dependencies: "shiftorium_gui", Description: "In the shiftorium GUI but dont know what you can spend because you can't see how many code points are on hand? Well shop easy, because with this upgrade that is now possible! You have to restart the shiftorium for it to work." - } + }, + + // CALCULATOR UPGRADES + { + Name: "Calculator", + Cost: 1000, + Dependencies: "wm_free_placement;desktop", + Description: "Crazy math problems getting you down? Well, this calculator will take care of that!" + }, + { + Name: "AL Calculator", + Cost: 350, + Dependencies: "calculator;app_launcher", + Description: "Add an App Launcher Entry for the Calculator!" + }, + { + Name: "Calc Equals Button", + Cost: 600, + Dependencies: "calculator", + Description: "Right now, you can only type numbers, but this equals button opens the door to solving equations!" + } ] \ No newline at end of file From 4b9f08581bc44a6f8c7a6c64cfad31464c2e5145 Mon Sep 17 00:00:00 2001 From: lempamo Date: Sat, 25 Feb 2017 11:20:33 -0500 Subject: [PATCH 2/2] Made Calc buttons work --- .../Applications/Calculator.Designer.cs | 12 +++- ShiftOS.WinForms/Applications/Calculator.cs | 58 +++++++++++++++---- 2 files changed, 58 insertions(+), 12 deletions(-) diff --git a/ShiftOS.WinForms/Applications/Calculator.Designer.cs b/ShiftOS.WinForms/Applications/Calculator.Designer.cs index f7a6e52..c97c754 100644 --- a/ShiftOS.WinForms/Applications/Calculator.Designer.cs +++ b/ShiftOS.WinForms/Applications/Calculator.Designer.cs @@ -94,6 +94,7 @@ namespace ShiftOS.WinForms.Applications this.button2.TabIndex = 3; this.button2.Text = "2"; this.button2.UseVisualStyleBackColor = true; + this.button2.Click += new System.EventHandler(this.button2_Click); // // button3 // @@ -103,6 +104,7 @@ namespace ShiftOS.WinForms.Applications this.button3.TabIndex = 4; this.button3.Text = "3"; this.button3.UseVisualStyleBackColor = true; + this.button3.Click += new System.EventHandler(this.button3_Click); // // button4 // @@ -112,6 +114,7 @@ namespace ShiftOS.WinForms.Applications this.button4.TabIndex = 5; this.button4.Text = "4"; this.button4.UseVisualStyleBackColor = true; + this.button4.Click += new System.EventHandler(this.button4_Click); // // button5 // @@ -121,6 +124,7 @@ namespace ShiftOS.WinForms.Applications this.button5.TabIndex = 6; this.button5.Text = "5"; this.button5.UseVisualStyleBackColor = true; + this.button5.Click += new System.EventHandler(this.button5_Click); // // button6 // @@ -130,6 +134,7 @@ namespace ShiftOS.WinForms.Applications this.button6.TabIndex = 7; this.button6.Text = "6"; this.button6.UseVisualStyleBackColor = true; + this.button6.Click += new System.EventHandler(this.button6_Click); // // button7 // @@ -139,6 +144,7 @@ namespace ShiftOS.WinForms.Applications this.button7.TabIndex = 8; this.button7.Text = "7"; this.button7.UseVisualStyleBackColor = true; + this.button7.Click += new System.EventHandler(this.button7_Click); // // button8 // @@ -148,6 +154,7 @@ namespace ShiftOS.WinForms.Applications this.button8.TabIndex = 9; this.button8.Text = "8"; this.button8.UseVisualStyleBackColor = true; + this.button8.Click += new System.EventHandler(this.button8_Click); // // button9 // @@ -157,6 +164,7 @@ namespace ShiftOS.WinForms.Applications this.button9.TabIndex = 10; this.button9.Text = "9"; this.button9.UseVisualStyleBackColor = true; + this.button9.Click += new System.EventHandler(this.button9_Click); // // button10 // @@ -166,6 +174,7 @@ namespace ShiftOS.WinForms.Applications this.button10.TabIndex = 11; this.button10.Text = "0"; this.button10.UseVisualStyleBackColor = true; + this.button10.Click += new System.EventHandler(this.button10_Click); // // buttonEquals // @@ -193,8 +202,7 @@ namespace ShiftOS.WinForms.Applications this.Controls.Add(this.button1); this.Controls.Add(this.numBox); this.Name = "Calculator"; - this.Size = new System.Drawing.Size(186, 190); - this.Load += new System.EventHandler(this.Template_Load); + this.Size = new System.Drawing.Size(171, 176); this.ResumeLayout(false); this.PerformLayout(); diff --git a/ShiftOS.WinForms/Applications/Calculator.cs b/ShiftOS.WinForms/Applications/Calculator.cs index f7eed4a..eb2df29 100644 --- a/ShiftOS.WinForms/Applications/Calculator.cs +++ b/ShiftOS.WinForms/Applications/Calculator.cs @@ -48,21 +48,14 @@ namespace ShiftOS.WinForms.Applications InitializeComponent(); } - private void Template_Load(object sender, EventArgs e) - { - justopened = true; - - prepareButtons(); - } - private void prepareButtons() { - if (!ShiftoriumFrontend.UpgradeInstalled("calc_equals_button")) buttonEquals.Visible = false; + buttonEquals.Visible = ShiftoriumFrontend.UpgradeInstalled("calc_equals_button"); } public void OnLoad() { - + prepareButtons(); } public void OnSkinLoad() @@ -77,12 +70,57 @@ namespace ShiftOS.WinForms.Applications public void OnUpgrade() { - throw new NotImplementedException(); + prepareButtons(); } private void button1_Click(object sender, EventArgs e) { numBox.Text = numBox.Text + "1"; } + + private void button2_Click(object sender, EventArgs e) + { + numBox.Text = numBox.Text + "2"; + } + + private void button3_Click(object sender, EventArgs e) + { + numBox.Text = numBox.Text + "3"; + } + + private void button4_Click(object sender, EventArgs e) + { + numBox.Text = numBox.Text + "4"; + } + + private void button5_Click(object sender, EventArgs e) + { + numBox.Text = numBox.Text + "5"; + } + + private void button6_Click(object sender, EventArgs e) + { + numBox.Text = numBox.Text + "6"; + } + + private void button7_Click(object sender, EventArgs e) + { + numBox.Text = numBox.Text + "7"; + } + + private void button8_Click(object sender, EventArgs e) + { + numBox.Text = numBox.Text + "8"; + } + + private void button9_Click(object sender, EventArgs e) + { + numBox.Text = numBox.Text + "9"; + } + + private void button10_Click(object sender, EventArgs e) + { + numBox.Text = numBox.Text + "0"; + } } }