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();
            }
        }
예제 #2
0
 /// <summary>
 /// 更新按钮状态
 /// </summary>
 private void upButtonStatus()
 {
     FirstPageCommand.RaiseCanExecuteChanged();
     PreviousPageCommand.RaiseCanExecuteChanged();
     NextPageCommand.RaiseCanExecuteChanged();
     LastPageCommand.RaiseCanExecuteChanged();
 }
 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();
 }
        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();
        }
예제 #7
0
        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 DoctorChangedHandler()
 {
     FilterAppointementsByDoctor();
     AllFlag = true;
     NextPageCommand.RaiseCanExecuteChanged();
 }