المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Passing Information to Timer.Elapsed Method



C# Programming
09-15-2009, 10:12 AM
Hi guys!
I have a question concerning the Timer Elapse Event and the invoked Method.
Is it possible to add an object to the timer which is passed to the Method?

Something like this:

public Timer MouseHooverTimer
{
get
{
if (mouseHooverTimer == null)
{
mouseHooverTimer = new Timer(2000);
mouseHooverTimer.Elapsed += new ElapsedEventHandler(mouseHooverTimer_Elapsed);
}
return mouseHooverTimer;
}
}

private void StartTimer(object information)
{
mouseHooverTimer.Start();