Reputation: 2071
I would like to create a logic with MahApps which 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();
}
Problem is, that there is a gap between Message and Progress dialogs. One dialog hides, second one shows. This is not looking perfectly.
Is there a way to remove this gap? I mean, to replace one dialog with another?
Upvotes: 4
Views: 2099
Reputation: 6175
Try removing the closing animation of the ShowMessageAsync
method:
await window.ShowMessageAsync("Are you sure to remove it?",
"Removal",
MessageDialogStyle.AffirmativeAndNegative,
new MetroDialogSettings
{
AnimateHide = false
});
Maybe you'll have to remove the showing animation of the Progress as well, it's basically the same code, but replacing AnimateHide
by AnimateShow
.
Upvotes: 2