Может быть, кто-нибудь может показать мне, как правильно внедрить асинхронное сообщение в окно Metro, чтобы оно имело текущую тему и акцент приложения?
Код, взятый из демо-примера, работает, но тема и акцент остаются по умолчанию:
private async void ClosingApp(object sender, System.ComponentModel.CancelEventArgs e)
{
e.Cancel = !_shutdown;
if (_shutdown) return;
var mySettings = new MetroDialogSettings()
{
AffirmativeButtonText = "Quit",
NegativeButtonText = "Cancel",
AnimateShow = true,
AnimateHide = false
};
var result = await this.ShowMessageAsync("Quit application?",
"Sure you want to quit application?",
MessageDialogStyle.AffirmativeAndNegative, mySettings);
_shutdown = result == MessageDialogResult.Affirmative;
if (_shutdown)
Application.Current.Shutdown();
}
Когда я просто меняю тему:
private void MenuItem_Click(object sender, RoutedEventArgs e)
{
// set the Red accent and dark theme only to the current window
var theme = ThemeManager.GetAppTheme("BaseDark");
var accent = ThemeManager.GetAccent("Red");
ThemeManager.ChangeAppStyle(Application.Current, accent, theme);
}
Я получаю белый и синий MessageBox по умолчанию. Что я делаю неправильно?