[C#] Restart Problem
#5

ofc it only update when u klick how u done it.

 

you need to do that in the checking methode(timer.tick event)

 

for example:

 

public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

Timer MyTimer = new Timer();

private void Form1_Load(object sender, EventArgs e)
{
MyTimer.Interval = 6000;
MyTimer.Tick += new EventHandler(MyTimer_tick);

}

private void button1_Click(object sender, EventArgs e)
{
// your code to start the processes

MyTimer.Enabled = true;
MyTimer_tick(sender, e);
}

private void MyTimer_tick(Object myObject,EventArgs myEventArgs)
{
bool Test = CheckIfAProcessIsRunning("connector");
if (Test == true)
{
label1.ForeColor = System.Drawing.Color.Green;
label1.Text = "Connector";
}
else
{
label1.ForeColor = System.Drawing.Color.Red;
label1.Text = "Connector";
}

}

private bool CheckIfAProcessIsRunning(string processname)
{
return Process.GetProcessesByName(processname).Length > 0;
}



Messages In This Thread
[No subject] - by Nikolee - 04-27-2012, 09:50 PM
[No subject] - by Nikolee - 04-27-2012, 10:20 PM
[No subject] - by HateMe - 04-28-2012, 12:03 PM
[No subject] - by Nikolee - 04-28-2012, 01:07 PM
[No subject] - by HateMe - 04-28-2012, 01:28 PM
[No subject] - by Nikolee - 04-28-2012, 04:36 PM
[No subject] - by Nikolee - 04-28-2012, 07:55 PM
[No subject] - by HateMe - 04-28-2012, 10:38 PM
[No subject] - by Nikolee - 05-01-2012, 10:09 PM
[No subject] - by HateMe - 05-01-2012, 11:06 PM
[No subject] - by Nikolee - 05-02-2012, 10:54 AM
[No subject] - by Nikolee - 05-03-2012, 01:24 PM
[No subject] - by someone - 05-03-2012, 11:35 PM
[No subject] - by HateMe - 05-04-2012, 12:00 AM
[No subject] - by Nikolee - 05-05-2012, 11:47 AM
[No subject] - by someone - 05-05-2012, 12:26 PM
[No subject] - by HateMe - 05-05-2012, 12:30 PM
[No subject] - by Nikolee - 05-05-2012, 12:37 PM
[No subject] - by HateMe - 05-05-2012, 01:11 PM
[No subject] - by Nikolee - 05-05-2012, 10:57 PM
[No subject] - by someone - 05-05-2012, 11:37 PM
[No subject] - by Nikolee - 05-06-2012, 04:09 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)