如何在 Windows Phone 8 上以异步方法使用 Messagebox.Show? [英] how can i use Messagebox.Show in async method on Windows Phone 8?

查看:26
本文介绍了如何在 Windows Phone 8 上以异步方法使用 Messagebox.Show?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

MessageBox 上生成异常.如何在 async 方法中使用 MessageBox?

Exception generated on MessageBox. How can I use MessageBox in async method?

private async void Purchheard(object sender,EventArgs e)
{
    Debug.WriteLine("Начинаю покупку");
    try
    {
        await CurrentApp.RequestProductPurchaseAsync(ID,false);
        if(license.ProductLicenses[ID].IsActive)
        {
            world.is_freemium=false;
        }
    }
    catch (Exception ex)
    {
        MessageBox.Show("Finished!");
    }
}

推荐答案

Dispatcher.BeginInvoke(delegate() { MessageBox.Show("your stuff"); });

这篇关于如何在 Windows Phone 8 上以异步方法使用 Messagebox.Show?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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