From fd3ab02b5af04dbe8009e62c24051f2d61950a48 Mon Sep 17 00:00:00 2001 From: Janco Kock Date: Mon, 2 Nov 2015 14:34:50 +0100 Subject: [PATCH] Added stop state --- .../ClientApplicatie.Designer.cs | 2 +- .../ErgometerApplication/ErgometerTest.cs | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/ErgometerIPR/ErgometerApplication/ClientApplicatie.Designer.cs b/ErgometerIPR/ErgometerApplication/ClientApplicatie.Designer.cs index d80bc4c..27f9273 100644 --- a/ErgometerIPR/ErgometerApplication/ClientApplicatie.Designer.cs +++ b/ErgometerIPR/ErgometerApplication/ClientApplicatie.Designer.cs @@ -178,7 +178,7 @@ namespace ErgometerApplication } #endregion - private System.Windows.Forms.Timer updateTimer; + public System.Windows.Forms.Timer updateTimer; public Timer beeptimer; private System.Windows.Forms.Panel panelClientContainer; private PanelClientChat panelClientChat; diff --git a/ErgometerIPR/ErgometerApplication/ErgometerTest.cs b/ErgometerIPR/ErgometerApplication/ErgometerTest.cs index cb4858a..22e9478 100644 --- a/ErgometerIPR/ErgometerApplication/ErgometerTest.cs +++ b/ErgometerIPR/ErgometerApplication/ErgometerTest.cs @@ -120,6 +120,12 @@ namespace ErgometerApplication client.updateStepsText("U bent momenteel met de cooldown bezig."); } break; + case state.STOP: + MainClient.Client.updateTimer.Stop(); + MainClient.ComPort.Write("RS"); + MainClient.Client.updateStepsText(String.Format("De test is afgelopen. Uw test resultaten zijn: \n VO2MAX: {0} MET: {1} Gemiddelde: {3} \n {4} ", CalculateVOMax(), CalculateMET(), CalculatePopulationAverage(), CalculateRating())); + MainClient.SendNetCommand(new ErgometerLibrary.NetCommand(CalculateVOMax(), CalculateMET(), CalculatePopulationAverage(), CalculateZScore(), CalculateRating(), MainClient.Session)); + break; } } @@ -220,10 +226,15 @@ namespace ErgometerApplication return 41.435 - 0.23 * age; } - public string CalculateRating() + public double CalculateZScore() { var dev = (gender == 'M') ? 6 : 5.5; - var Zscore = (CalculateVOMax() - CalculatePopulationAverage()) / dev; + return (CalculateVOMax() - CalculatePopulationAverage()) / dev; + } + + public string CalculateRating() + { + var Zscore = CalculateZScore(); if (Zscore >= 1) { return "Geweldig";