private void Next_Click(object sender, RoutedEventArgs e) { if (CurrentPage < TotalPages) { CurrentPage += 1; OnPageChange?.Invoke(sender, CurrentPage); } }
private void Prev_Click(object sender, RoutedEventArgs e) { if (CurrentPage > 1) { CurrentPage -= 1; OnPageChange?.Invoke(sender, CurrentPage); } }
public void PageChange(string tabName) { if (OnPageChange != null) { OnPageChange.Invoke(this, new ATSCorePageChangeEventArgs { Page = tabName }); } }
private void InitListPager(ListPager listPagerViewModel) { OnPeopleCountChange += (sender, numberOfPeople) => listPagerViewModel.SetNumberOfRows(numberOfPeople); listPagerViewModel.OnPageChange += (sender, page) => OnPageChange?.Invoke(this, page); listPagerViewModel.OnPageSizeChange += (sender, pageSize) => OnPageSizeChange?.Invoke(this, pageSize); listPagerViewModel.SetNumberOfRows(PersonCount); listPagerViewModel.SetPageSize(_pageSize); listPagerViewModel.SetCurrentPage(1); }
private void UIElement_OnKeyUp(object sender, KeyRoutedEventArgs e) { if (e.Key == VirtualKey.Enter) { if (sender as TextBox == null) { return; } string newValue = new string((sender as TextBox).Text.Where(char.IsDigit).ToArray()); (sender as TextBox).Text = string.IsNullOrWhiteSpace(newValue) ? "1" : newValue; int newPage = string.IsNullOrWhiteSpace(newValue) ? 1 : Convert.ToInt32(newValue); CurrentPage = newPage >= 1 && newPage <= TotalPages ? newPage : 1; OnPageChange?.Invoke(sender, CurrentPage); } }
private void InitPaging() { var viewPortHeight = viewPortRect.rect.height; // How many prefab should be placed on one page. pageSize = (int)(viewPortHeight / spacedItemHeight); // How many page is needed, counting the last fractional page as a whole. pageCount = Mathf.CeilToInt(Items.Count / (float)pageSize); // Set the content height, treating the last page as a whole page. var contentHeight = pageCount * pageSize * spacedItemHeight; contentRect.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, contentHeight); _currentPage = 0; OnPageChange?.Invoke(_currentPage, pageCount); }
private void _OnVisibilityChanged(IElement element, bool isVisible) { var index = Children.IndexOf(element); OnPageChange?.Invoke(element, isVisible, index); }
public void SetPage(int page) { Page = page; OnPageChange?.Invoke(); }
public static event Action <int> OnPageChange; // evenement pas encore vu en classe public static void triggerPageChange(int i) { OnPageChange?.Invoke(i); }