c# - How to execute a method on Windows Phone 8 every specific time? -
how make windows phone 8 app run method every specific time, 1 minute? want run when app open, don't need background tasks. write programs in c#
what want called dispatchertimer take @ here:
msdn : dispatchertimer class wp8
msdn : dispatchertimer class wp runtime
remember include the
system.windows.threading // [for windows phone 8] windows.ui.xaml // [for windows universal app] example msdn
private void page_onloaded(object sender, routedeventargs e) { dispatchertimer timer = new dispatchertimer(); timer.tick += delegate(object s, eventargs args) { // code execute }; timer.interval = new timespan(0, 0, 1); // 1 second timer.start(); }
Comments
Post a Comment