Merge branch 'reset-on-restart' into develop-laptop

This commit is contained in:
HeshamTB 2018-12-31 06:31:43 +03:00
commit 417e364595
2 changed files with 21 additions and 9 deletions

View File

@ -71,7 +71,6 @@ namespace OWTrack
} }
} }
//Move to saveManeger.cs ?
private void loadSave() private void loadSave()
{ {
try try
@ -172,7 +171,8 @@ namespace OWTrack
newSR = tr.newSR, newSR = tr.newSR,
ChangeInSR = tr.srDiff(), ChangeInSR = tr.srDiff(),
dateTime = DateTime.Now.Date, dateTime = DateTime.Now.Date,
DateTimeSting = DateTime.Now.ToString("hh:mm tt") DateTimeSting = DateTime.Now.ToString("hh:mm tt"),
LastMatchSR = tr.GetCurrentSession().GetLastMatch().newSR,
}; };
tr.GetCurrentSession().AddMatch(match); tr.GetCurrentSession().AddMatch(match);
} }
@ -235,12 +235,6 @@ namespace OWTrack
} }
finally finally
{ {
//if (!SRonce)
//{
// tr.startSR = sr;
// SRonce = true;
//}
//else tr.newSR = sr;
if (tr.GetCurrentSession().IsNewSession()) if (tr.GetCurrentSession().IsNewSession())
tr.startSR = sr; tr.startSR = sr;
else else

View File

@ -158,6 +158,7 @@ namespace OWTrack
class Session class Session
{ {
public int wins, losses = 0;
public int TotalMatches; public int TotalMatches;
public int SkillChange; public int SkillChange;
public int StartSR; public int StartSR;
@ -165,7 +166,7 @@ namespace OWTrack
public List<Match> Matches = new List<Match>(); public List<Match> Matches = new List<Match>();
/// <summary> /// <summary>
/// Start a new session with a starting Skill Rating /// Start a new session
///</summary> ///</summary>
public Session(int StartSR) public Session(int StartSR)
{ {
@ -174,22 +175,38 @@ namespace OWTrack
TotalMatches = 0; TotalMatches = 0;
} }
/// <summary>
/// Check if session does not have any matches
/// </summary>
/// <returns>Booelan</returns>
public bool IsNewSession() public bool IsNewSession()
{ {
if (Matches.Count == 0) return true; if (Matches.Count == 0) return true;
else return false; else return false;
} }
/// <summary>
/// Get last match in Matchs list
/// </summary>
/// <returns>Match</returns>
public Match GetLastMatch() public Match GetLastMatch()
{ {
return Matches.Last(); return Matches.Last();
} }
/// <summary>
/// Add Match to list
/// </summary>
/// <param name="match"></param>
public void AddMatch(Match match) public void AddMatch(Match match)
{ {
match.LastMatchSR = this.Matches.Last().newSR; match.LastMatchSR = this.Matches.Last().newSR;
this.Matches.Add(match); this.Matches.Add(match);
this.TotalMatches = Matches.Count(); this.TotalMatches = Matches.Count();
if (match.IsWin)
wins++;
else
losses++;
} }
} }
@ -197,6 +214,7 @@ namespace OWTrack
{ {
public Match() { } public Match() { }
public DateTime dateTime { get; set; } public DateTime dateTime { get; set; }
public bool IsWin;
public string DateTimeSting; public string DateTimeSting;
public int StartSR; public int StartSR;
public int LastMatchSR; public int LastMatchSR;