Exemple #1
0
        private void ExecuteSelectPreviousPage()
        {
            WizardPage previousPage = null;

            if (PreviousPageCommand?.CanExecute(CanSelectPreviousPage) == true)
            {
                PreviousPageCommand?.Execute(CanSelectPreviousPage);
            }

            if (CurrentPage != null)
            {
                var eventArgs = new RoutedEventArgs(PreviousEvent);
                this.RaiseEvent(eventArgs);
                //if (eventArgs.Cancel)
                //    return;

                //check previous page
                if (CurrentPage.PreviousPage != null)
                {
                    previousPage = CurrentPage.PreviousPage;
                }
                else
                {
                    //no previous page defined so use index
                    var currentIndex      = Items.OfType <WizardPage>().ToList().IndexOf(CurrentPage);
                    var previousPageIndex = currentIndex - 1;
                    if (previousPageIndex >= 0 && previousPageIndex < Items.OfType <WizardPage>().Count())
                    {
                        previousPage = Items.OfType <WizardPage>().ToList()[previousPageIndex];
                    }
                }
            }

            CurrentPage = previousPage;
        }
Exemple #2
0
 protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs e)
 {
     base.OnPropertyChanged(e);
     if (
         e.Property.Name == nameof(CanSelectNextPage) ||
         (e.Property.Name == nameof(CanHelp)) ||
         (e.Property.Name == nameof(CanFinish)) ||
         (e.Property.Name == nameof(CanCancel)) ||
         (e.Property.Name == nameof(CanSelectPreviousPage)) ||
         (e.Property.Name == nameof(CurrentPage))
         )
     {
         CancelCommand?.CanExecute(CanCancel);
         FinishCommand?.CanExecute(CanFinish);
         PreviousPageCommand?.CanExecute(CanSelectPreviousPage);
         NextPageCommand?.CanExecute(CanSelectNextPage);
         HelpCommand?.CanExecute(CanHelp);
         UpdateButtonState();
     }
 }