MahApps.Metro 消息和进度连接
MahApps.Metro Message and Progress connect
我想用 MahApps 创建一个如下所示的逻辑:
ShowScreenCommand = new Command(async () =>
{
var window = Application.Current.MainWindow as MetroWindow;
if (await window.ShowMessageAsync("Are you sure to remove it?", "Removal", MessageDialogStyle.AffirmativeAndNegative) == MessageDialogResult.Affirmative)
{
await removePatientTask();
}
});
private async Task removeTask()
{
var window = Application.Current.MainWindow as MetroWindow;
var controller = await window.ShowProgressAsync("Please wait...","Process message",false,new MetroDialogSettings());
await Task.Delay(5000);
await controller.CloseAsync();
}
问题是,消息和进度对话框之间存在间隙。一个对话框隐藏,第二个对话框显示。这看起来并不完美。
有没有办法消除这个差距?我的意思是,用另一个对话框替换一个对话框?
尝试移除ShowMessageAsync
方法的结束动画:
await window.ShowMessageAsync("Are you sure to remove it?",
"Removal",
MessageDialogStyle.AffirmativeAndNegative,
new MetroDialogSettings
{
AnimateHide = false
});
也许您还需要删除 Progress 的显示动画,它基本上是相同的代码,但将 AnimateHide
替换为 AnimateShow
。
我想用 MahApps 创建一个如下所示的逻辑:
ShowScreenCommand = new Command(async () =>
{
var window = Application.Current.MainWindow as MetroWindow;
if (await window.ShowMessageAsync("Are you sure to remove it?", "Removal", MessageDialogStyle.AffirmativeAndNegative) == MessageDialogResult.Affirmative)
{
await removePatientTask();
}
});
private async Task removeTask()
{
var window = Application.Current.MainWindow as MetroWindow;
var controller = await window.ShowProgressAsync("Please wait...","Process message",false,new MetroDialogSettings());
await Task.Delay(5000);
await controller.CloseAsync();
}
问题是,消息和进度对话框之间存在间隙。一个对话框隐藏,第二个对话框显示。这看起来并不完美。
有没有办法消除这个差距?我的意思是,用另一个对话框替换一个对话框?
尝试移除ShowMessageAsync
方法的结束动画:
await window.ShowMessageAsync("Are you sure to remove it?",
"Removal",
MessageDialogStyle.AffirmativeAndNegative,
new MetroDialogSettings
{
AnimateHide = false
});
也许您还需要删除 Progress 的显示动画,它基本上是相同的代码,但将 AnimateHide
替换为 AnimateShow
。