0

So, here's my problem atm:

I've declared the timer as a class member

private int numSS;        
private System.Windows.Forms.Timer timer1;

I've initialized the Timer in the constructor:

timer1 = new System.Windows.Forms.Timer();            
timer1.Tick += new System.EventHandler(timer1_Tick);            
timer1.Interval = 1000;

A Method of mine starts the timer

public void InGameCrowdScreenshots(int numScreenshots)        
{            
        timer1.Enabled = true;            
        while(numSS <= numScreenshots)            
        {            }            
        print("Complete");        
}

and here's the onTick

private void timer1_Tick(object sender, System.EventArgs e)        
{            
      if(sender == timer1)            
      {                
             TakeConsoleScreenShot();                
             numSS++;                
             if(numSS >= 10)                    
             timer1.Stop();            
       }        
}

When stepping through in debug, timer1_Tick is never called. The while loop is going forever obviously because 0 is < whatever number is passed into it. But, i was under the impression the timertick was on a separate thread, runnning in the background for me.

1
Contributor
1
Reply
3
Views
10 Years
Discussion Span
Last Post by mariocatch
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.