From 29805eb926a0af94322bd1307756fd9d02fb9e10 Mon Sep 17 00:00:00 2001 From: HeshamTB Date: Wed, 15 Aug 2018 11:46:05 +0300 Subject: [PATCH] clear functionality --- OWTrack/Form1.cs | 15 ++++++++------- OWTrack/Tracker.cs | 2 +- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/OWTrack/Form1.cs b/OWTrack/Form1.cs index 7c08567..f00e742 100644 --- a/OWTrack/Form1.cs +++ b/OWTrack/Form1.cs @@ -115,6 +115,13 @@ namespace OWTrack { Wins.Text = tr.GetWins().ToString(); Losses.Text = tr.GetLosses().ToString(); + if (tr.newSR == 0) + { + if (tr.srDiff() < 1) { srLabel.Text = tr.startSR.ToString() + " - 0"; } + else srLabel.Text = tr.startSR.ToString() + " - " + tr.srDiff(); + } + else srLabel.Text = tr.startSR.ToString() + " - " + tr.srDiff(); + srTextBox.Text = null; File.WriteAllText(Directory.GetCurrentDirectory() + "/data.json", JsonConvert.SerializeObject(tr)); } @@ -150,13 +157,7 @@ namespace OWTrack } else tr.newSR = sr; } - if (tr.newSR == 0) - { - if (tr.srDiff() < 1) { srLabel.Text = tr.startSR.ToString() + " - 0"; } - else srLabel.Text = tr.startSR.ToString() + " - " + tr.srDiff(); - } - else srLabel.Text = tr.startSR.ToString() + " - " + tr.srDiff(); - srTextBox.Text = null; + update(); } } } diff --git a/OWTrack/Tracker.cs b/OWTrack/Tracker.cs index b293edc..afdfe43 100644 --- a/OWTrack/Tracker.cs +++ b/OWTrack/Tracker.cs @@ -10,7 +10,7 @@ namespace OWTrack public int wins, losses, startSR, newSR = 0; public void Track() { } - public void reset() { wins = 0; losses = 0; } + public void reset() { wins = 0; losses = 0; startSR = 0; newSR = 0; } public void addWin() { wins++; } public void addLoss() { losses++; } public void reduceWin() { wins--; }