MahApps.Metro community and progress
I would like to create logic with MahApps that looks like this:
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();
}
The problem is there is a gap between the Message and Progress dialogs. One dialog is hidden, the second shows. It doesn't look great.
Is there a way to close this gap? I mean to replace one dialogue with another?
+3
source to share
1 answer
Try removing the method closing animation ShowMessageAsync
:
await window.ShowMessageAsync("Are you sure to remove it?",
"Removal",
MessageDialogStyle.AffirmativeAndNegative,
new MetroDialogSettings
{
AnimateHide = false
});
You may also need to remove the animation of the Progress reading, this is basically the same code, but replaced AnimateHide
with AnimateShow
.
+1
source to share