Reputation:
I have a constructor with a Timer.tick event,
public PlayMe(int rows, int cols)
{
this.rows = rows;
this.cols = cols;
delay = new Timer();
delay.Enabled = false;
delay.Interval = 550;
delay.Tick += delay_Tick;
restart = new Timer();
restart.Enabled = false;
restart.Interval = 550;
restart.Tick += restart_Tick(rows,cols);
How I fire both rows and cols arguments inside the Timer.Tick method?
void restart_Tick(int rows, int cols)
{
restart.Stop();
if (gameOver && lblLose.Visible)
{
clearBoard();
createBoard(rows,cols);
}
if (gameOver && lblWin.Visible)
{
for (int i = 0; i < 5; i++)
{
clearBoard();
Upvotes: 2
Views: 3944
Reputation:
Rewrite:
restart.Tick += (object s, EventArgs a) => restart_Tick(s, a, rows, cols);
And the method:
void restart_Tick(object sender, EventArgs e,int rows, int cols)
Upvotes: 4