Hello,
I have implemented most of the proper code to dynamically update a GT.Timer interval from a touch screen keyboard input. On StartProgram() the timer is not running. The first time i update the interval from the screen the timer starts and blinks the DebugLED at the proper rate and I can carryout other tasks in the overall program.
However, when I update the timer interval again from the screen, the Debug LED then starts to blink sporadically. Almost as if the timer is confused about what the interval really is and it is stepping on itself.
Is there something that I have to reset dealing with this timer?
portions of the Code Below:
//input the delay time from a keyboard
UpDelayTime = (TextBox)ManualWindow.GetChildByName("UpDelayTime");
UpDelayTime.TapEvent += new OnTap(Glide.OpenKeyboard);
UpDelayTime.ValueChangedEvent += new OnValueChanged(UpDelayTime_ValueChangedEvent);
//This portion of the code will change the delay interval and accept input
//TopDelayTime is changed and sent to the timer_interval write portion
void UpDelayTime_ValueChangedEvent(object sender)
{
TopDelayTime = int.Parse(UpDelayTime.Text);////milliseconds
//Debug.Print("" + TopDelayTime);
if (OldTopDelayTime != TopDelayTime)
{
OldTopDelayTime = TopDelayTime;
}
Set_Wait_at_top_Timer_Interval(TopDelayTime);
}
//Accept the new interval and write to the timer and start timer
void Set_Wait_at_top_Timer_Interval(int NewInterval)
{
TopDelayTime = NewInterval;
TimeSpan interval = new TimeSpan(0, 0, 0, 0, TopDelayTime*1000);
GT.Timer Wait_at_top_Timer = new GT.Timer(interval);
Wait_at_top_Timer.Tick += new GT.Timer.TickEventHandler(Wait_at_top_Timer_Tick);
if (Wait_at_top_Timer.IsRunning)
{
Wait_at_top_Timer.Stop();
}
else
{
Wait_at_top_Timer.Interval = interval;
Wait_at_top_Timer.Start();
}
}
//timer call
void Wait_at_top_Timer_Tick(GT.Timer Timer3)
{
PulseDebugLED();
}
Let me know if you need any further information.
Thanks,
Jordan