Timers not working

Hello, I have setup a timer to simulate cursor blinking. My program has multiple threads. the thing is that my timer went off but it never calls the function delegate to the Tick events.
Do you what is reason why the tick event nevers calls the function to do my blinking

private System.Windows.Forms.Timer timer = new System.Windows.Forms.Timer();

timer.Tick += new EventHandler(BlinkMode);
timer.Interval = 150;
timer.Enabled = true;

//=============================================================
// timer tick handler
//=============================================================
private void BlinkMode(Object obj, EventArgs ea)
{
if (!BlinkCursor)
{
if (curX < 19) // Don't show the cursor if it's at the end of the line
{
DrawChar('_', curX, curY); // Draw an underscore char at the current coordinate
BlinkCursor = true;
}
}

else
{
DrawChar(HiddenChar, curX, curY);
BlinkCursor = false;
}
}




Answer this question

Timers not working

  • GCB

    I just want to be more specific about what im doing.
    I have a class library which simulate a VT100 like terminal, and i added it as reference to my project. From my main project i call a method from that added class library. In this method, I process all the data that need to be printed on the terminal screen and then i set the timer like the code above which will trigger the BlinkMode method. while debugging, I can see that my timer went off but nothing from the BlinkMode() works.

    thank you

  • humble.apprentice

    By saying that the timer went off do you mean that the BlinkMode() function was called If you set a breakpoint at the top of BlinkMode() do you hit it (If not how did you determine the timer had fired )
    -Noah Falk
    .Net Compact Framework



  • JFoushee

    I fixed the prob by setting the timer in the constructor. When i put it in my function it never calls the function. Well the timer is enable when i check the variables in debug mode.

  • Timers not working