Made Calc buttons work

This commit is contained in:
lempamo 2017-02-25 11:20:33 -05:00
parent a152967d33
commit 4b9f08581b
2 changed files with 58 additions and 12 deletions

View file

@ -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();

View file

@ -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";
}
}
}