/// <summary> /// 更新按钮状态 /// </summary> private void upButtonStatus() { FirstPageCommand.RaiseCanExecuteChanged(); PreviousPageCommand.RaiseCanExecuteChanged(); NextPageCommand.RaiseCanExecuteChanged(); LastPageCommand.RaiseCanExecuteChanged(); }
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; }
public PaginationViewModel() { CurrentPageIndex = 0; NextCommand = new NextPageCommand(this); PreviousCommand = new PreviousPageCommand(this); FirstCommand = new FirstPageCommand(this); LastCommand = new LastPageCommand(this); }
public virtual bool Equals(PreviousPageCommand other) { if (ReferenceEquals(null, other)) return false; if (ReferenceEquals(this, other)) return true; return Equals(other.display, display) && Equals(other.browsable, browsable); }
private void InitiateCommands() { _firstPageCommand = new FirstPageCommand(); _firstPageCommand.FirstPage += _FirstPage; _previousPageCommand = new PreviousPageCommand(); _previousPageCommand.PreviousPage += _PreviousPage; _nextPageCommand = new NextPageCommand(); _nextPageCommand.NextPage += _NextPage; _lastPageCommand = new LastPageCommand(); _lastPageCommand.LastPage += _LastPage; }
public MainViewModel() { populateList(); ViewList = new CollectionViewSource(); ViewList.Source = PeopleList; ViewList.Filter += new FilterEventHandler(view_Filter); CurrentPageIndex = 0; itemcount = peopleList.Count; CalculateTotalPages(); NextCommand = new NextPageCommand(this); PreviousCommand = new PreviousPageCommand(this); FirstCommand = new FirstPageCommand(this); LastCommand = new LastPageCommand(this); }
public MainViewModel(string jsonStream) { var streamList = JsonConvert.DeserializeObject <List <Person> >(jsonStream); peopleList = new ObservableCollection <Person>(streamList); ViewList = new CollectionViewSource(); ViewList.Source = peopleList; ViewList.Filter += new FilterEventHandler(view_Filter); CurrentPageIndex = 0; itemsCount = peopleList.Count; CalculateTotalPages(); NextCommand = new NextPageCommand(this); PreviousCommand = new PreviousPageCommand(this); JumpToCommand = new JumpToCommand(this); }
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(); } }