我正在尝试播放一首歌,然后一个人正在调用我的应用程序。但是后来使用了mediaElement1.play();
我只得到The calling thread cannot access this object because a different thread owns it.
。我试过使用线程。但问题就在于此问题。
最好的关注Morten Starck
答案 0 :(得分:2)
这可以解决这个问题吗?
if (!mediaElement1.CheckAccess())
mediaElement1.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal,
(Action)delegate
{
mediaElement1.play();
});