Im new to c# and im building a windows form for the Modified early warning scoring system (MEWS) which is used in hospitals to monitor a patients health. I have built a GUI for it, but im not sure what code to put in to get it to work. Im using timers to move coloured labels across the screen to represent a patient vital signs.
Ive but a button in which starts the timers and this works fine. But what I want to do next is show a score based on the output of that vital sign timer. I want to use buttons which when pressed will display the score in a text box. What I want to know is what code do i use to make this work? Also can you give me example code since I will most likely not know how to write it out myself.
Heres the code for my program so far:
namespace MewsV1._0
{
public partial class frmMews : Form
{
Random r = new Random();
public frmMews()
{
InitializeComponent();
}
private void txtPatientName_TextChanged(object sender, EventArgs e)
{
}
private void frmMews_Load(object sender, EventArgs e)
{
tmrResps.Enabled = false;
tmrResps.Interval = 300;
tmrHeart.Enabled = false;
tmrHeart.Interval = 700;
tmrBlood.Enabled = false;
tmrBlood.Interval = 700;
tmrConsious.Enabled = false;
tmrConsious.Interval = 600;
tmrTemp.Enabled = false;
tmrTemp.Interval = 600;
tmrUrine.Enabled = false;
tmrUrine.Interval = 600;
}
private void btnStart_Click(object sender, EventArgs e)
{
tmrResps.Enabled = true;
tmrResps.Interval = 2000;
tmrHeart.Enabled = true;
tmrHeart.Interval = 1000;
tmrBlood.Enabled = true;
tmrBlood.Interval = 2000;
tmrConsious.Enabled = true;
tmrConsious.Interval = 5000;
tmrTemp.Enabled = true;
tmrTemp.Interval = 1000;
tmrUrine.Enabled = true;
tmrUrine.Interval = 5000;
}
private void tmrResps_Tick(object sender, EventArgs e)
{
Random r = new Random();
int x = ( (int)( (r.Next(0, 100) ) / 10) ) * 10;
if (lblResps.BackColor == System.Drawing.Color.Magenta)
{
lblResps.BackColor = System.Drawing.Color.Magenta;
lblResps.Size = new System.Drawing.Size( x, 23);
}
else
{
lblResps.BackColor = System.Drawing.Color.Magenta;
}
}
private void tmrHeart_Tick(object sender, EventArgs e)
{
int x = ((int)((r.Next(0, 100)) / 10)) * 10;
if (lblHeart.BackColor == System.Drawing.Color.Cyan)
{
lblHeart.BackColor = System.Drawing.Color.Cyan;
lblHeart.Size = new System.Drawing.Size(x, 23);
}
else
{
lblHeart.BackColor = System.Drawing.Color.Cyan;
}
}
private void tmrBlood_Tick(object sender, EventArgs e)
{
int x = ((int)((r.Next(0, 100)) / 10)) * 10;
if (lblBlood.BackColor == System.Drawing.Color.Red)
{
lblBlood.BackColor = System.Drawing.Color.Red;
lblBlood.Size = new System.Drawing.Size(x, 23);
}
else
{
lblBlood.BackColor = System.Drawing.Color.Red;
}
}
private void tmrConsious_Tick(object sender, EventArgs e)
{
int x = ((int)((r.Next(0, 100)) / 10)) * 10;
if (lblConsious.BackColor == System.Drawing.Color.Green)
{
lblConsious.BackColor = System.Drawing.Color.Green;
lblConsious.Size = new System.Drawing.Size(x, 23);
}
else
{
lblConsious.BackColor = System.Drawing.Color.Green;
}
}
private void tmrTemp_Tick(object sender, EventArgs e)
{
int x = ((int)((r.Next(0, 100)) / 10)) * 10;
if (lblTemp.BackColor == System.Drawing.Color.Brown)
{
lblTemp.BackColor = System.Drawing.Color.Brown;
lblTemp.Size = new System.Drawing.Size(x, 23);
}
else
{
lblTemp.BackColor = System.Drawing.Color.Brown;
}
}
private void tmrUrine_Tick(object sender, EventArgs e)
{
int x = ((int)((r.Next(0, 100)) / 10)) * 10;
if (lblUrine.BackColor == System.Drawing.Color.Yellow)
{
lblUrine.BackColor = System.Drawing.Color.Yellow;
lblUrine.Size = new System.Drawing.Size(x, 23);
}
else
{
lblUrine.BackColor = System.Drawing.Color.Yellow;
}
}
}
}
}
Random Number code im using:
namespace RandomNumber
{
class Program
{
static void Main(string[] args)
{
Random r = new Random();
for (int i = 0; i < 500; i++)
{
int x = ( (int)( ( r.Next(0, 100) ) / 10 ) ) * 10;
Console.WriteLine(x.ToString());
}
}
}
}