I'm developing a c# application. I need 2 threads; the main one, and another that is continuously looking for information through my database.
I want to use Dispatcher Timer
as:
dispatcherBd.Tick += (s,e) => CallPoll (s,e);
dispatcherBd.Interval = new TimeSpan(0,0,0,100);
dispatcherBd.Start();
If i do this into my main thread, everything works perfectly, but if I do into a new thread. It doesn't work.
public Main(){
threadDB = new Thread(InitDispatcher);
threadDB.Start();
}
private void InitDispatcher(){
DispatcherTimer dispatcherBd.Tick += (s,e) => CallPoll (s,e);
dispatcherBd.Interval = new TimeSpan(0,0,0,100);
dispatcherBd.Start();
}
What's the problem?