MessageBox上生成异常.如何在异步方法中使用MessageBox?
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"); });