Orc.Wizard icon indicating copy to clipboard operation
Orc.Wizard copied to clipboard

Alt+F4 calls WizardPageViewModelBase.CancelAsync

Open lipchev opened this issue 4 years ago • 4 comments

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

  • [x] WPF
  • [ ] UWP
  • [ ] iOS
  • [ ] Android
  • [ ] .NET Standard
  • [x] .NET Core

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 avatar Jan 04 '21 14:01 lipchev

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

lipchev avatar Jan 04 '21 14:01 lipchev

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

GeertvanHorrik avatar Jan 05 '21 11:01 GeertvanHorrik

Sure, I'll look into it..

lipchev avatar Jan 05 '21 13:01 lipchev

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.

stale[bot] avatar Apr 16 '22 12:04 stale[bot]