protected virtual WizardNavigationButton CreateForwardButton(IWizard wizard) { var button = new WizardNavigationButton { Content = _languageService.GetString("Wizard_Next"), IsVisibleEvaluator = () => !wizard.IsLastPage(), StyleEvaluator = (x) => { var styleName = !wizard.IsLastPage() ? "WizardNavigationPrimaryButtonStyle" : "WizardNavigationButtonStyle"; var application = System.Windows.Application.Current; return(application?.TryFindResource(styleName) as Style); }, Command = new TaskCommand(async() => { await wizard.MoveForwardAsync(); }, () => { if (!wizard.HandleNavigationStates) { return(true); } return(wizard.CanMoveForward); }) }; return(button); }
protected virtual WizardNavigationButton CreateCancelButton(IWizard wizard) { var button = new WizardNavigationButton { Content = _languageService.GetString("Wizard_Cancel"), IsVisible = true, Command = new TaskCommand(async() => { if (await _messageService.ShowAsync(_languageService.GetString("Wizard_AreYouSureYouWantToCancelWizard"), button: MessageButton.YesNo) == MessageResult.No) { return; } await Wizard.CancelAsync(); }, () => { if (!wizard.HandleNavigationStates) { return(true); } return(wizard.CanCancel); }) }; return(button); }
protected virtual WizardNavigationButton CreateFinishButton(IWizard wizard) { var button = new WizardNavigationButton { Content = _languageService.GetString("Wizard_Finish"), IsVisibleEvaluator = () => wizard.IsLastPage(), Command = new TaskCommand(async() => { await wizard.ResumeAsync(); }, () => { if (!wizard.HandleNavigationStates) { return(true); } if (!Wizard.CanResume) { return(false); } // Don't validate var validationSummary = wizard.GetValidationContextForCurrentPage(false); if (!validationSummary.HasErrors) { return(true); } return(false); }) }; return(button); }
protected virtual WizardNavigationButton CreateFinishButton(IWizard wizard) { var button = new WizardNavigationButton { Content = _languageService.GetString("Wizard_Finish"), IsVisibleEvaluator = () => wizard.IsLastPage(), StyleEvaluator = (x) => { var styleName = wizard.IsLastPage() ? "WizardNavigationPrimaryButtonStyle" : "WizardNavigationButtonStyle"; var application = System.Windows.Application.Current; return(application?.TryFindResource(styleName) as Style); }, Command = new TaskCommand(async() => { await wizard.ResumeAsync(); }, () => { if (!wizard.HandleNavigationStates) { return(true); } if (!Wizard.CanResume) { return(false); } // Don't validate var validationSummary = wizard.GetValidationContextForCurrentPage(false); if (!validationSummary.HasErrors) { return(true); } return(false); }) }; return(button); }
protected virtual WizardNavigationButton CreateBackButton(IWizard wizard) { var button = new WizardNavigationButton { Content = _languageService.GetString("Wizard_Back"), IsVisibleEvaluator = () => !wizard.IsFirstPage(), Command = new TaskCommand(async() => { await wizard.MoveBackAsync(); }, () => { if (!wizard.HandleNavigationStates) { return(true); } return(wizard.CanMoveBack); }) }; return(button); }