我使用C#。我想制作一个可以做一些事情的方法,然后等待用户单击四个按钮之一。我想要类似于MessageDialog异步方法的东西,它在这种情况下等待用户单击,“是”或“否”:
private async void Button_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e)
{
var x = new MessageDialog("Yes or no?", "Choose");
x.Commands.Add(new UICommand("Yes", (UICommandInvokeHandler) =>
{
// blabla
}));
x.Commands.Add(new UICommand("No", (UICommandInvokeHandler) =>
{
// blabla
}));
await x.ShowAsync();
}
问题是我不能使用此方法(MessageDialog),因为我需要4个选项,但MessageDialog最多为3个。
编辑:
private void Button_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e)
{
// doing some stuff
Method();
// doing some other stuff
}
private void Method()
{
// makes everything in UI invisible
// then makes the four buttons that were previously invisible, //visible
// here I want the program to stop and wait the user to press one of //the four buttons
// and then make the UI visible and the 4 buttons invisibl
}
Message Dialog
代表WinRT框架中的对话框。它仅支持3个按钮,使其可以在较小的屏幕上使用。您没有其他WinRT选项。但是,您可以创建自己的“对话框之类的” UI控件,但我不建议这样做。也许您可以将用户的决定分为两个消息对话框。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句