Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ShowMessageAsync won't return any thing when using HideMetroDialogAsync while it's opened #2018

Closed
bigworld12 opened this issue Jul 4, 2015 · 0 comments
Milestone

Comments

@bigworld12
Copy link
Contributor

how to produce :
create a timer with 5 seconds interval or what ever but don't start it
in the timer call back add this code

dial = DialogManager.GetCurrentDialogAsync<MessageDialog>(this).Result;
this.HideMetroDialogAsync(dial);

now in the main code start the timer first then call ShowMessageAsync
you will see that it will never return a value and the method calling it will never end
i think there is an easy solution by adding a "None" value to the MessageDialogResult Enum
and changing
this line : https://github.com/MahApps/MahApps.Metro/blob/master/MahApps.Metro/Controls/Dialogs/MessageDialog.cs#L45

to this :

public TaskCompletionSource<MessageDialogResult> tcs = new TaskCompletionSource<MessageDialogResult>();

then when calling HideMetroDialogAsync
you can do

 dial.cleanUpHandlers();
 dial.tcs.TrySetResult(MessageDialogResult.None);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants