Declare global variable as a flag. In timer event handler, check the flag to decide run or stop.