private void TxtNroPagina_BeforeNewSelection(object sender, GoToPageEventArgs e) { if (e.pageNr == 0 || e.pageNr > pagesCount || e.pageNr == currentPageNr) { e.success = false; return; } long click = 0; click = DateTime.Now.Ticks; bool successfulClearSelection = true; if (!successfulClearSelection) { return; } currentPageNr = e.pageNr; // repopulate the listView LoadListData(); Debug.WriteLine("<<Go to page>> total " + new TimeSpan(DateTime.Now.Ticks - click).ToString()); }
protected override void numBoxKeyPressed(object sender, KeyPressEventArgs e) { if (e.KeyChar == (char)13) { if (this.numericBox.Text.Length > 0) { GoToPageEventArgs args1 = new GoToPageEventArgs(System.Convert.ToInt32(this.numericBox.Text), true); this.OnGoToPage(args1); if (args1.success) { this.lastText = this.numericBox.Text; } else { this.numericBox.Text = this.lastText; } } else { this.numericBox.Text = this.lastText; } this.OnPropagateEnterPressed(sender, new EventArgs()); } }
protected virtual void OnGoToPage(GoToPageEventArgs e) { if (this.GoToPage != null) { GoToPage(this, e); } }
private void TxtNroPagina_BeforeNewSelection(object sender, GoToPageEventArgs e) { if (e.pageNr == 0 || e.pageNr > pagesCount || e.pageNr == currentPageNr) { e.success = false; return; } long click = 0; click = DateTime.Now.Ticks; bool successfulClearSelection = true; // esta operação tem como objectivo permitir que haja a possibilidade de cancelar a mudança de página if (lstVwPaginated.SelectedItems.Count > 0) { successfulClearSelection = lstVwPaginated.clearItemSelection(lstVwPaginated.SelectedItems[0]); } if (!successfulClearSelection) { return; } currentPageNr = e.pageNr; // repopulate the listView lstVwPaginated.Items.Clear(); LoadListData(); if (lstVwPaginated.Items.Count == 1) { lstVwPaginated.selectItem(lstVwPaginated.Items[0]); } else if (lstVwPaginated.Items.Count > 0) { lstVwPaginated.selectItem(null); } Debug.WriteLine("<<Go to page>> total " + new TimeSpan(DateTime.Now.Ticks - click).ToString()); }