From e18104f0cf8c7b9d583e4f5868fa6e16af3edaa3 Mon Sep 17 00:00:00 2001 From: HeshamTB Date: Fri, 13 Jul 2018 05:13:05 +0300 Subject: [PATCH] win-loss --- OWTrack/Form1.Designer.cs | 70 ++++++++++++++++++++++++++++++++++++++- OWTrack/Form1.cs | 16 +++++++++ OWTrack/Tracker.cs | 8 ++++- 3 files changed, 92 insertions(+), 2 deletions(-) diff --git a/OWTrack/Form1.Designer.cs b/OWTrack/Form1.Designer.cs index 74bbf08..7f6b050 100644 --- a/OWTrack/Form1.Designer.cs +++ b/OWTrack/Form1.Designer.cs @@ -33,6 +33,11 @@ this.status = new System.Windows.Forms.Label(); this.timer1 = new System.Windows.Forms.Timer(this.components); this.Time = new System.Windows.Forms.Label(); + this.Wins = new System.Windows.Forms.Label(); + this.Losses = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.WinBut = new System.Windows.Forms.Button(); + this.button2 = new System.Windows.Forms.Button(); this.SuspendLayout(); // // label1 @@ -69,11 +74,69 @@ this.Time.TabIndex = 2; this.Time.Text = "label2"; // + // Wins + // + this.Wins.AutoSize = true; + this.Wins.Font = new System.Drawing.Font("Miriam Mono CLM", 27.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(177))); + this.Wins.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(192)))), ((int)(((byte)(0))))); + this.Wins.Location = new System.Drawing.Point(70, 75); + this.Wins.Name = "Wins"; + this.Wins.Size = new System.Drawing.Size(40, 42); + this.Wins.TabIndex = 3; + this.Wins.Text = "0"; + // + // Losses + // + this.Losses.AutoSize = true; + this.Losses.Font = new System.Drawing.Font("Miriam Mono CLM", 27.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(177))); + this.Losses.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); + this.Losses.Location = new System.Drawing.Point(153, 73); + this.Losses.Name = "Losses"; + this.Losses.Size = new System.Drawing.Size(40, 42); + this.Losses.TabIndex = 4; + this.Losses.Text = "0"; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Font = new System.Drawing.Font("Miriam Mono CLM", 27.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(177))); + this.label3.ForeColor = System.Drawing.Color.Black; + this.label3.Location = new System.Drawing.Point(116, 75); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(40, 42); + this.label3.TabIndex = 5; + this.label3.Text = ":"; + // + // WinBut + // + this.WinBut.Location = new System.Drawing.Point(12, 87); + this.WinBut.Name = "WinBut"; + this.WinBut.Size = new System.Drawing.Size(52, 26); + this.WinBut.TabIndex = 6; + this.WinBut.Text = "win"; + this.WinBut.UseVisualStyleBackColor = true; + this.WinBut.Click += new System.EventHandler(this.button1_Click); + // + // button2 + // + this.button2.Location = new System.Drawing.Point(199, 89); + this.button2.Name = "button2"; + this.button2.Size = new System.Drawing.Size(52, 26); + this.button2.TabIndex = 6; + this.button2.Text = "loss"; + this.button2.UseVisualStyleBackColor = true; + this.button2.Click += new System.EventHandler(this.button2_Click); + // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(406, 267); + this.ClientSize = new System.Drawing.Size(263, 170); + this.Controls.Add(this.button2); + this.Controls.Add(this.WinBut); + this.Controls.Add(this.label3); + this.Controls.Add(this.Losses); + this.Controls.Add(this.Wins); this.Controls.Add(this.Time); this.Controls.Add(this.status); this.Controls.Add(this.label1); @@ -91,6 +154,11 @@ private System.Windows.Forms.Label status; private System.Windows.Forms.Timer timer1; private System.Windows.Forms.Label Time; + private System.Windows.Forms.Label Wins; + private System.Windows.Forms.Label Losses; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.Button WinBut; + private System.Windows.Forms.Button button2; } } diff --git a/OWTrack/Form1.cs b/OWTrack/Form1.cs index 1d4dc01..d231084 100644 --- a/OWTrack/Form1.cs +++ b/OWTrack/Form1.cs @@ -43,5 +43,21 @@ namespace OWTrack status.ForeColor = Color.Red; } } + + private void button1_Click(object sender, EventArgs e) + { + tr.addWin(); + update(); + } + private void button2_Click(object sender, EventArgs e) + { + tr.addLoss(); + update(); + } + private void update() + { + Wins.Text = tr.GetWins().ToString(); + Losses.Text = tr.GetLosses().ToString(); + } } } diff --git a/OWTrack/Tracker.cs b/OWTrack/Tracker.cs index 39f50ac..a4baa49 100644 --- a/OWTrack/Tracker.cs +++ b/OWTrack/Tracker.cs @@ -9,10 +9,11 @@ namespace OWTrack { class Tracker { + private int wins, losses = 0; public void Track() { - + } public bool owRunning() @@ -21,5 +22,10 @@ namespace OWTrack .FirstOrDefault(p => p.MainModule.FileName.StartsWith(@"D:\Hesham\installed Games\Overwatch")) != default(Process); return isRunning; } + + public void addWin() { wins++; } + public void addLoss() { losses++; } + public int GetWins() { return wins; } + public int GetLosses() { return losses; } } }