private void ExecuteSelectNextPage() { WizardPage nextPage = null; if (NextPageCommand?.CanExecute(CanSelectNextPage) == true) { NextPageCommand?.Execute(CanSelectNextPage); } if (CurrentPage != null) { var eventArgs = new RoutedEventArgs(NextEvent); this.RaiseEvent(eventArgs); //if (eventArgs.Cancel) // return; //check next page if (CurrentPage.NextPage != null) { nextPage = CurrentPage.NextPage; } else { //no next page defined use index var currentIndex = Items.OfType <WizardPage>().ToList().IndexOf(CurrentPage); var nextPageIndex = currentIndex + 1; if (nextPageIndex < Items.OfType <WizardPage>().Count()) { nextPage = Items.OfType <WizardPage>().ToList()[nextPageIndex]; } } } CurrentPage = nextPage; }
private void OnSelectedPageChanged() { try { var index = Configuration.Pages.IndexOf(SelectedPage); for (int i = 0; i < index; i++) { var page = Configuration.Pages.ElementAt(i); if (!page.Validate()) { Dispatcher.CurrentDispatcher.BeginInvoke(DispatcherPriority.ContextIdle, new Action(() => SelectedPage = page)); return; } } IsLastPage = index == Configuration.Pages.Count - 1; } finally { NextPageCommand.RaiseCanExecuteChanged(); PrevPageCommand.RaiseCanExecuteChanged(); } }
public PaginatorControlViewModel() { NextPCommand = new NextPageCommand(this); PreviusPCommand = new PreviusPageCommand(this); LastPCommand = new LastPageCommand(this); FirstPCommand = new FirstPageCommand(this); }
private void SetSteps(IEnumerable <CreateTileStep> steps) { var typeStep = new CreateTileStep() { Page = new SelectTypePage() { DataContext = this }, PageHeader = "Select tile type", Validate = (tile) => tile != null && tile.Type != 0 }; _createSteps.Clear(); _createSteps.Add(typeStep); _createSteps.AddRange(steps); LeftButtonCommand = CancelCommand; LeftButtonContent = "Cancel"; if (_createSteps.Count == 1) { RightButtonCommand = FinishCommand; RightButtonContent = "Finish"; } else { RightButtonCommand = NextPageCommand; RightButtonContent = "Next"; } NextPageCommand.OnCanExecuteChanged(); FinishCommand.OnCanExecuteChanged(); }
/// <summary> /// 更新按钮状态 /// </summary> private void upButtonStatus() { FirstPageCommand.RaiseCanExecuteChanged(); PreviousPageCommand.RaiseCanExecuteChanged(); NextPageCommand.RaiseCanExecuteChanged(); LastPageCommand.RaiseCanExecuteChanged(); }
private void PreviousPage() { _currentStepIndex--; if (_currentStepIndex == _createSteps.Count - 1) { RightButtonCommand = FinishCommand; RightButtonContent = "Finish"; } else { RightButtonCommand = NextPageCommand; RightButtonContent = "Next"; } if (_currentStepIndex == 0) { LeftButtonCommand = CancelCommand; LeftButtonContent = "Cancel"; } else { LeftButtonCommand = PreviousPageCommand; LeftButtonContent = "Back"; } OnPropertyChanged("CurrentStep"); NextPageCommand.OnCanExecuteChanged(); FinishCommand.OnCanExecuteChanged(); }
private void RoomChangedHandler() { OnPropertyChanged("SelectedRoom"); AddAppointements(); FilterAppointementsByRoom(); AllFlag = true; NextPageCommand.RaiseCanExecuteChanged(); }
private void OnPageNumberChange() { SendPropertyChanged(nameof(CurrentPageNumber)); SendPropertyChanged(nameof(PageStart)); SendPropertyChanged(nameof(PageEnd)); PreviousPageCommand.RaiseCanExecuteChanged(); NextPageCommand.RaiseCanExecuteChanged(); }
private void CheckAppointementsLenght() { ErrorText = ""; if (FilteredAppointements.Count == 0) { ErrorText = "There are no appointements with selected filters."; } NextPageCommand.RaiseCanExecuteChanged(); }
public PaginationViewModel() { CurrentPageIndex = 0; NextCommand = new NextPageCommand(this); PreviousCommand = new PreviousPageCommand(this); FirstCommand = new FirstPageCommand(this); LastCommand = new LastPageCommand(this); }
public virtual bool Equals(NextPageCommand 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; }
private void OnPatientEmailChanged() { ErrorText = ""; AllFlag = false; var o = _patientController.GetPatientByEmail(PatientEmailText); if (o is null) { ErrorText = "Patient with that email doesn't exist."; } AddAppointements(); FilteredAppointements = new ObservableCollection <Appointement>(from a in FilteredAppointements where a.Patient.Email.Value == PatientEmailText select a); AllFlag = true; NextPageCommand.RaiseCanExecuteChanged(); }
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(); } }
public GameScreenSelectViewModel(List <Rectangle> rectList, SelectGameWindowAction dg) { this.rectList = rectList; this.dg = dg; // プロパティを設定 PageInfoStr = RectIndex.Select(x => $"[{x + 1}/{rectList.Count}] {Utility.GetRectStr(rectList[x])}").ToReadOnlyReactiveProperty(); GameWindowPage = RectIndex.Select(x => (BitmapSource)ScreenShotProvider.GetScreenBitmap(rectList[x]).ToImageSource()).ToReadOnlyReactiveProperty(); // コマンドを設定 PrevPageCommand.Subscribe(_ => { RectIndex.Value = (rectList.Count + RectIndex.Value - 1) % rectList.Count; }); NextPageCommand.Subscribe(_ => { RectIndex.Value = (rectList.Count + RectIndex.Value + 1) % rectList.Count; }); SelectPageCommand.Subscribe(_ => { dg(rectList[RectIndex.Value]); CloseWindow.Value = true; }); CancelCommand.Subscribe(_ => { dg(null); CloseWindow.Value = true; }); }
private void OnPropertyChanged(object sender, PropertyChangedEventArgs e) { NextPageCommand.RaiseCanExecuteChanged(); PrevPageCommand.RaiseCanExecuteChanged(); ButtonNext.Visibility = NextPageCommand.CanExecute(null) ? Visibility.Visible : Visibility.Hidden; ButtonPrev.Visibility = PrevPageCommand.CanExecute(null) ? Visibility.Visible : Visibility.Hidden; LabelPage.Content = PageCount == 1 ? null : $"{Page + 1}/{PageCount}"; if (ItemsSource == null) { return; } var pageSize = PageSize; PagedItemSource = new ObservableCollection <object>( ItemsSource.OfType <object>().Skip(Page * pageSize).Take(pageSize).ToList()); if (e.PropertyName == nameof(ItemsSource)) { Page = 0; } }
private void TilePropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { NextPageCommand?.OnCanExecuteChanged(); FinishCommand?.OnCanExecuteChanged(); }
private void DoctorChangedHandler() { FilterAppointementsByDoctor(); AllFlag = true; NextPageCommand.RaiseCanExecuteChanged(); }