user3684195
user3684195

Reputation: 37

DispatcherTimer in background task of windows phone 8.1

I want to create a background task in windows phone 8.1 and I want to use a timer task in order to count down a specific time. Therefore, I try using DispatcherTimer class to do this. However, it shows up an error when I try to create it:

DispatcherTimer timer = new DispatcheTimer();

The error is: An exception of type 'System.Exception' occurred in TimerTaskBackground.winmd but was not handled in user code

Additional information: The application called an interface that was marshalled for a different thread. (Exception from HRESULT: 0x8001010E (RPC_E_WRONG_THREAD))

Can anyone explain to me the problem here? and Are there other ways to countdown a specific time to do something?

Upvotes: 3

Views: 555

Answers (1)

Related Questions