如何在非 UI 代码 windows phone 8 中获取 Dispatcher [英] How to get Dispatcher in non UI code windows phone 8

查看:16
本文介绍了如何在非 UI 代码 windows phone 8 中获取 Dispatcher的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以在 Windows 8 中获取 CoreDispatcher 对象

I can get the CoreDispatcher object in windows 8 as

CoreDispatcher dispatcher = Windows.UI.Core.CoreWindow.GetForCurrentThread().Dispatcher;

但是我怎样才能在 windows phone 8 中获得 Dispatcher
这样我就可以打电话

But how can I get the Dispatcher in windows phone 8
So that I can call

Dispatcher.BeginInvoke(delegate
{
    //My statements
});

推荐答案

使用 Deployment.Current.Dispatcher 获取 Windows Phone 中的 Dispatcher 对象.

Use Deployment.Current.Dispatcher to get the Dispatcher object in Windows Phone.

这篇关于如何在非 UI 代码 windows phone 8 中获取 Dispatcher的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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