final for 1.2.2

This commit is contained in:
HeshamTB 2018-08-12 02:33:26 +03:00
parent bba991d3bf
commit 3b1a3d80bb
4 changed files with 41 additions and 6 deletions

View File

@ -42,6 +42,7 @@
this.label4 = new System.Windows.Forms.Label();
this.reduceLossBut = new System.Windows.Forms.Button();
this.reduceWinBut = new System.Windows.Forms.Button();
this.clearBut = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// label1
@ -168,15 +169,26 @@
this.reduceWinBut.Name = "reduceWinBut";
this.reduceWinBut.Size = new System.Drawing.Size(20, 24);
this.reduceWinBut.TabIndex = 9;
this.reduceWinBut.Text = "+";
this.reduceWinBut.Text = "-";
this.reduceWinBut.UseVisualStyleBackColor = true;
this.reduceWinBut.Click += new System.EventHandler(this.reduceWinBut_Click);
//
// clearBut
//
this.clearBut.Location = new System.Drawing.Point(209, 132);
this.clearBut.Name = "clearBut";
this.clearBut.Size = new System.Drawing.Size(49, 25);
this.clearBut.TabIndex = 10;
this.clearBut.Text = "clear";
this.clearBut.UseVisualStyleBackColor = true;
this.clearBut.Click += new System.EventHandler(this.clearBut_Click);
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(263, 170);
this.Controls.Add(this.clearBut);
this.Controls.Add(this.reduceWinBut);
this.Controls.Add(this.reduceLossBut);
this.Controls.Add(this.label4);
@ -214,6 +226,7 @@
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Button reduceLossBut;
private System.Windows.Forms.Button reduceWinBut;
private System.Windows.Forms.Button clearBut;
}
}

View File

@ -56,15 +56,31 @@ namespace OWTrack
}
private bool saveExist()
{
try
{
if (File.Exists(Directory.GetCurrentDirectory() + "/data.json")) { return true; }
else return false;
}
catch (Exception e)
{
MessageBox.Show(e.Message);
return false;
}
}
private Tracker savedTracker()
{
try
{
return JsonConvert.DeserializeObject<Tracker>(File.ReadAllText(Directory.GetCurrentDirectory() + "/data.json"));
}
catch (Exception e)
{
MessageBox.Show(e.Message);
return null;
}
}
private void timer1_Tick(object sender, EventArgs e)
{
@ -101,5 +117,10 @@ namespace OWTrack
Losses.Text = tr.GetLosses().ToString();
}
private void clearBut_Click(object sender, EventArgs e)
{
tr.reset();
update();
}
}
}

View File

@ -8,7 +8,7 @@ namespace OWTrack
{
static class Program
{
public static string Version = "1.2.1";
public static string Version = "1.2.2";
/// <summary>
/// The main entry point for the application.
/// </summary>

View File

@ -29,6 +29,7 @@ namespace OWTrack
}
}
public void reset() { wins = 0; losses = 0; }
public void addWin() { wins++; }
public void addLoss() { losses++; }
public void reduceWin() { wins--; }