Ich verwende Mahapp und ich versuche, das Ergebnis des Dialogs zu warten, aber der Compiler unterstrichen ShowMessageAsync
und mich an:Kann nicht await auf ShowMessageAsync verwenden
ShowMessageAsync doesn't exist in the current context
Dies ist der Code:
private async void ShowMessageBox(object sender, RoutedEventArgs e)
{
var result = await ShowMessageAsync("Hello!", "Welcome to the world of metro!",
MahApps.Metro.Controls.MessageDialogStyle.AffirmativeAndNegative);
if (result == MessageDialogResult.Affirmative)
{
this.ShowMessageAsync("Result", "You said: OK");
}
else
{
this.ShowMessageAsync("Result", "You said: CANCEL");
}
}
haben Sie hinzugefügt alle Namensraum benötigt? – WPMed
@WPMed Ja, ich habe hinzugefügt: 'mit MahApps.Metro.Controls.Dialogs;' – Dillinger