适用于 Windows Phone 8.1 的新 API [英] new APIs for windows phone 8.1

查看:32
本文介绍了适用于 Windows Phone 8.1 的新 API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在 windows phone 8.1 中使用这两种方法(WP 8),但它给出了错误并且无法编译,很可能是因为它们被删除了.我尝试搜索新的 API,但找不到任何.这些还有哪些其他选择.

I am trying to use these two methods (of WP 8) in windows phone 8.1, but it gives error and doesn't compile, most probably becasue they are removed. I tried searching the new APIs but couldn't get any. What are other alternatives for these.

Dispatcher.BeginInvoke( () => {}); msdn 链接

System.Threading.Thread.Sleep(); msdn 链接

推荐答案

它们仍然适用于 Windows Phone 8.1 SIlverlight 应用程序,但不适用于 Windows Phone 商店应用程序.Windows 应用商店应用的替代品是:

They still exists for Windows Phone 8.1 SIlverlight Apps, but not for Windows Phone Store Apps. The replacements for Windows Store Apps is:

Sleep(参见 Windows Store .NET 中的 Thread.Sleep 替换):

Sleep (see Thread.Sleep replacement in .NET for Windows Store):

await System.Threading.Tasks.Task.Delay(TimeSpan.FromSeconds(30));

Dispatcher(参见如何部署.Current.Dispatcher.BeginInvoke 在 Windows 商店应用程序中工作?):

Dispatcher (see How the Deployment.Current.Dispatcher.BeginInvoke work in windows store app?):

CoreDispatcher dispatcher = CoreWindow.GetForCurrentThread().Dispatcher;
await dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { });

这篇关于适用于 Windows Phone 8.1 的新 API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆