I need to be able to affect multiple Textblock elements within my TimerCallback. At the moment, I have this:
t = new Timer(tc, myLabel, 0, 1000);
However, in tc, I’d like to do the following:
myLabel.Text = "ABC";
myLabel2.Text = "DEF";
I haven’t figured out how to pass more than one object to my TimerCallback. Anytime I attempt to set a TextBlock inside my TimerCallback, I get an error:
System.UnauthorizedAccessException
I tried coding in an array of Objects but that didn’t work.
You need to use
DispatchTimer. You have to do that since it is a seperate thread.