Win8的C#地铁调度员和RPC_E_WRONG_THREAD [英] Win8 C# Metro dispatcher and RPC_E_WRONG_THREAD

查看:297
本文介绍了Win8的C#地铁调度员和RPC_E_WRONG_THREAD的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想建立使用.NET非官方谷歌音乐API在Windows 8 Metro界面的应用程序。
我加载整个播放列表



 的foreach(在pls.UserPlaylists GoogleMusicPlaylist P)
lbPlaylists.Items 。新增(p.Title);

和它与此错误



<$上来p $ p> HRESULT:0x8001010E(RPC_E_WRONG_THREAD))

和我读左右互联网也许我不得不使用调度或某事,我只是一般迷茫。


解决方案

使用此

  Dispatcher.RunAsync(CoreDispatcherPriority.Normal,()=> 
{
的foreach(GoogleMusicPlaylist p在pls.UserPlaylists)
{
lbPlaylists.Items.Add(p.Title);
}
});


I am trying to build an application using the unofficial Google music api for .net in Windows 8 metro interface. I am loading the whole playlist

foreach (GoogleMusicPlaylist p in pls.UserPlaylists)
                lbPlaylists.Items.Add(p.Title);

and it comes up with this error

HRESULT: 0x8001010E (RPC_E_WRONG_THREAD))

And I read around the internet and maybe I have to use dispatcher or something I am just generally confused.

解决方案

Use this

Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
            {
                foreach (GoogleMusicPlaylist p in pls.UserPlaylists)
                {
                    lbPlaylists.Items.Add(p.Title);
                }
            });

这篇关于Win8的C#地铁调度员和RPC_E_WRONG_THREAD的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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