WildGums / Orc.Wizard

Easily create wizards for WPF using MVVM
Other
45 stars 18 forks source link

Alt+F4 calls WizardPageViewModelBase.CancelAsync #330

Open lipchev opened 3 years ago

lipchev commented 3 years ago

Please check all of the platforms you are having the issue on (if platform is not listed, it is not supported)

Component

WizardWindow / WizardViewModel

Version of Library

4.2.0 / 4.3.0

Version of OS(s) listed above with issue

win10

Steps to Reproduce

  1. Override the CancelAsync method on any WizardPageViewModel (e.g. SkillsPageViewModel)
  2. Navigate to the target page and press Alt + F4

Expected Behavior

The behavior is identical to the one used for the CancelCommand- that is the WizardPageViewModel.CancelAsync is only called after the user confirms the cancellation (by default).

Actual Behavior

The CancelAsync on the WizardPageViewModel is called before the confirmation dialog is displayed (from the respective CancelAsync method on the WizardViewModel).

lipchev commented 3 years ago

The problem is that the CancelViewModelAync initiated by the DiscardChangesAsync method on the DataWindow triggers the CancelingAsync event, to which the child view model responds first, before returning to the top level CancelAsync method (where the confirmation code lies).

The quick-and-dirty solution I came up with is to override the DiscardChangesAsync on my (custom) WizardWindow, executing the CancelCommand instead of directly calling the CancelViewModelAsync method

GeertvanHorrik commented 3 years ago

Great find. We should indeed fix this in the WizardWindow. Interested in a PR?

lipchev commented 3 years ago

Sure, I'll look into it..

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.