Good day to all of you. Can anyone tell me how can I start performing my function repeatedly every second, when my app starts? I have set up timer according to some examples I found here and through google. However, when I run my app nothing is happeneing.
here is the code
public void kasifikuj()
{
if (File.Exists(@"E:\KINECT\test.txt"))
{
File.Delete(@"E:\KINECT\test.txt");
}
File.AppendAllText(@"E:\KINECT\test.txt", shoulderRightY + " " + shoulderLeftY + " " + headY + " " + hipY + Environment.NewLine);
double detect = Program.siet();
vysledok.Text = detect.ToString();
}
private Timer timer1;
public void InitTimer()
{
timer1 = new Timer();
timer1.Tick += new EventHandler(timer1_Tick);
timer1.Interval = 1000; // in miliseconds
timer1.Start();
}
public void timer1_Tick(object sender, EventArgs e)
{
kasifikuj();
}
EDIT:
Or can you suggest another way to run my kasifikuj() method every second please?