通用应用程序的MessageBox:"名称'MessageBox的“在目前情况下"不存在; [英] Universal Apps MessageBox: "The name 'MessageBox' does not exist in the current context"
问题描述
我想使用的MessageBox用于显示在我的WP8.1的应用程序下载错误
I want to use MessageBox for showing download errors in my WP8.1 app.
我说:
using System.Windows;
但是当我键入:
but when I type:
MessageBox.Show("");
我得到错误:
I get error:
"The name 'MessageBox' does not exist in the current context"
在对象浏览器,我发现,这样的类应该存在,并在项目 - >添加引用... - >组件 - >框架。结果表明,所有组件都引用
In Object Browser I found that such class should exist and in "Project->Add reference... ->Assemblies->Framework" is shown that all assemblies are referenced.
我错过了什么?还是有另一种方式如何显示类似消息框?
Do I miss something? Or is there another way how to show something like messagebox?
推荐答案
有关通用应用程序,新的API需要你使用等待MessageDialog()。ShowAsync()
(在Windows.UI.Popups),以使其符合与Win 8.1。
For Universal Apps, the new APIs require you to use await MessageDialog().ShowAsync()
(in Windows.UI.Popups) to bring it into line with Win 8.1.
var dialog = new MessageDialog("Your message here");
await dialog.ShowAsync();
这篇关于通用应用程序的MessageBox:"名称'MessageBox的“在目前情况下"不存在;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!