Added beep sounds

This commit is contained in:
Janco Kock
2015-11-01 22:50:29 +01:00
parent d68a328e0d
commit c7204fd593
3 changed files with 17 additions and 3 deletions
@@ -34,6 +34,7 @@ namespace ErgometerApplication
{
this.components = new System.ComponentModel.Container();
this.updateTimer = new System.Windows.Forms.Timer(this.components);
this.beeptimer = new System.Windows.Forms.Timer(this.components);
this.panelClientContainer = new System.Windows.Forms.Panel();
this.panelDataViewLeft = new System.Windows.Forms.Panel();
this.panelClientChat = new ErgometerApplication.PanelClientChat();
@@ -62,6 +63,11 @@ namespace ErgometerApplication
//
this.updateTimer.Interval = 500;
this.updateTimer.Tick += new System.EventHandler(this.updateTimer_Tick);
//
// beeptimer
//
this.beeptimer.Interval = 833;
this.beeptimer.Tick += new System.EventHandler(this.updateBeep);
//
// panelClientContainer
//
@@ -173,6 +179,7 @@ namespace ErgometerApplication
#endregion
private System.Windows.Forms.Timer updateTimer;
public Timer beeptimer;
private System.Windows.Forms.Panel panelClientContainer;
private PanelClientChat panelClientChat;
private PanelLogin panelLogin;
@@ -29,10 +29,13 @@ namespace ErgometerApplication
MainClient.Init(this);
}
private void updateBeep(object sender, EventArgs e)
{
Console.Beep(1000,5);
}
private void updateTimer_Tick(object sender, EventArgs e)
{
if(MainClient.Doctor.Connected)
if (MainClient.Doctor.Connected)
{
MainClient.ComPort.Write("ST");
string response = MainClient.ComPort.Read();
@@ -100,6 +103,7 @@ namespace ErgometerApplication
public void updateStepsText(string text)
{
steps.setText(text);
Console.Beep(1200, 500);
}
public void CreateNewTest(char geslacht, int leeftijd, int gewicht, int lengte)
@@ -33,6 +33,7 @@ namespace ErgometerApplication
client.updateStepsText("U begint nu aan een warmup, probeer een tempo van 50 rpm aan te houden. De test gaat automatisch verder.");
workloads = new List<Workload>();
MainClient.ComPort.Write("PW 25");
MainClient.Client.beeptimer.Start();
}
public void timerTick()
@@ -44,7 +45,9 @@ namespace ErgometerApplication
{
List<ErgometerLibrary.Meting> last10 = MainClient.Metingen.GetRange(MainClient.Metingen.Count - 10, 10);
int max = FindMaxValue(MainClient.Metingen, x => x.HeartBeat);
int min = FindMaxValue(MainClient.Metingen, x => x.HeartBeat);
int min = FindMinValue(MainClient.Metingen, x => x.HeartBeat);
Console.WriteLine(max);
Console.WriteLine(min);
if(max - min > 10) //Hartslag niet stabiel
{
client.updateStepsText("Uw hartslag is niet stabiel, probeer een tempo van 50 rpm aan te houden. De test gaat automatisch verder.");