I am working on a C # Windows Forms application where I need a method to pause for 30 seconds until it moves to the next line of code. I tried Thread.Sleep() , which is not suitable for this application, and I realized that I should use some kind of timer instead. I searched a lot, but I canβt figure out how to implement timers.
My code is below and someone can show me how I should use the timer. I made a comment about where I want the method to pause.
private void start_Vid_Click(object sender, EventArgs e) { if (video.State != StateFlags.Running) { viewport.Visible = true; video.Play(); } //Here I want to wait 30 seconds until the next line of code is triggered viewport.Visible = false; viewport2.Visible = true; pictureBox1.Visible = true; start_Webc(); video2.Play(); }
c # timer
user1881847
source share