DispatcherTimer in background task of windows phone 8.1

2

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?

c#
windows-phone-8.1
asked on Stack Overflow Jul 25, 2015 by user3684195 • edited Jul 25, 2015 by user3684195

1 Answer

1

User contributions licensed under CC BY-SA 3.0