gpt4 book ai didi

c# - MahApps.Metro 消息和进度连接

转载 作者:行者123 更新时间:2023-11-30 12:25:50 25 4
gpt4 key购买 nike

我想用 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

关于c# - MahApps.Metro 消息和进度连接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30568292/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com