From 3e5498e2f93e96e3efc5a808bea6de07a2c41e68 Mon Sep 17 00:00:00 2001 From: lempamo Date: Sat, 25 Feb 2017 09:48:02 -0500 Subject: [PATCH] Calculator stuffs 2 --- .../Applications/Calculator.Designer.cs | 136 ++++++++++++++++++ ShiftOS.WinForms/Applications/Calculator.cs | 12 ++ ShiftOS.WinForms/Applications/Calculator.resx | 3 - ShiftOS.WinForms/ShiftOS.WinForms.csproj | 9 ++ ShiftOS_TheReturn/Resources/Shiftorium.txt | 8 +- 5 files changed, 164 insertions(+), 4 deletions(-) diff --git a/ShiftOS.WinForms/Applications/Calculator.Designer.cs b/ShiftOS.WinForms/Applications/Calculator.Designer.cs index 4a72cbf..d505e1a 100644 --- a/ShiftOS.WinForms/Applications/Calculator.Designer.cs +++ b/ShiftOS.WinForms/Applications/Calculator.Designer.cs @@ -53,22 +53,147 @@ namespace ShiftOS.WinForms.Applications private void InitializeComponent() { this.numBox = new System.Windows.Forms.TextBox(); + this.button1 = new System.Windows.Forms.Button(); + this.button2 = new System.Windows.Forms.Button(); + this.button3 = new System.Windows.Forms.Button(); + this.button4 = new System.Windows.Forms.Button(); + this.button5 = new System.Windows.Forms.Button(); + this.button6 = new System.Windows.Forms.Button(); + this.button7 = new System.Windows.Forms.Button(); + this.button8 = new System.Windows.Forms.Button(); + this.button9 = new System.Windows.Forms.Button(); + this.button10 = new System.Windows.Forms.Button(); + this.buttonEquals = new System.Windows.Forms.Button(); this.SuspendLayout(); // // numBox // + this.numBox.BackColor = System.Drawing.SystemColors.Window; this.numBox.Font = new System.Drawing.Font("Microsoft Sans Serif", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.numBox.Location = new System.Drawing.Point(4, 3); this.numBox.Name = "numBox"; + this.numBox.ReadOnly = true; this.numBox.Size = new System.Drawing.Size(143, 30); this.numBox.TabIndex = 0; // + // button1 + // + this.button1.Location = new System.Drawing.Point(4, 39); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(22, 22); + this.button1.TabIndex = 2; + this.button1.Text = "1"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // button2 + // + this.button2.Location = new System.Drawing.Point(32, 39); + this.button2.Name = "button2"; + this.button2.Size = new System.Drawing.Size(22, 22); + this.button2.TabIndex = 3; + this.button2.Text = "2"; + this.button2.UseVisualStyleBackColor = true; + // + // button3 + // + this.button3.Location = new System.Drawing.Point(60, 39); + this.button3.Name = "button3"; + this.button3.Size = new System.Drawing.Size(22, 22); + this.button3.TabIndex = 4; + this.button3.Text = "3"; + this.button3.UseVisualStyleBackColor = true; + // + // button4 + // + this.button4.Location = new System.Drawing.Point(4, 67); + this.button4.Name = "button4"; + this.button4.Size = new System.Drawing.Size(22, 22); + this.button4.TabIndex = 5; + this.button4.Text = "4"; + this.button4.UseVisualStyleBackColor = true; + // + // button5 + // + this.button5.Location = new System.Drawing.Point(32, 67); + this.button5.Name = "button5"; + this.button5.Size = new System.Drawing.Size(22, 22); + this.button5.TabIndex = 6; + this.button5.Text = "5"; + this.button5.UseVisualStyleBackColor = true; + // + // button6 + // + this.button6.Location = new System.Drawing.Point(60, 67); + this.button6.Name = "button6"; + this.button6.Size = new System.Drawing.Size(22, 22); + this.button6.TabIndex = 7; + this.button6.Text = "6"; + this.button6.UseVisualStyleBackColor = true; + // + // button7 + // + this.button7.Location = new System.Drawing.Point(4, 95); + this.button7.Name = "button7"; + this.button7.Size = new System.Drawing.Size(22, 22); + this.button7.TabIndex = 8; + this.button7.Text = "7"; + this.button7.UseVisualStyleBackColor = true; + // + // button8 + // + this.button8.Location = new System.Drawing.Point(32, 95); + this.button8.Name = "button8"; + this.button8.Size = new System.Drawing.Size(22, 22); + this.button8.TabIndex = 9; + this.button8.Text = "8"; + this.button8.UseVisualStyleBackColor = true; + // + // button9 + // + this.button9.Location = new System.Drawing.Point(60, 95); + this.button9.Name = "button9"; + this.button9.Size = new System.Drawing.Size(22, 22); + this.button9.TabIndex = 10; + this.button9.Text = "9"; + this.button9.UseVisualStyleBackColor = true; + // + // button10 + // + this.button10.Location = new System.Drawing.Point(4, 123); + this.button10.Name = "button10"; + this.button10.Size = new System.Drawing.Size(22, 22); + this.button10.TabIndex = 11; + this.button10.Text = "0"; + this.button10.UseVisualStyleBackColor = true; + // + // buttonEquals + // + this.buttonEquals.Location = new System.Drawing.Point(60, 123); + this.buttonEquals.Name = "buttonEquals"; + this.buttonEquals.Size = new System.Drawing.Size(22, 22); + this.buttonEquals.TabIndex = 12; + this.buttonEquals.Text = "="; + this.buttonEquals.UseVisualStyleBackColor = true; + // // Calculator // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.buttonEquals); + this.Controls.Add(this.button10); + this.Controls.Add(this.button9); + this.Controls.Add(this.button8); + this.Controls.Add(this.button7); + this.Controls.Add(this.button6); + this.Controls.Add(this.button5); + this.Controls.Add(this.button4); + this.Controls.Add(this.button3); + this.Controls.Add(this.button2); + this.Controls.Add(this.button1); this.Controls.Add(this.numBox); this.Name = "Calculator"; + this.Size = new System.Drawing.Size(150, 149); this.Load += new System.EventHandler(this.Template_Load); this.ResumeLayout(false); this.PerformLayout(); @@ -78,5 +203,16 @@ namespace ShiftOS.WinForms.Applications #endregion private System.Windows.Forms.TextBox numBox; + private System.Windows.Forms.Button button1; + private System.Windows.Forms.Button button2; + private System.Windows.Forms.Button button3; + private System.Windows.Forms.Button button4; + private System.Windows.Forms.Button button5; + private System.Windows.Forms.Button button6; + private System.Windows.Forms.Button button7; + private System.Windows.Forms.Button button8; + private System.Windows.Forms.Button button9; + private System.Windows.Forms.Button button10; + private System.Windows.Forms.Button buttonEquals; } } diff --git a/ShiftOS.WinForms/Applications/Calculator.cs b/ShiftOS.WinForms/Applications/Calculator.cs index 9cbbd0b..ac09567 100644 --- a/ShiftOS.WinForms/Applications/Calculator.cs +++ b/ShiftOS.WinForms/Applications/Calculator.cs @@ -51,6 +51,13 @@ namespace ShiftOS.WinForms.Applications private void Template_Load(object sender, EventArgs e) { justopened = true; + + prepareButtons(); + } + + private void prepareButtons() + { + if (!ShiftoriumFrontend.UpgradeInstalled("calc_equals_button")) buttonEquals.Visible = false; } public void OnLoad() @@ -72,5 +79,10 @@ namespace ShiftOS.WinForms.Applications { throw new NotImplementedException(); } + + private void button1_Click(object sender, EventArgs e) + { + numBox.Text = "" + "1"; + } } } diff --git a/ShiftOS.WinForms/Applications/Calculator.resx b/ShiftOS.WinForms/Applications/Calculator.resx index 61bc649..1af7de1 100644 --- a/ShiftOS.WinForms/Applications/Calculator.resx +++ b/ShiftOS.WinForms/Applications/Calculator.resx @@ -117,7 +117,4 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - True - \ No newline at end of file diff --git a/ShiftOS.WinForms/ShiftOS.WinForms.csproj b/ShiftOS.WinForms/ShiftOS.WinForms.csproj index 45c1a47..a512de2 100644 --- a/ShiftOS.WinForms/ShiftOS.WinForms.csproj +++ b/ShiftOS.WinForms/ShiftOS.WinForms.csproj @@ -64,6 +64,12 @@ Artpad.cs + + UserControl + + + Calculator.cs + UserControl @@ -247,6 +253,9 @@ Artpad.cs + + Calculator.cs + Chat.cs diff --git a/ShiftOS_TheReturn/Resources/Shiftorium.txt b/ShiftOS_TheReturn/Resources/Shiftorium.txt index ec0a36d..d5951dc 100644 --- a/ShiftOS_TheReturn/Resources/Shiftorium.txt +++ b/ShiftOS_TheReturn/Resources/Shiftorium.txt @@ -601,7 +601,7 @@ { Name: "Calculator", Cost: 1000, - Dependencies: "wm_free_placement; desktop", + Dependencies: "wm_free_placement;desktop", Description: "Crazy math problems getting you down? Well, this calculator will take care of that!" }, { @@ -609,5 +609,11 @@ 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!" } ]