/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; // Suitable nullity checks etc, of course :) hashCode = hashCode * 59 + CurrentPage.GetHashCode(); hashCode = hashCode * 59 + PageSize.GetHashCode(); hashCode = hashCode * 59 + TotalCount.GetHashCode(); hashCode = hashCode * 59 + TotalPages.GetHashCode(); if (PreviousPageInputParameters != null) { hashCode = hashCode * 59 + PreviousPageInputParameters.GetHashCode(); } if (NextPageInputParameters != null) { hashCode = hashCode * 59 + NextPageInputParameters.GetHashCode(); } return(hashCode); } }
/// <summary> /// 获取新的词列表 /// </summary> public void FetchNewWords() { // 获取URL MainForm.UrlManager.GetUrls(); //准备初始数据 TotalPages = MainForm.UrlManager.Urls.Count; GetedPage = 0; FailedPage = 0; GetedUrls = new List <string>(); FailedUrls = new List <string>(); //StartCrawlerTime = DateTime.Now; //准备显示进度条 if (ProgressBar == null) { ProgressBar = new ProgressBarForm(); ProgressBar.SetMaxProgress(TotalPages); ProgressBar.lableTotalPage.Text = TotalPages.ToString(); } else { ProgressBar.SetMaxProgress(TotalPages); ProgressBar.lableTotalPage.Text = TotalPages.ToString(); ProgressBar.ResetProgress(); } //多线程抓取并分词 for (int i = 0; i < ThreadNum; i++) { ThreadStart startCrawlePage = new ThreadStart(StartCrawlePage); Thread crawlePage = new Thread(startCrawlePage); crawlePage.Start(); } ProgressBar.ShowDialog(MainForm);//线程创建结束后才能将进度条显示,否则进程被阻在此处 }
public override int GetHashCode() { int hash = 1; if (Page != 0L) { hash ^= Page.GetHashCode(); } if (Size != 0L) { hash ^= Size.GetHashCode(); } if (TotalPages != 0L) { hash ^= TotalPages.GetHashCode(); } if (TotalItems != 0L) { hash ^= TotalItems.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
/// <summary> /// Returns true if PaginatedListIEnumerableStandardsApplicableReviews instances are equal /// </summary> /// <param name="other">Instance of PaginatedListIEnumerableStandardsApplicableReviews to be compared</param> /// <returns>Boolean</returns> public bool Equals(PaginatedListIEnumerableStandardsApplicableReviews other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( PageIndex == other.PageIndex || PageIndex != null && PageIndex.Equals(other.PageIndex) ) && ( TotalPages == other.TotalPages || TotalPages != null && TotalPages.Equals(other.TotalPages) ) && ( PageSize == other.PageSize || PageSize != null && PageSize.Equals(other.PageSize) ) && ( Items == other.Items || Items != null && Items.SequenceEqual(other.Items) )); }
/// <summary> /// Initialization of the section /// </summary> /// <param name="rp"></param> public Section(BaseReport rp) : base(rp) { FPageGroupCountList = new TotalPages(); FStream = new MemoryStream(); #if REPMAN_ZLIB FDecompStream = new MemoryStream(); #endif Height = DEF_DRAWWIDTH; Width = Height; Components = new PrintPosItems(); ExternalTable = "REPMAN_REPORTS"; ExternalField = "REPORT"; ExternalSearchField = "REPORT_NAME"; ForcePrint = false; dpires = DEFAULT_DPI_BACK; DrawStyle = ImageDrawStyleType.Full; StreamFormat = StreamFormatType.Text; Width = DEF_DRAWWIDTH; Height = DEF_DRAWHEIGHT; ChildSubReportName = ""; SubReportName = ""; GroupName = ""; ChangeExpression = ""; BeginPageExpression = ""; SkipToPageExpre = ""; SkipExpreH = ""; SkipExpreV = ""; BackExpression = ""; ExternalFilename = ""; ExternalConnection = ""; ExternalTable = ""; ExternalField = ""; ExternalSearchField = ""; ExternalSearchValue = ""; }
/// <summary> /// 获取新的词列表 /// </summary> public void FetchNewWords() { // 获取URL MainForm.UrlManager.GetUrls(); _totalPages = MainForm.UrlManager.Urls.Count; _getedPage = 0; StartCrawlerTime = DateTime.Now; //准备显示进度条 if (progressBar == null) { progressBar = new ProgressBarForm(); progressBar.SetMaxProgress(_totalPages); progressBar.LableTotalPage.Text = TotalPages.ToString(); } else { progressBar.SetMaxProgress(_totalPages); progressBar.LableTotalPage.Text = TotalPages.ToString(); progressBar.ResetProgress(); } //多线程抓取并分词 for (int i = 0; i < _threadNum; i++) { ThreadStart startCrawlePage = new ThreadStart(StartCrawlePage); Thread crawlePage = new Thread(startCrawlePage); crawlePage.Start(); } progressBar.ShowDialog(MainForm);//线程创建结束后才能将进度条显示,否则进程被阻在此处 }
public void RefreshPages() { // Remove any old TransUIElems from the previous page for (int i = 0; i < transUIElems.Length; i += 1) { if (transUIElems[i] != null) { transUIElems[i].Destroy(); transUIElems[i] = null; } } // Update page number if (transSelected >= 0) { page = Mathf.FloorToInt(transSelected / transUIElems.Length); } pageLabel.text = "Page " + (page + 1).ToString() + "/" + TotalPages.ToString(); // Add TransUIElems for this page int added = 0; int pageItemStart = page * transUIElems.Length; for (int i = pageItemStart; i < Mathf.Min(pageItemStart + transUIElems.Length, transList.Count); i += 1) { transUIElems[added] = new TransformationItem(this, transList[i], new Vector2(pos.x, pos.y + HEIGHT * 0.5f - LINES_START - LINE_HEIGHT * (added * 4))); VoezEditor.Editor.AddObject(transUIElems[added]); added += 1; } }
/// <summary> /// Returns true if PaginatedListTechnicalContacts instances are equal /// </summary> /// <param name="other">Instance of PaginatedListTechnicalContacts to be compared</param> /// <returns>Boolean</returns> public bool Equals(PaginatedListTechnicalContacts other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( PageIndex == other.PageIndex || PageIndex != null && PageIndex.Equals(other.PageIndex) ) && ( TotalPages == other.TotalPages || TotalPages != null && TotalPages.Equals(other.TotalPages) ) && ( PageSize == other.PageSize || PageSize != null && PageSize.Equals(other.PageSize) ) && ( Items == other.Items || Items != null && Items.SequenceEqual(other.Items) )); }
/// <summary> /// Returns true if PaginatedListIEnumerableCapabilitiesImplementedEvidence instances are equal /// </summary> /// <param name="other">Instance of PaginatedListIEnumerableCapabilitiesImplementedEvidence to be compared</param> /// <returns>Boolean</returns> public bool Equals(PaginatedListIEnumerableCapabilitiesImplementedEvidence other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( PageIndex == other.PageIndex || PageIndex != null && PageIndex.Equals(other.PageIndex) ) && ( TotalPages == other.TotalPages || TotalPages != null && TotalPages.Equals(other.TotalPages) ) && ( PageSize == other.PageSize || PageSize != null && PageSize.Equals(other.PageSize) ) && ( Items == other.Items || Items != null && Items.SequenceEqual(other.Items) )); }
/// <summary> /// 用作特定类型的哈希函数。 /// </summary> /// <returns>当前Object的哈希代码。</returns> /// <remarks> /// 有关此函数的更多信息,请参见:http://msdn.microsoft.com/zh-cn/library/system.object.gethashcode。 /// </remarks> public override int GetHashCode() { return(TotalPages.GetHashCode() ^ TotalRecords.GetHashCode() ^ PageNumber.GetHashCode() ^ PageSize.GetHashCode()); }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; // Suitable nullity checks etc, of course :) if (PageIndex != null) { hashCode = hashCode * 59 + PageIndex.GetHashCode(); } if (TotalPages != null) { hashCode = hashCode * 59 + TotalPages.GetHashCode(); } if (PageSize != null) { hashCode = hashCode * 59 + PageSize.GetHashCode(); } if (Items != null) { hashCode = hashCode * 59 + Items.GetHashCode(); } return(hashCode); } }
/// <summary> /// 1. 根據最新嘅 RowsPerPage 同埋 TotalRows,重新整理 CurrentPage, txtCurrentPage, lblTotalPages /// </summary> public override void Update() { #region 根據依家嘅 RowsPerPage 同埋 TotalRows,重新整理 CurrentPage, txtCurrentPage, lblTotalPages CurrentPage = 1; TotalPages = CalcTotalPages(); txtCurrentPage.Text = CurrentPage.ToString(); lblTotalPages.Text = string.Format("/{0}", TotalPages.ToString()); #endregion }
public override string ToString() { return("PageNumber: " + PageNumber.ToString() + "\n" + "PageSize: " + PageSize.ToString() + "\n" + "TotalPages: " + TotalPages.ToString() + "\n" + "TotalRecords: " + TotalRecords.ToString() + "\n" + "NextPage: " + NextPage.ToString() + "\n" + "PreviousPage: " + PreviousPage.ToString() + "\n" + "Data: " + Data + "\n" + "Succeeded: " + Succeeded.ToString() + "\n" + "Errors: " + Errors.ToString() + "\n"); }
/// <summary> /// Builds the "last page" anchor tag [»»] /// </summary> /// <param name="output">Appends html to the parent TagHelperOutput object</param> void BuildLastPageLink(TagHelperOutput output) { if (TotalPages > 1 && Page < TotalPages) { RouteValues["page"] = TotalPages.ToString(); string url = ConstructPageLinkUrl(RouteValues); output.Content.AppendHtml($@"<li class=""page-item""><a class=""page-link"" aria-label=""{LastPageAriaLabel}"" href=""{url}""{AjaxHtmlAttributes}>{LastPageLinkText}</a></li>"); } else { output.Content.AppendHtml($@"<li class=""page-item disabled"" tabindex=""-1""><a class=""page-link"" aria-label=""{LastPageAriaLabel}"">{LastPageLinkText}</a></li>"); } }
protected override void Render(HtmlTextWriter writer) { Control skin = (Control)this.Parent; Panel displayPager = (Panel)skin.FindControl("DisplayPager"); if (displayPager != null) { displayPager.Visible = true; } this.Text = String.Format(text, PageIndex, TotalPages.ToString("n0"), TotalRecords.ToString("n0")); base.Render(writer); }
/// <summary> /// Updates the status of child controls. /// </summary> /// <param name="e">Event Arguments.</param> protected override void OnPreRender(EventArgs e) { //Update controls status. PageIndexTextBox.Text = (PageIndex + 1).ToString(CultureInfo.CurrentCulture); PageCountLabel.Text = TotalPages.ToString(CultureInfo.CurrentCulture); NextButton.Enabled = LastButton.Enabled = PageIndex >= (TotalPages - 1) ? false : true; FirstButton.Enabled = PreviousButton.Enabled = PageIndex <= 0 ? false : true; //register javascript function. PageIndexTextBox.Attributes.Add(_OnKeyPressEvent, string.Format(CultureInfo.InvariantCulture, _handleKeyPressEvent, PageIndexTextBox.ClientID, 1, TotalPages)); base.OnPreRender(e); }
public void Process(Config config, Model.Package package, string convertedFolderPath) { int startPageNumber = 1; foreach (Section section in package.Sections.OrderBy(s => s.Order)) { if (package.Pagination == Pagination.BySection) { startPageNumber = 1; } foreach (Item item in section.Items.OrderBy(i => i.Order)) { if (item.ItemType == ItemType.AuxiliaryDocument) { if (item.AuxiliaryDocument.ConvertedFile != null) { item.AuxiliaryDocument.PageCount = TotalPages.GetCount(convertedFolderPath + item.AuxiliaryDocument.ConvertedFile); } if (item.AuxiliaryDocument.PageCount <= 0) { continue; } item.StartPageNumber = startPageNumber; item.EndPageNumber = startPageNumber + item.AuxiliaryDocument.PageCount - 1; startPageNumber = item.EndPageNumber + 1; } else { item.ReportFilter.PageCount = TotalPages.GetCount(config.ReportOutputPath + item.ReportFilter.ReportPath); if (item.ReportFilter.PageCount <= 0) { item.ReportFilter.ReportPageNumberXml = null; continue; } item.StartPageNumber = startPageNumber; item.EndPageNumber = startPageNumber + item.ReportFilter.PageCount - 1; startPageNumber = item.EndPageNumber + 1; item.ReportFilter.ReportPageNumbers = GetReportPageNumbersCollection(item.ReportFilter.ReportPageNumberXml); } } } }
public override void Process(TagHelperContext context, TagHelperOutput output) { TotalPages = TotalPages < 1000 ? TotalPages : 1000; output.TagName = "div"; output.Attributes.Add("class", "nav-links"); TagBuilder dots = new TagBuilder("span"); dots.Attributes.Add("class", "page-numbers dots"); dots.InnerHtml.Append("..."); TagBuilder actualIndex; var actualPage = int.Parse(ViewContext.RouteData.Values["page"].ToString()); actualIndex = new TagBuilder("a"); actualIndex.Attributes.Add("class", "page-numbers"); actualIndex.InnerHtml.SetContent("1"); output.Content.AppendHtml(actualIndex); for (int i = 0; i <= 4; i++) { if (i.Equals(0) && actualPage > 4) { output.Content.AppendHtml(dots); } if (((actualPage - 2) + i) >= 2 && ((actualPage - 2) + i) < TotalPages) { actualIndex = new TagBuilder("a"); actualIndex.Attributes.Add("class", "page-numbers"); actualIndex.InnerHtml.SetContent(((actualPage - 2) + i).ToString()); output.Content.AppendHtml(actualIndex); } if (i.Equals(4) && actualPage < TotalPages - 3) { output.Content.AppendHtml(dots); } } actualIndex = new TagBuilder("a"); actualIndex.Attributes.Add("class", "page-numbers"); actualIndex.InnerHtml.SetContent(TotalPages.ToString()); output.Content.AppendHtml(actualIndex); }
public void WriteSourceFileInfo(Data data, string section) { data.SetValue(section + "DocumentTitle", DocumentTitle); data.SetValue(section + "WinStation", WinStation); data.SetValue(section + "Username", Author); data.SetValue(section + "ClientComputer", ClientComputer); data.SetValue(section + "SpoolFileName", Filename); data.SetValue(section + "PrinterName", PrinterName); data.SetValue(section + "SessionId", SessionId.ToString(CultureInfo.InvariantCulture)); data.SetValue(section + "JobCounter", JobCounter.ToString(CultureInfo.InvariantCulture)); data.SetValue(section + "JobId", JobId.ToString(CultureInfo.InvariantCulture)); var type = Type == JobType.XpsJob ? "xps" : "ps"; data.SetValue(section + "SourceFileType", type); data.SetValue(section + "Copies", Copies.ToString(CultureInfo.InvariantCulture)); data.SetValue(section + "TotalPages", TotalPages.ToString(CultureInfo.InvariantCulture)); }
/// <summary> /// Returns true if XPaginationHeader instances are equal /// </summary> /// <param name="other">Instance of XPaginationHeader to be compared</param> /// <returns>Boolean</returns> public bool Equals(XPaginationHeader other) { if (other is null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( CurrentPage == other.CurrentPage || CurrentPage.Equals(other.CurrentPage) ) && ( PageSize == other.PageSize || PageSize.Equals(other.PageSize) ) && ( TotalCount == other.TotalCount || TotalCount.Equals(other.TotalCount) ) && ( TotalPages == other.TotalPages || TotalPages.Equals(other.TotalPages) ) && ( PreviousPageInputParameters == other.PreviousPageInputParameters || PreviousPageInputParameters != null && PreviousPageInputParameters.Equals(other.PreviousPageInputParameters) ) && ( NextPageInputParameters == other.NextPageInputParameters || NextPageInputParameters != null && NextPageInputParameters.Equals(other.NextPageInputParameters) )); }
private void Initialize(int totalCount, int pageIndex, int pageSize, string pageNoParamName, string disabledClass) { PageNo = pageIndex + 1; TotalPages = (int)Math.Ceiling(totalCount / (double)pageSize); FirstPageRouteValues = new Dictionary <string, string> { { pageNoParamName, "1" } }; LastPageRouteValues = new Dictionary <string, string> { { pageNoParamName, TotalPages.ToStringInvariant() } }; NextPageRouteValues = new Dictionary <string, string> { { pageNoParamName, (HasNextPage ? PageNo + 1 : TotalPages).ToStringInvariant() } }; PrevPageRouteValues = new Dictionary <string, string> { { pageNoParamName, (HasPreviousPage ? PageNo - 1 : 1).ToStringInvariant() } }; NextPageDisabledClass = HasNextPage ? "" : disabledClass; PrevPageDisabledClass = HasPreviousPage ? "" : disabledClass; }
// Statistiktabben börjar /// <summary> /// Skickar med de parametrar som användaren vill använda för att söka efter till metoden för querin till databasen. /// Retunerar informationen som matchar sökpreferensen /// </summary> private void SendSearchInfo() { try { //CollectionViewSource itemCollectionViewSource = (CollectionViewSource)(FindResource("ItemCollectionViewSource")); VisitorSearch = InputVariables(); VisitorSearchReturn = GetVisitorSearchInfo(VisitorSearch, Offset, HitsPerPage);//returnerar ETT objekt int countTotalHits = VisitorSearchReturn.CountTotalHits; ReturnTotalPages(countTotalHits); lblTotalPages = TotalPages.ToString(); lblTotalVisitors = countTotalHits.ToString(); //itemCollectionViewSource.Source = VisitorSearchReturn.VisitorSearches;//printar listan i objektet. Visitor, Employee och BookedMeeting } catch (Exception ex) { MessageBox.Show(ex.Message); //throw; } }
//选择每页显示条数 private void cbxRowCount_SelectedIndexChanged(object sender, EventArgs e) { if (BindingDataTable == null || ShowingDataTable == null) { return; } if (cbxRowCount.Text.Trim() == "全部显示") { RowsCount = BindingDataTable.Rows.Count; CurrentPage = 1; TotalPages = 1; } else { RowsCount = Convert.ToInt32(cbxRowCount.Text); CurrentPage = 1; TotalPages = (int)Math.Ceiling((double)BindingDataTable.Rows.Count / RowsCount); } ShowingDataTable.Rows.Clear(); SetShowingDataTable(); tbxCurrentPage.Text = CurrentPage.ToString(); lbTotalPages.Text = TotalPages.ToString(); }
public MvcHtmlString PagerMenu(HtmlHelper hhelper, RouteValueDictionary add = null) { if (AccessHelper.IsMasterPage) { var content = ""; content = string.Concat(new object[] { content, "<input type=\"hidden\" value=\"", PageIndex, "\" id=\"page\"/>" }); if (TotalPages > 1) { content = content + "<div class=\"pager\">Страницы: "; if (add != null) { foreach (var pair in add) { if (DefaultRoutes.ContainsKey(pair.Key)) { DefaultRoutes[pair.Key] = pair.Value; } else { DefaultRoutes.Add(pair.Key, pair.Value); } } } if (!DefaultRoutes.ContainsKey("page")) { DefaultRoutes.Add("page", 0); } if (HasPreviousPage) { DefaultRoutes["page"] = PageIndex - 1; content = AddLink("<<", PageIndex - 1, content, hhelper); /* * (hhelper.RouteLink("<<", MapRuleName, DefaultRoutes, * (AjaxPager * ? ((object) * new * { * onclick = * "return {0}({1})".FormatWith(PageJSFunction, * (PageIndex - 1). * ToString()) * }) * : ((object)new { })).ToDictionary())) + " "; */ } string links = ""; bool begin = false; bool end = false; string fmtInactive = "<span>{0}</span> "; /* * List<int> allowed = new List<int>(); * if (TotalPages < 15) * for (int i = 0; i < 15; i++) * allowed.Add(i); * else * { */ int PageWidth = 5; for (int i = 0; TotalPages > i; i++) { int offset = 0; if (PageIndex < (PageWidth - 1)) { offset = PageWidth - PageIndex - 1; } if ((i > (PageIndex - PageWidth)) && (i < (PageIndex + PageWidth + offset))) { if (PageIndex == i) { links = links + string.Format(fmtInactive, i + 1); } else { string linkText = (i + 1).ToString(); if ((i - 1) == (PageIndex - PageWidth)) { if (i > 0) { begin = true; linkText = "..."; } } if ((i + 1) == (PageIndex + PageWidth + offset)) { if ((i + 1) != TotalPages) { end = true; linkText = "..."; } } DefaultRoutes["page"] = i; links = AddLink(linkText, i, links, hhelper); } } } if (begin) { links = AddLink("1", 0, links, hhelper, false); } if (end) { links = AddLink(TotalPages.ToString(), TotalPages - 1, links, hhelper); } content = content + links; if (HasNextPage) { content = AddLink(">>", PageIndex + 1, content, hhelper); } content = content + "</div>"; } return(new MvcHtmlString(content)); } else { string prevSpan = "<span><i class=\"icon_c_mark-lb\"></i> Назад</span>"; string nextSpan = "<span>Вперед <i class=\"icon_c_mark-rb\"></i></span>"; string prevLink = "<a href=\"{0}\"><i class=\"icon_c_mark-lb\"></i> Назад</a>"; string nextLink = "<a href=\"{0}\"> Вперед <i class=\"icon_c_mark-rb\"></i></a>"; string indexSpan = "<span class=\"selected\">{0}</span>"; string indexLink = "<a href=\"{0}\">{1}</a>"; string ctx = "<div class=\"el_paginate\"><div class=\"num_line bradius_20 gradient_white-gray\">{0}</div><div class=\"signature\">Страница: {1} из {2}</div></div>"; string sLinks = ""; if (TotalPages > 1) { if (!DefaultRoutes.ContainsKey("page")) { DefaultRoutes.Add("page", 0); } bool begin = false; bool end = false; int PageWidth = 5; for (int i = 0; TotalPages > i; i++) { int offset = 0; if (PageIndex < (PageWidth - 1)) { offset = PageWidth - PageIndex - 1; } if ((i > (PageIndex - PageWidth)) && (i < (PageIndex + PageWidth + offset))) { if (PageIndex == i) { sLinks += string.Format(indexSpan, i + 1); } else { string linkText = (i + 1).ToString(); if ((i - 1) == (PageIndex - PageWidth)) { if (i > 0) { begin = true; linkText = "..."; } } if ((i + 1) == (PageIndex + PageWidth + offset)) { if ((i + 1) != TotalPages) { end = true; linkText = "..."; } } DefaultRoutes["page"] = i; sLinks += indexLink.FormatWith(CreateLink(i), linkText); } } } if (begin) { sLinks = indexLink.FormatWith(CreateLink(0), "1") + sLinks; } if (end) { sLinks += indexLink.FormatWith(CreateLink(TotalPages - 1), TotalPages.ToString()); } if (HasPreviousPage) { DefaultRoutes["page"] = PageIndex - 1; sLinks = prevLink.FormatWith(CreateLink(PageIndex - 1)) + sLinks; } else { sLinks = prevSpan + sLinks; } if (HasNextPage) { DefaultRoutes["page"] = PageIndex + 1; sLinks += nextLink.FormatWith(CreateLink(PageIndex + 1)); } else { sLinks += nextSpan; } return(new MvcHtmlString(ctx.FormatWith(sLinks, PageIndex + 1, TotalPages))); } return(new MvcHtmlString("")); } }
public Schema() : base() { InstanceType = typeof(__Paginati__); ClassName = "PaginationPage"; Properties.ClearExposed(); Html = Add <__TString__>("Html"); Html.DefaultValue = "/KitchenSink/PaginationPage.html"; Html.SetCustomAccessors((_p_) => { return(((__Paginati__)_p_).__bf__Html__); }, (_p_, _v_) => { ((__Paginati__)_p_).__bf__Html__ = (System.String)_v_; }, false); ChangePage = Add <__TLong__>("ChangePage$"); ChangePage.DefaultValue = 0L; ChangePage.Editable = true; ChangePage.SetCustomAccessors((_p_) => { return(((__Paginati__)_p_).__bf__ChangePage__); }, (_p_, _v_) => { ((__Paginati__)_p_).__bf__ChangePage__ = (System.Int64)_v_; }, false); ChangePage.AddHandler((Json pup, Property <Int64> prop, Int64 value) => { return(new Input.ChangePage() { App = (PaginationPage)pup, Template = (TLong)prop, Value = value }); }, (Json pup, Starcounter.Input <Int64> input) => { ((PaginationPage)pup).Handle((Input.ChangePage)input); }); NextPage = Add <__TLong__>("NextPage$"); NextPage.DefaultValue = 0L; NextPage.Editable = true; NextPage.SetCustomAccessors((_p_) => { return(((__Paginati__)_p_).__bf__NextPage__); }, (_p_, _v_) => { ((__Paginati__)_p_).__bf__NextPage__ = (System.Int64)_v_; }, false); NextPage.AddHandler((Json pup, Property <Int64> prop, Int64 value) => { return(new Input.NextPage() { App = (PaginationPage)pup, Template = (TLong)prop, Value = value }); }, (Json pup, Starcounter.Input <Int64> input) => { ((PaginationPage)pup).Handle((Input.NextPage)input); }); PreviousPage = Add <__TLong__>("PreviousPage$"); PreviousPage.DefaultValue = 0L; PreviousPage.Editable = true; PreviousPage.SetCustomAccessors((_p_) => { return(((__Paginati__)_p_).__bf__PreviousPage__); }, (_p_, _v_) => { ((__Paginati__)_p_).__bf__PreviousPage__ = (System.Int64)_v_; }, false); PreviousPage.AddHandler((Json pup, Property <Int64> prop, Int64 value) => { return(new Input.PreviousPage() { App = (PaginationPage)pup, Template = (TLong)prop, Value = value }); }, (Json pup, Starcounter.Input <Int64> input) => { ((PaginationPage)pup).Handle((Input.PreviousPage)input); }); LastPage = Add <__TLong__>("LastPage$"); LastPage.DefaultValue = 0L; LastPage.Editable = true; LastPage.SetCustomAccessors((_p_) => { return(((__Paginati__)_p_).__bf__LastPage__); }, (_p_, _v_) => { ((__Paginati__)_p_).__bf__LastPage__ = (System.Int64)_v_; }, false); LastPage.AddHandler((Json pup, Property <Int64> prop, Int64 value) => { return(new Input.LastPage() { App = (PaginationPage)pup, Template = (TLong)prop, Value = value }); }, (Json pup, Starcounter.Input <Int64> input) => { ((PaginationPage)pup).Handle((Input.LastPage)input); }); FirstPage = Add <__TLong__>("FirstPage$"); FirstPage.DefaultValue = 0L; FirstPage.Editable = true; FirstPage.SetCustomAccessors((_p_) => { return(((__Paginati__)_p_).__bf__FirstPage__); }, (_p_, _v_) => { ((__Paginati__)_p_).__bf__FirstPage__ = (System.Int64)_v_; }, false); FirstPage.AddHandler((Json pup, Property <Int64> prop, Int64 value) => { return(new Input.FirstPage() { App = (PaginationPage)pup, Template = (TLong)prop, Value = value }); }, (Json pup, Starcounter.Input <Int64> input) => { ((PaginationPage)pup).Handle((Input.FirstPage)input); }); Library = Add <__TArray__>("Library"); Library.SetCustomGetElementType((arr) => { return(__PaLibraryE__.DefaultTemplate); }); Library.SetCustomAccessors((_p_) => { return(((__Paginati__)_p_).__bf__Library__); }, (_p_, _v_) => { ((__Paginati__)_p_).__bf__Library__ = (__Arr__)_v_; }, false); EntriesPerPage = Add <__TLong__>("EntriesPerPage$"); EntriesPerPage.DefaultValue = 5L; EntriesPerPage.Editable = true; EntriesPerPage.SetCustomAccessors((_p_) => { return(((__Paginati__)_p_).__bf__EntriesPerPage__); }, (_p_, _v_) => { ((__Paginati__)_p_).__bf__EntriesPerPage__ = (System.Int64)_v_; }, false); EntriesPerPage.AddHandler((Json pup, Property <Int64> prop, Int64 value) => { return(new Input.EntriesPerPage() { App = (PaginationPage)pup, Template = (TLong)prop, Value = value }); }, (Json pup, Starcounter.Input <Int64> input) => { ((PaginationPage)pup).Handle((Input.EntriesPerPage)input); }); PageEntries = Add <__TArray1__>("PageEntries"); PageEntries.SetCustomGetElementType((arr) => { return(__PaPageEntr__.DefaultTemplate); }); PageEntries.SetCustomAccessors((_p_) => { return(((__Paginati__)_p_).__bf__PageEntries__); }, (_p_, _v_) => { ((__Paginati__)_p_).__bf__PageEntries__ = (__Arr1__)_v_; }, false); Pages = Add <__TArray2__>("Pages"); Pages.SetCustomGetElementType((arr) => { return(__PaPagesEle__.DefaultTemplate); }); Pages.SetCustomAccessors((_p_) => { return(((__Paginati__)_p_).__bf__Pages__); }, (_p_, _v_) => { ((__Paginati__)_p_).__bf__Pages__ = (__Arr2__)_v_; }, false); TotalEntries = Add <__TLong__>("TotalEntries"); TotalEntries.DefaultValue = 0L; TotalEntries.SetCustomAccessors((_p_) => { return(((__Paginati__)_p_).__bf__TotalEntries__); }, (_p_, _v_) => { ((__Paginati__)_p_).__bf__TotalEntries__ = (System.Int64)_v_; }, false); TotalPages = Add <__TLong__>("TotalPages"); TotalPages.DefaultValue = 0L; TotalPages.SetCustomAccessors((_p_) => { return(((__Paginati__)_p_).__bf__TotalPages__); }, (_p_, _v_) => { ((__Paginati__)_p_).__bf__TotalPages__ = (System.Int64)_v_; }, false); CurrentPage = Add <__TLong__>("CurrentPage"); CurrentPage.DefaultValue = 1L; CurrentPage.SetCustomAccessors((_p_) => { return(((__Paginati__)_p_).__bf__CurrentPage__); }, (_p_, _v_) => { ((__Paginati__)_p_).__bf__CurrentPage__ = (System.Int64)_v_; }, false); CurrentOffset = Add <__TLong__>("CurrentOffset"); CurrentOffset.DefaultValue = 0L; CurrentOffset.SetCustomAccessors((_p_) => { return(((__Paginati__)_p_).__bf__CurrentOffset__); }, (_p_, _v_) => { ((__Paginati__)_p_).__bf__CurrentOffset__ = (System.Int64)_v_; }, false); DisableFirst = Add <__TBool__>("DisableFirst"); DisableFirst.DefaultValue = true; DisableFirst.SetCustomAccessors((_p_) => { return(((__Paginati__)_p_).__bf__DisableFirst__); }, (_p_, _v_) => { ((__Paginati__)_p_).__bf__DisableFirst__ = (System.Boolean)_v_; }, false); DisableLast = Add <__TBool__>("DisableLast"); DisableLast.DefaultValue = false; DisableLast.SetCustomAccessors((_p_) => { return(((__Paginati__)_p_).__bf__DisableLast__); }, (_p_, _v_) => { ((__Paginati__)_p_).__bf__DisableLast__ = (System.Boolean)_v_; }, false); }
protected void CreateListPager() { UpdateInformation(); long startIndex = 0; long endIndex = TotalPages; if (TotalPages > PageBlock) { startIndex = CurrentPage - PageBlock / 2; endIndex = CurrentPage + PageBlock / 2; if (startIndex < 0) { startIndex = 0; endIndex = startIndex + PageBlock; } if (endIndex > TotalPages) { startIndex = TotalPages - PageBlock; endIndex = TotalPages; } } ListPagers.Add(new Pager { Title = "««", PageNum = "1", CurrentPage = false }); if (CurrentPage == 1) { listPagers.Add(new Pager { Title = "«", PageNum = CurrentPage.ToString(), CurrentPage = false }); } else { listPagers.Add(new Pager { Title = "«", PageNum = (CurrentPage - 1).ToString(), CurrentPage = false }); } for (long i = startIndex; i < endIndex; i++) { //long test = CurrentPage - 1; listPagers.Add(new Pager { Title = (i + 1).ToString(), PageNum = (i + 1).ToString(), CurrentPage = i == (CurrentPage - 1) }); } if (CurrentPage == TotalPages) { listPagers.Add(new Pager { Title = "»", PageNum = CurrentPage.ToString(), CurrentPage = false }); } else { listPagers.Add(new Pager { Title = "»", PageNum = (CurrentPage + 1).ToString(), CurrentPage = false }); } listPagers.Add(new Pager { Title = "»»", PageNum = TotalPages.ToString(), CurrentPage = false }); }
private void CheckVisualForSpecialRuns(FrameworkElement root) { var currentPages = new List <CurrentPage>(); var pageCounts = new List <PageCount>(); var text = root as TextBlock; if (text != null) { foreach (var run in text.Inlines) { var pageCount = run as PageCount; if (pageCount != null) { pageCounts.Add(pageCount); } var currentPage = run as CurrentPage; if (currentPage != null) { currentPages.Add(currentPage); } } foreach (var pageCount in pageCounts) { pageCount.Text = TotalPages.ToString(CultureInfo.InvariantCulture); } foreach (var currentPage in currentPages) { currentPage.Text = CurrentPage.ToString(CultureInfo.InvariantCulture); } return; } var items = root as ItemsControl; if (items != null) { foreach (var item in items.Items) { var childElement = item as FrameworkElement; if (childElement != null) { CheckVisualForSpecialRuns(childElement); } } } else { var panel = root as Panel; if (panel != null) { foreach (var item in panel.Children) { var childElement = item as FrameworkElement; if (childElement != null) { CheckVisualForSpecialRuns(childElement); } } } } }
/// <summary> /// overridden to handle custom pager rendering for runtime and design time /// </summary> /// <param name="writer"></param> protected override void Render(HtmlTextWriter writer) { base.Render(writer); if (TotalPages == 0 && TotalItems > 0) { TotalPages = CalculateTotalPagesFromTotalItems(); // calculate based on totalitems } if (DesignMode) { TotalPages = 10; } // don't render pager if there's only one page if (TotalPages < 2) { return; } if (RenderContainerDiv) { if (!string.IsNullOrEmpty(ContainerDivCssClass)) { writer.AddAttribute("class", ContainerDivCssClass); } writer.RenderBeginTag("div"); } // main pager wrapper writer.WriteBeginTag("div"); writer.AddAttribute("id", this.ClientID); if (!string.IsNullOrEmpty(CssClass)) { writer.WriteAttribute("class", this.CssClass); } //writer.Write(HtmlTextWriter.TagRightChar + "\r\n"); // Pages Text writer.WriteBeginTag("span"); if (!string.IsNullOrEmpty(PagesTextCssClass)) { writer.WriteAttribute("class", PagesTextCssClass); } writer.Write(HtmlTextWriter.TagRightChar); writer.Write(this.PagesText); writer.WriteEndTag("span"); // if the base url is empty use the current URL FixupBaseUrl(); // set _startPage and _endPage ConfigurePagesToRender(); // write out first page link if (ShowFirstAndLastPageLinks && _startPage != 1) { writer.WriteBeginTag("a"); string pageUrl = StringUtils.SetUrlEncodedKey(BaseUrl, QueryStringPageField, (1).ToString()); writer.WriteAttribute("href", pageUrl); if (!string.IsNullOrEmpty(PageLinkCssClass)) { writer.WriteAttribute("class", PageLinkCssClass + " " + PageLinkCssClass + "-first"); } writer.Write(HtmlTextWriter.SelfClosingTagEnd); writer.Write("1"); writer.WriteEndTag("a"); } // write out all the page links for (int i = _startPage; i < _endPage + 1; i++) { if (i == ActivePage) { writer.WriteBeginTag("span"); if (!string.IsNullOrEmpty(SelectedPageCssClass)) { writer.WriteAttribute("class", SelectedPageCssClass); } writer.Write(HtmlTextWriter.TagRightChar); writer.Write(i.ToString()); writer.WriteEndTag("span"); } else { writer.WriteBeginTag("a"); string pageUrl = StringUtils.SetUrlEncodedKey(BaseUrl, QueryStringPageField, i.ToString()).TrimEnd('&'); writer.WriteAttribute("href", pageUrl); if (!string.IsNullOrEmpty(PageLinkCssClass)) { writer.WriteAttribute("class", PageLinkCssClass); } writer.Write(HtmlTextWriter.TagRightChar); writer.Write(i.ToString()); writer.WriteEndTag("a"); } writer.Write("\r\n"); } // write out last page link if (ShowFirstAndLastPageLinks && _endPage < TotalPages) { writer.WriteBeginTag("a"); string pageUrl = StringUtils.SetUrlEncodedKey(BaseUrl, QueryStringPageField, TotalPages.ToString()); writer.WriteAttribute("href", pageUrl); if (!string.IsNullOrEmpty(PageLinkCssClass)) { writer.WriteAttribute("class", PageLinkCssClass + " " + PageLinkCssClass + "-last"); } writer.Write(HtmlTextWriter.TagRightChar); writer.Write(TotalPages.ToString()); writer.WriteEndTag("a"); writer.Write("\r\n"); } // Previous link if (ShowPreviousNextLinks && !string.IsNullOrEmpty(PreviousText) && ActivePage > 1) { writer.WriteBeginTag("a"); string pageUrl = StringUtils.SetUrlEncodedKey(BaseUrl, QueryStringPageField, (ActivePage - 1).ToString()); writer.WriteAttribute("href", pageUrl); if (!string.IsNullOrEmpty(PageLinkCssClass)) { writer.WriteAttribute("class", PageLinkCssClass + " " + PageLinkCssClass + "-prev"); } writer.Write(HtmlTextWriter.TagRightChar); writer.Write(PreviousText); writer.WriteEndTag("a"); writer.Write("\r\n"); } // Next link if (ShowPreviousNextLinks && !string.IsNullOrEmpty(NextText) && ActivePage < TotalPages) { writer.WriteBeginTag("a"); string pageUrl = StringUtils.SetUrlEncodedKey(BaseUrl, QueryStringPageField, (ActivePage + 1).ToString()); writer.WriteAttribute("href", pageUrl); if (!string.IsNullOrEmpty(PageLinkCssClass)) { writer.WriteAttribute("class", PageLinkCssClass + " " + PageLinkCssClass + "-next"); } writer.Write(HtmlTextWriter.TagRightChar); writer.Write(NextText); writer.WriteEndTag("a"); writer.Write("\r\n"); } writer.WriteEndTag("div"); if (RenderContainerDiv) { if (RenderContainerDivBreak) { writer.Write("<div style=\"clear:both\"></div>\r\n"); } writer.WriteEndTag("div"); writer.Write("\r\n"); } }
// ********************************************************************* // DisplayCurrentPage // /// <summary> /// Displays the current page that the user is viewing /// </summary> // ********************************************************************/ private void DisplayCurrentPage() { currentPage.Text = General.GetString("PAGE", "Page", null) + " " + (PageIndex + 1).ToString("n0") + " " + General.GetString("OF", "of", null) + " " + TotalPages.ToString("n0"); }
//------------------------------------------------------------------------------------------ // Function: GeneratePaginationLinks // Description: Generate html for pagination links //--------------------------------------------- private string GeneratePaginationLinks(string myUrlBase, string strOrderBy) { string strNavlinks = "<strong>Page:</strong> "; int iStartLinkPage = 0; int iEndLinkPage = 0; string strPageLink = null; if (myUrlBase.Contains("?")) { strPageLink = "&page="; } else { strPageLink = "/"; } if (PageIndex >= MaxPaginationLinks) { iStartLinkPage = (PageIndex - MaxPaginationLinks) + 1; if (iStartLinkPage < 1) { iStartLinkPage = 1; } } else { iStartLinkPage = 1; } if ((iStartLinkPage + MaxPaginationLinks) > (TotalPages)) { iEndLinkPage = TotalPages; } else { iEndLinkPage = iStartLinkPage + (MaxPaginationLinks - 1); } //----If the calculated start page for the numbered links is greater than 1, display a "first" link---------------- if (iStartLinkPage > 1) { strNavlinks = strNavlinks + "<a href=\"" + myUrlBase + strPageLink + "1" + strOrderBy + "\">First</a> "; } if (HasPreviousPage) { strNavlinks = strNavlinks + "<a href=\"" + myUrlBase + strPageLink + (PageIndex - 1).ToString() + strOrderBy + "\">Previous</a> "; } for (int iPageCount = iStartLinkPage; iPageCount <= iEndLinkPage; iPageCount++) { if (iPageCount == PageIndex) { strNavlinks = strNavlinks + "<b>" + iPageCount.ToString() + "</b> "; } else { strNavlinks = strNavlinks + "<a href=\"" + myUrlBase + strPageLink + iPageCount.ToString() + strOrderBy + "\">" + iPageCount.ToString() + "</a> "; } } if (HasNextPage) { strNavlinks = strNavlinks + "<a href=\"" + myUrlBase + strPageLink + (PageIndex + 1).ToString() + strOrderBy + "\">Next</a> "; } //----If the calculated end page for the numbered links is less than the total number of pages, then display a "Last" link---- if (iEndLinkPage < TotalPages) { strNavlinks = strNavlinks + " <a href=\"" + myUrlBase + strPageLink + TotalPages.ToString() + strOrderBy + "\">Last</a>"; } return(strNavlinks); }