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.components = new System.ComponentModel.Container();
this.updateTimer = new System.Windows.Forms.Timer(this.components); 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.panelClientContainer = new System.Windows.Forms.Panel();
this.panelDataViewLeft = new System.Windows.Forms.Panel(); this.panelDataViewLeft = new System.Windows.Forms.Panel();
this.panelClientChat = new ErgometerApplication.PanelClientChat(); this.panelClientChat = new ErgometerApplication.PanelClientChat();
@@ -62,6 +63,11 @@ namespace ErgometerApplication
// //
this.updateTimer.Interval = 500; this.updateTimer.Interval = 500;
this.updateTimer.Tick += new System.EventHandler(this.updateTimer_Tick); this.updateTimer.Tick += new System.EventHandler(this.updateTimer_Tick);
//
// beeptimer
//
this.beeptimer.Interval = 833;
this.beeptimer.Tick += new System.EventHandler(this.updateBeep);
// //
// panelClientContainer // panelClientContainer
// //
@@ -173,6 +179,7 @@ namespace ErgometerApplication
#endregion #endregion
private System.Windows.Forms.Timer updateTimer; private System.Windows.Forms.Timer updateTimer;
public Timer beeptimer;
private System.Windows.Forms.Panel panelClientContainer; private System.Windows.Forms.Panel panelClientContainer;
private PanelClientChat panelClientChat; private PanelClientChat panelClientChat;
private PanelLogin panelLogin; private PanelLogin panelLogin;
@@ -29,10 +29,13 @@ namespace ErgometerApplication
MainClient.Init(this); MainClient.Init(this);
} }
private void updateBeep(object sender, EventArgs e)
{
Console.Beep(1000,5);
}
private void updateTimer_Tick(object sender, EventArgs e) private void updateTimer_Tick(object sender, EventArgs e)
{ {
if (MainClient.Doctor.Connected)
if(MainClient.Doctor.Connected)
{ {
MainClient.ComPort.Write("ST"); MainClient.ComPort.Write("ST");
string response = MainClient.ComPort.Read(); string response = MainClient.ComPort.Read();
@@ -100,6 +103,7 @@ namespace ErgometerApplication
public void updateStepsText(string text) public void updateStepsText(string text)
{ {
steps.setText(text); steps.setText(text);
Console.Beep(1200, 500);
} }
public void CreateNewTest(char geslacht, int leeftijd, int gewicht, int lengte) 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."); 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>(); workloads = new List<Workload>();
MainClient.ComPort.Write("PW 25"); MainClient.ComPort.Write("PW 25");
MainClient.Client.beeptimer.Start();
} }
public void timerTick() public void timerTick()
@@ -44,7 +45,9 @@ namespace ErgometerApplication
{ {
List<ErgometerLibrary.Meting> last10 = MainClient.Metingen.GetRange(MainClient.Metingen.Count - 10, 10); List<ErgometerLibrary.Meting> last10 = MainClient.Metingen.GetRange(MainClient.Metingen.Count - 10, 10);
int max = FindMaxValue(MainClient.Metingen, x => x.HeartBeat); 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 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."); client.updateStepsText("Uw hartslag is niet stabiel, probeer een tempo van 50 rpm aan te houden. De test gaat automatisch verder.");