You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My TabItems have CloseButtonEnabled = true. I have CloseCommand : ICommand that I use for CloseTabCommand. Its CanExecute always returns true and the Execute function awaits on some task cancellations before preceding (I've set Execute to async void).
This seems to work fine, but I am not sure how to show the user a confirmation dialog before closing the tab and would appreciate help with that.
I use the MetroWindow.ShowMessageAsync function. I can't use it in the CanExecute function as it would require changing its signature. I can't use it in the Execute function, since as soon as it reaches the await line, execution stops and removes the tab before the user even replies to the confirmation dialog. This also makes me wonder whether my cancellation is actually awaited properly.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
My TabItems have
CloseButtonEnabled = true
. I haveCloseCommand : ICommand
that I use forCloseTabCommand
. ItsCanExecute
always returns true and theExecute
function awaits on some task cancellations before preceding (I've setExecute
toasync void
).This seems to work fine, but I am not sure how to show the user a confirmation dialog before closing the tab and would appreciate help with that.
I use the
MetroWindow.ShowMessageAsync
function. I can't use it in theCanExecute
function as it would require changing its signature. I can't use it in theExecute
function, since as soon as it reaches the await line, execution stops and removes the tab before the user even replies to the confirmation dialog. This also makes me wonder whether my cancellation is actually awaited properly.Beta Was this translation helpful? Give feedback.
All reactions