private string RenderCurrent()
        {
            //string result = "<a class=\""
            //    + _CurrentPageCssClass + "\" href=\"{0}\" "
            //    + GetAlternativeText(CurrentIndex) + " >"
            //    + CurrentIndex.ToString() + "</a>&nbsp;";

            string result = "<span class=\"" + _CurrentPageCssClass + "\""
                            + GetAlternativeText(CurrentIndex)
                            + "><strong>" + CurrentIndex.ToString()
                            + "</strong></span>&nbsp;";

            if (_RenderAsTable)
            {
                result = "<td class=\"" + _CurrentPageCellCssClass + "\">"
                         + result
                         + "</td>";
            }

            if (_PageURLFormat.Length > 0)
            {
                string templateURL = String.Format(PageURLFormat, (CurrentIndex).ToString());
                return(String.Format(
                           result,
                           templateURL));
            }



            return(result);
        }
Beispiel #2
0
 private void QueryButton_Click(object sender, EventArgs e)
 {
     CurrentIndex = 1;
     FilterText   = textBox.Text;
     pageBox.Text = CurrentIndex.ToString();
     UpdateResourceList();
 }
Beispiel #3
0
        private void label_Click(object sender, EventArgs e)
        {
            Label button = sender as Label;

            if (button != null)
            {
                button.BackColor = Color.White;
            }
            if (button.Tag != null)
            {
                if (Enum.TryParse <ResourceType>(button.Tag.ToString(), out App.ResourceType))
                {
                    Globals.ThisAddIn.RightWidget.CurrentIndex = 1;
                    Globals.ThisAddIn.RightWidget.FilterText   = textBox.Text;
                    Globals.ThisAddIn.RightWidget.pageBox.Text = CurrentIndex.ToString();
                    Globals.ThisAddIn.RightWidget.updateRightLableText();
                    //Globals.ThisAddIn.RightWidget.ResetPageCount();
                    //Globals.ThisAddIn.RightWidget.UpdateResourceList();
                }
                else
                {
                    App.ResourceType = ResourceType.None;
                }
                //ResetButton();
            }
        }
 /// <summary>
 /// Prints the property status in the trace log.
 /// </summary>
 /// <remarks>For debugging purposes only.</remarks>
 private void PrintStatus()
 {
     DebugTrace("CurrentIndex=" + CurrentIndex.ToString());
     DebugTrace("PageSize=" + PageSize.ToString());
     DebugTrace("RecordCount=" + RecordCount.ToString());
     DebugTrace("CurrentGroup=" + CurrentGroup.ToString());
 }
Beispiel #5
0
        protected Size Draw(ViewInfo view, int x, int y, string type, HotSpotType exchange)
        {
            Contract.Requires(view != null);
            Contract.Requires(type != null);

            if (IsHidden)
            {
                return(DrawHidden(view, x, y));
            }

            DrawInvalidMemoryIndicator(view, y);

            var origX = x;
            var origY = y;

            AddSelection(view, x, y, view.Font.Height);

            x = AddOpenClose(view, x, y);
            x = AddIcon(view, x, y, Icons.Array, -1, HotSpotType.None);

            var tx = x;

            x = AddAddressOffset(view, x, y);

            x = AddText(view, x, y, view.Settings.TypeColor, HotSpot.NoneId, type) + view.Font.Width;
            x = AddText(view, x, y, view.Settings.NameColor, HotSpot.NameId, Name);
            x = AddText(view, x, y, view.Settings.IndexColor, HotSpot.NoneId, "[");
            x = AddText(view, x, y, view.Settings.IndexColor, 0, Count.ToString());
            x = AddText(view, x, y, view.Settings.IndexColor, HotSpot.NoneId, "]");

            x = AddIcon(view, x, y, Icons.LeftArrow, 2, HotSpotType.Click);
            x = AddText(view, x, y, view.Settings.IndexColor, HotSpot.NoneId, "(");
            x = AddText(view, x, y, view.Settings.IndexColor, 1, CurrentIndex.ToString());
            x = AddText(view, x, y, view.Settings.IndexColor, HotSpot.NoneId, ")");
            x = AddIcon(view, x, y, Icons.RightArrow, 3, HotSpotType.Click) + view.Font.Width;

            x = AddText(view, x, y, view.Settings.ValueColor, HotSpot.NoneId, $"<{InnerNode.Name} Size={MemorySize}>") + view.Font.Width;
            x = AddIcon(view, x + 2, y, Icons.Change, 4, exchange);

            x += view.Font.Width;
            x  = AddComment(view, x, y);

            AddTypeDrop(view, y);
            AddDelete(view, y);

            y += view.Font.Height;

            var size = new Size(x - origX, y - origY);

            if (levelsOpen[view.Level])
            {
                var childSize = DrawChild(view, tx, y);

                size.Width   = Math.Max(size.Width, childSize.Width + tx - origX);
                size.Height += childSize.Height;
            }

            return(size);
        }
        protected Size Draw(DrawContext context, int x, int y, string type)
        {
            if (IsHidden && !IsWrapped)
            {
                return(DrawHidden(context, x, y));
            }

            var origX = x;

            AddSelection(context, x, y, context.Font.Height);

            x = AddOpenCloseIcon(context, x, y);
            x = AddIcon(context, x, y, context.IconProvider.Array, HotSpot.NoneId, HotSpotType.None);

            var tx = x;

            x = AddAddressOffset(context, x, y);

            x = AddText(context, x, y, context.Settings.TypeColor, HotSpot.NoneId, type) + context.Font.Width;
            if (!IsWrapped)
            {
                x = AddText(context, x, y, context.Settings.NameColor, HotSpot.NameId, Name);
            }
            x = AddText(context, x, y, context.Settings.IndexColor, HotSpot.NoneId, "[");
            x = AddText(context, x, y, context.Settings.IndexColor, IsReadOnly ? HotSpot.NoneId : 0, Count.ToString());
            x = AddText(context, x, y, context.Settings.IndexColor, HotSpot.NoneId, "]");

            x = AddIcon(context, x, y, context.IconProvider.LeftArrow, 2, HotSpotType.Click);
            x = AddText(context, x, y, context.Settings.IndexColor, HotSpot.NoneId, "(");
            x = AddText(context, x, y, context.Settings.IndexColor, 1, CurrentIndex.ToString());
            x = AddText(context, x, y, context.Settings.IndexColor, HotSpot.NoneId, ")");
            x = AddIcon(context, x, y, context.IconProvider.RightArrow, 3, HotSpotType.Click) + context.Font.Width;

            x = AddText(context, x, y, context.Settings.ValueColor, HotSpot.NoneId, $"<Size={MemorySize}>") + context.Font.Width;
            x = AddIcon(context, x + 2, y, context.IconProvider.Change, 4, HotSpotType.ChangeWrappedType);

            x += context.Font.Width;
            x  = AddComment(context, x, y);

            DrawInvalidMemoryIndicatorIcon(context, y);
            AddContextDropDownIcon(context, y);
            AddDeleteIcon(context, y);

            y += context.Font.Height;

            var size = new Size(x - origX, context.Font.Height);

            if (LevelsOpen[context.Level])
            {
                var childSize = DrawChild(context, tx, y);

                size.Width   = Math.Max(size.Width, childSize.Width + tx - origX);
                size.Height += childSize.Height;
            }

            return(size);
        }
Beispiel #7
0
 private void textBox_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
 {
     if (e.KeyChar == 13)
     {
         CurrentIndex = 1;
         FilterText   = textBox.Text;
         pageBox.Text = CurrentIndex.ToString();
         UpdateResourceList();
     }
 }
Beispiel #8
0
 private void pageBox_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyData == Keys.Enter)
     {
         if (int.TryParse(pageBox.Text, out int pageIndex))
         {
             CurrentIndex   = pageIndex;
             labelPage.Text = CurrentIndex + "/" + PageCount;
             pageBox.Text   = CurrentIndex.ToString();
             UpdateResourceList();
         }
     }
 }
        // All the private methods.
        #region Private Methods
        /// <summary>
        /// Builds the information panel content.
        /// </summary>
        /// <param name="cell">The table cell.</param>
        /// <param name="designTime">Specify if we need the design time string.</param>
        internal override void BuildInfo(TableCell cell, bool designTime)
        {
            string info = (this.RecordCount == 0 && !string.IsNullOrEmpty(InfoTemplateNoRecords) ? InfoTemplateNoRecords : InfoTemplate);

            info = info.Replace("$RECORDCOUNT$", (designTime ? "##" : RecordCount.ToString()));
            info = info.Replace("$CURRENTPAGE$", (designTime ? "##" : (this.RecordCount == 0 ? "0" : CurrentPage.ToString())));
            info = info.Replace("$PAGECOUNT$", (designTime ? "##" : PageCount.ToString()));
            info = info.Replace("$CURRENTINDEX$", (designTime ? "##" : CurrentIndex.ToString()));

            System.Web.UI.WebControls.Label infoText = new System.Web.UI.WebControls.Label();
            infoText.Text = info;
            cell.Controls.Add(infoText);
        }
Beispiel #10
0
        /// <inheritdoc/>
        public XmlElement ToXmlElement(XmlDocument xmlDocument, ref IList <object> id_source, string name = "")
        {
            if (xmlDocument is null)
            {
                throw new ArgumentNullException(nameof(xmlDocument));
            }
            if (id_source is null)
            {
                throw new ArgumentNullException(nameof(id_source));
            }
            if (name is null)
            {
                throw new ArgumentNullException(nameof(name));
            }
            if (name == "")
            {
                name = GetType().Name;
            }
            XmlElement xmlThis = xmlDocument.CreateElement(name);

            if (id_source.Contains(this))
            {
                xmlThis.SetAttribute("ref", id_source.IndexOf(this).ToString("x16"));
            }
            else
            {
                xmlThis.SetAttribute("id", id_source.Count.ToString("x16"));
                id_source.Add(this);
                xmlThis.SetAttribute("type", GetType().FullName);
                XmlElement xmlRoute = xmlDocument.CreateElement("RouteType");
                xmlThis.AppendChild(xmlRoute);
                xmlRoute.InnerText = RouteType.ToString();
                XmlElement xmlRouteMode = xmlDocument.CreateElement("RouteMode");
                xmlThis.AppendChild(xmlRouteMode);
                xmlRouteMode.InnerText = RouteMode.ToString();
                XmlElement xmlIncrease = xmlDocument.CreateElement("Increase");
                xmlThis.AppendChild(xmlIncrease);
                xmlIncrease.InnerText = _increase.ToString();
                XmlElement xmlCurrentIndex = xmlDocument.CreateElement("CurrentIndex");
                xmlThis.AppendChild(xmlCurrentIndex);
                xmlCurrentIndex.InnerText = CurrentIndex is null ? "null" : CurrentIndex.ToString();
                XmlElement xmlEntries = xmlDocument.CreateElement("Entries");
                xmlThis.AppendChild(xmlEntries);
                foreach (T entry in this)
                {
                    XmlElement xmlEntry = CyclicalMethods.ToXmlElement(entry, xmlDocument, ref id_source, "Entry");
                    xmlEntries.AppendChild(xmlEntry);
                }
            }
            return(xmlThis);
        }
Beispiel #11
0
        private string RenderCurrent()
        {
            //string result = "<a class=\""
            //    + _CurrentPageCssClass + "\" href=\"{0}\" "
            //    + GetAlternativeText(CurrentIndex) + " >"
            //    + CurrentIndex.ToString() + "</a>&nbsp;";
            string result;

            if (leaveOutSpans)
            {
                result = "<a"
                         + GenerateClassAttribute(_CurrentPageCssClass) + " href=\"{0}\" "
                         + GetAlternativeText(CurrentIndex) + " >"
                         + CurrentIndex.ToString() + "</a> ";
                //result = CurrentIndex.ToString();
            }
            else
            {
                result = "<span class=\"" + _CurrentPageCssClass + "\""
                         + GetAlternativeText(CurrentIndex)
                         + ">" + CurrentIndex.ToString()
                         + "</span> ";
            }

            if (_RenderAsTable)
            {
                result = "<td class=\"" + _CurrentPageCellCssClass + "\">"
                         + result
                         + "</td>";
            }
            else if (renderAsList)
            {
                result = "<li" + GenerateClassAttribute(_CurrentPageCellCssClass) + ">"
                         + result
                         + "</li>";
            }

            if (_PageURLFormat.Length > 0)
            {
                string templateURL = String.Format(PageURLFormat, (CurrentIndex).ToString());
                return(String.Format(
                           result,
                           templateURL));
            }



            return(result);
        }
Beispiel #12
0
        protected int Draw(ViewInfo view, int x, int y, string type, HotSpotType exchange)
        {
            Contract.Requires(view != null);
            Contract.Requires(type != null);

            if (IsHidden)
            {
                return(DrawHidden(view, x, y));
            }

            AddSelection(view, x, y, view.Font.Height);
            AddDelete(view, x, y);
            AddTypeDrop(view, x, y);

            x = AddOpenClose(view, x, y);
            x = AddIcon(view, x, y, Icons.Array, -1, HotSpotType.None);

            var tx = x;

            x = AddAddressOffset(view, x, y);

            x = AddText(view, x, y, Program.Settings.TypeColor, HotSpot.NoneId, type) + view.Font.Width;
            x = AddText(view, x, y, Program.Settings.NameColor, HotSpot.NameId, Name);
            x = AddText(view, x, y, Program.Settings.IndexColor, HotSpot.NoneId, "[");
            x = AddText(view, x, y, Program.Settings.IndexColor, 0, Count.ToString());
            x = AddText(view, x, y, Program.Settings.IndexColor, HotSpot.NoneId, "]");

            x = AddIcon(view, x, y, Icons.LeftArrow, 2, HotSpotType.Click);
            x = AddText(view, x, y, Program.Settings.IndexColor, HotSpot.NoneId, "(");
            x = AddText(view, x, y, Program.Settings.IndexColor, 1, CurrentIndex.ToString());
            x = AddText(view, x, y, Program.Settings.IndexColor, HotSpot.NoneId, ")");
            x = AddIcon(view, x, y, Icons.RightArrow, 3, HotSpotType.Click);

            x = AddText(view, x, y, Program.Settings.ValueColor, HotSpot.NoneId, $"<{InnerNode.Name} Size={MemorySize}>");
            x = AddIcon(view, x + 2, y, Icons.Change, 4, exchange);

            x += view.Font.Width;
            AddComment(view, x, y);

            y += view.Font.Height;

            if (levelsOpen[view.Level])
            {
                y = DrawChild(view, tx, y);
            }

            return(y);
        }
Beispiel #13
0
 public void afterClick(string tag)
 {
     if (Enum.TryParse <ResourceType>(tag, out App.ResourceType))
     {
         Globals.ThisAddIn.RightWidget.CurrentIndex = 1;
         Globals.ThisAddIn.RightWidget.FilterText   = textBox.Text;
         Globals.ThisAddIn.RightWidget.pageBox.Text = CurrentIndex.ToString();
         Globals.ThisAddIn.RightWidget.ResetPageCount();
         Globals.ThisAddIn.RightWidget.UpdateResourceList();
     }
     else
     {
         App.ResourceType = ResourceType.None;
     }
     ResetButton();
 }
Beispiel #14
0
        protected override void Render(HtmlTextWriter writer)
        {
            if (Page != null)
            {
                Page.VerifyRenderingInServerForm(this);
            }

            writer.AddAttribute(HtmlTextWriterAttribute.Cellpadding, "3");
            writer.AddAttribute(HtmlTextWriterAttribute.Cellspacing, "1");
            writer.AddAttribute(HtmlTextWriterAttribute.Border, "0");
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "PagerContainerTable");

            writer.RenderBeginTag(HtmlTextWriterTag.Table);
            writer.RenderBeginTag(HtmlTextWriterTag.Tr);
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "LeftRightPagerCell");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            if (ItemCount == 0)
            {
                writer.Write(string.Format(RecordClause, 0, ItemCount) + " "
                             + string.Format(PageClause, 0, PageCount.ToString()) + " ");
            }
            else
            {
                writer.Write(string.Format(RecordClause, PageSize, ItemCount) + " "
                             + string.Format(PageClause, CurrentIndex.ToString(), PageCount.ToString()) + " ");
            }
            writer.RenderEndTag();

            if (CurrentIndex != 1)
            {
                writer.Write(RenderFirst());
            }
            else
            {
                writer.Write(RenderDisabledFirst());
            }

            if (CurrentIndex != 1)
            {
                writer.Write(RenderPrevious());
            }
            else
            {
                writer.Write(RenderDisabledPrevious());
            }

            if (CurrentIndex < PageCount)
            {
                writer.Write(RenderNext());
            }
            else
            {
                writer.Write(RenderDisabledNext());
            }

            if (CurrentIndex < PageCount)
            {
                writer.Write(RenderLast());
            }
            else
            {
                writer.Write(RenderDisabledLast());
            }

            writer.RenderEndTag();

            writer.RenderEndTag();

            base.Render(writer);
        }
Beispiel #15
0
        private void Bindrepeater(List <UserActivityItem> activityAlerts)
        {
            TotalPages = int.Parse((RowCount / ActivityStreamPageSize).ToString());
            if (RowCount % ActivityStreamPageSize != 0)
            {
                TotalPages += 1;
            }
            txtPagernumber.Text = CurrentIndex.ToString();
            //var Pds1 = new PagedDataSource();
            //Pds1.DataSource = activityAlerts;
            //Pds1.AllowPaging = true;
            //Pds1.PageSize = ActivityStreamTempPageSize;
            //Pds1.CurrentPageIndex = 0;
            try
            {
                activityAlerts[0].ShowTimeGroup = true;
                activityAlerts[0].ShowImage     = true;

                //activityAlerts[CurrentIndex * ActivityStreamPageSize].ShowTimeGroup = true;
                //activityAlerts[CurrentIndex * ActivityStreamPageSize].ShowImage = true;
            }
            catch { }
            repAlerts.DataSource = activityAlerts;
            repAlerts.DataBind();

            var startIndex = (ActivityStreamPageSize * CurrentIndex) + 1;
            var endIndex   = (ActivityStreamPageSize * CurrentIndex) + ActivityStreamPageSize;

            if (endIndex > activityAlerts.Count)
            {
                endIndex = activityAlerts.Count;
            }

            if (PagingStyle == "ActivityStreamPagingStyle1")
            {
                pagingStyle1.Visible = true;
                lblText.Text         = " of " + TotalPages + " Pages   ";
            }
            else if (PagingStyle == "ActivityStreamPagingStyle2")
            {
                pagingStyle2.Visible    = true;
                lb_FirstPage.Enabled    = true;
                lb_PreviousPage.Enabled = true;
                lb_NextPage.Enabled     = true;
                lb_LastPage.Enabled     = true;

                if (CurrentIndex == 0)
                {
                    lb_FirstPage.Enabled    = false;
                    lb_PreviousPage.Enabled = false;
                }

                if (CurrentIndex == (TotalPages - 1))
                {
                    lb_NextPage.Enabled = false;
                    lb_LastPage.Enabled = false;
                }
                lblPagerDescription.Text = startIndex + " - " + endIndex + " of " + activityAlerts.Count;
            }
            else if (PagingStyle == "ActivityStreamPagingStyle3")
            {
                pagingStyle3.Visible = true;
            }
            else if (PagingStyle == "ActivityStreamPagingStyle4")
            {
                pagingStyle4.Visible = true;
                CreatePagingControl();
                lblPagerDescription1.Text = startIndex + " - " + endIndex + " of " + activityAlerts.Count;
            }
        }
Beispiel #16
0
        protected override void Render(HtmlTextWriter writer)
        {
            if (Page != null)
            {
                Page.VerifyRenderingInServerForm(this);
            }

            if (this.PageCount > this.SmartShortCutThreshold && GenerateSmartShortCuts)
            {
                CalculateSmartShortcutAndFillList();
            }

            writer.AddAttribute(HtmlTextWriterAttribute.Cellpadding, "3");
            writer.AddAttribute(HtmlTextWriterAttribute.Cellspacing, "1");
            writer.AddAttribute(HtmlTextWriterAttribute.Border, "0");
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "PagerContainerTable");
            if (RTL)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Dir, "rtl");
            }
            writer.RenderBeginTag(HtmlTextWriterTag.Table);
            writer.RenderBeginTag(HtmlTextWriterTag.Tr);

            if (GeneratePagerInfoSection)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "PagerInfoCell");
                writer.RenderBeginTag(HtmlTextWriterTag.Td);
                writer.Write(PageClause + " " + CurrentIndex.ToString() + " " + OfClause + " " + PageCount.ToString());
                writer.RenderEndTag();
            }

            if (GenerateFirstLastSection && CurrentIndex != 1)
            {
                writer.Write(RenderFirst());
            }

            if (CurrentIndex != 1)
            {
                writer.Write(RenderBack());
            }

            if (CurrentIndex < CompactModePageCount)
            {
                if (CompactModePageCount > PageCount)
                {
                    CompactModePageCount = PageCount;
                }

                for (int i = 1; i < CompactModePageCount + 1; i++)
                {
                    if (i == CurrentIndex)
                    {
                        writer.Write(RenderCurrent());
                    }
                    else
                    {
                        writer.Write(RenderOther(i));
                    }
                }

                RenderSmartShortCutByCriteria(CompactModePageCount, true, writer);
            }
            else if (CurrentIndex >= CompactModePageCount && CurrentIndex < NormalModePageCount)
            {
                if (NormalModePageCount > PageCount)
                {
                    NormalModePageCount = PageCount;
                }

                for (int i = 1; i < NormalModePageCount + 1; i++)
                {
                    if (i == CurrentIndex)
                    {
                        writer.Write(RenderCurrent());
                    }
                    else
                    {
                        writer.Write(RenderOther(i));
                    }
                }

                RenderSmartShortCutByCriteria(NormalModePageCount, true, writer);
            }
            else if (CurrentIndex >= NormalModePageCount)
            {
                int gapValue  = NormalModePageCount / 2;
                int leftBand  = CurrentIndex - gapValue;
                int rightBand = CurrentIndex + gapValue;


                RenderSmartShortCutByCriteria(leftBand, false, writer);

                for (int i = leftBand; (i < rightBand + 1) && i < PageCount + 1; i++)
                {
                    if (i == CurrentIndex)
                    {
                        writer.Write(RenderCurrent());
                    }
                    else
                    {
                        writer.Write(RenderOther(i));
                    }
                }

                if (rightBand < this.PageCount)
                {
                    RenderSmartShortCutByCriteria(rightBand, true, writer);
                }
            }

            if (CurrentIndex != PageCount)
            {
                writer.Write(RenderNext());
            }

            if (GenerateFirstLastSection && CurrentIndex != PageCount)
            {
                writer.Write(RenderLast());
            }

            if (GenerateGoToSection)
            {
                writer.Write(RenderGoTo());
            }

            writer.RenderEndTag();

            writer.RenderEndTag();

            if (GenerateGoToSection)
            {
                writer.Write(RenderGoToScript());
            }

            if (GenerateHiddenHyperlinks)
            {
                writer.Write(RenderHiddenDiv());
            }
        }
Beispiel #17
0
        protected override void Render(HtmlTextWriter writer)
        {
            if (Page != null)
            {
                Page.VerifyRenderingInServerForm(this);
            }

            if (this.PageCount > this.SmartShortCutThreshold)
            {
                if (EnableSmartShortCuts)
                {
                    CalculateSmartShortcutAndFillList();
                }
            }

            if (_RenderAsTable)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Cellpadding, "3");
                writer.AddAttribute(HtmlTextWriterAttribute.Cellspacing, "1");
                writer.AddAttribute(HtmlTextWriterAttribute.Border, "0");
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "PagerContainerTable");
                if (RTL)
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Dir, "rtl");
                }
                writer.RenderBeginTag(HtmlTextWriterTag.Table);

                writer.RenderBeginTag(HtmlTextWriterTag.Tr);
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "PagerInfoCell");
                writer.RenderBeginTag(HtmlTextWriterTag.Td);
            }

            writer.AddAttribute(HtmlTextWriterAttribute.Class, _PageInfoCssClass);
            writer.RenderBeginTag(HtmlTextWriterTag.Span);

            writer.Write(PageClause + " " + CurrentIndex.ToString() + " " + OfClause + " " + PageCount.ToString());

            writer.RenderEndTag(); //span
            writer.Write("&nbsp;");

            if (_RenderAsTable)
            {
                writer.RenderEndTag();
            }

            if (ShowFirstLast && CurrentIndex != 1)
            {
                writer.Write(RenderFirst());
            }

            if (CurrentIndex != 1)
            {
                writer.Write(RenderBack());
            }

            if (CurrentIndex < CompactedPageCount)
            {
                if (CompactedPageCount > PageCount)
                {
                    CompactedPageCount = PageCount;
                }

                for (int i = 1; i < CompactedPageCount + 1; i++)
                {
                    if (i == CurrentIndex)
                    {
                        writer.Write(RenderCurrent());
                    }
                    else
                    {
                        writer.Write(RenderOther(i));
                    }
                }

                RenderSmartShortCutByCriteria(CompactedPageCount, true, writer);
            }
            else if (CurrentIndex >= CompactedPageCount && CurrentIndex < NotCompactedPageCount)
            {
                if (NotCompactedPageCount > PageCount)
                {
                    NotCompactedPageCount = PageCount;
                }

                for (int i = 1; i < NotCompactedPageCount + 1; i++)
                {
                    if (i == CurrentIndex)
                    {
                        writer.Write(RenderCurrent());
                    }
                    else
                    {
                        writer.Write(RenderOther(i));
                    }
                }

                RenderSmartShortCutByCriteria(NotCompactedPageCount, true, writer);
            }
            else if (CurrentIndex >= NotCompactedPageCount)
            {
                int gapValue  = NotCompactedPageCount / 2;
                int leftBand  = CurrentIndex - gapValue;
                int rightBand = CurrentIndex + gapValue;


                RenderSmartShortCutByCriteria(leftBand, false, writer);

                for (int i = leftBand; (i < rightBand + 1) && i < PageCount + 1; i++)
                {
                    if (i == CurrentIndex)
                    {
                        writer.Write(RenderCurrent());
                    }
                    else
                    {
                        writer.Write(RenderOther(i));
                    }
                }

                if (rightBand < this.PageCount)
                {
                    RenderSmartShortCutByCriteria(rightBand, true, writer);
                }
            }

            if (CurrentIndex != PageCount)
            {
                writer.Write(RenderNext());
            }

            if (ShowFirstLast && CurrentIndex != PageCount)
            {
                writer.Write(RenderLast());
            }

            if (_RenderAsTable)
            {
                writer.RenderEndTag();

                writer.RenderEndTag();
            }

            base.Render(writer);
        }
 public string TextAtCurrentIndex(int cardType)
 {
     GetCardContext(cardType);
     return(CurrentIndex.ToString());
 }
Beispiel #19
0
 private string GenerateTotalText()
 {
     return(CurrentIndex.ToString() + " / " + MaxPages.ToString());
 }
Beispiel #20
0
 private string RenderCurrent()
 {
     return("<td class=\"PagerCurrentPageCell\"><span class=\"PagerHyperlinkStyle\" " + GetAlternativeText(CurrentIndex) + " ><strong> " + CurrentIndex.ToString() + " </strong></span></td>");
 }
Beispiel #21
0
        private void DoRender(HtmlTextWriter writer)
        {
            if (Page != null)
            {
                Page.VerifyRenderingInServerForm(this);
            }

            //base.RenderBeginTag(writer);

            if (this.PageCount > this.SmartShortCutThreshold)
            {
                if (EnableSmartShortCuts)
                {
                    CalculateSmartShortcutAndFillList();
                }
            }

            if (containerElement.Length > 0)
            {
                writer.Write("<" + containerElement);
                if (containerElementCssClass.Length > 0)
                {
                    writer.Write(" class='" + containerElementCssClass + "'");
                }


                writer.Write(">");
            }

            if (renderNavElement)
            {
                writer.Write("<nav role='navigation'>");
            }

            if (_RenderAsTable)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Cellpadding, "3");
                writer.AddAttribute(HtmlTextWriterAttribute.Cellspacing, "1");
                writer.AddAttribute(HtmlTextWriterAttribute.Border, "0");
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "PagerContainerTable");
                if (RTL)
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Dir, "rtl");
                }
                writer.RenderBeginTag(HtmlTextWriterTag.Table);

                writer.RenderBeginTag(HtmlTextWriterTag.Tr);
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "PagerInfoCell");
                writer.RenderBeginTag(HtmlTextWriterTag.Td);
            }
            else if (renderAsList)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "pagination");
                writer.RenderBeginTag(HtmlTextWriterTag.Ul);
            }

            if (renderAsList)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Class, _PageInfoCssClass);
                writer.RenderBeginTag(HtmlTextWriterTag.Li);
            }

            if (CurrentIndex > -1)
            {
                // begin page info
                if (!leaveOutSpans)
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Class, _PageInfoCssClass);
                    writer.RenderBeginTag(HtmlTextWriterTag.Span);
                }

                if (wrapPageInfoInAnchor)
                {
                    writer.Write("<a name='pageinfo'>");
                }
                writer.Write(PageClause + " " + CurrentIndex.ToString() + " " + OfClause + " " + PageCount.ToString());
                if (wrapPageInfoInAnchor)
                {
                    writer.Write("</a>");
                }

                if (!leaveOutSpans)
                {
                    writer.RenderEndTag(); //span
                }
                writer.Write(" ");

                // end pageinfo
            }


            //start view all link
            if (viewAllUrl.Length > 0)
            {
                if (!leaveOutSpans)
                {
                    if (CurrentIndex == -1)
                    {
                        writer.AddAttribute(HtmlTextWriterAttribute.Class, _CurrentPageCssClass + " viewall");
                        writer.RenderBeginTag(HtmlTextWriterTag.Span);
                    }
                    else
                    {
                        writer.AddAttribute(HtmlTextWriterAttribute.Class, _PageInfoCssClass + " viewall");
                        writer.RenderBeginTag(HtmlTextWriterTag.Span);
                    }
                }

                writer.Write("<a class='pagerall' href='" + viewAllUrl + "'>");
                writer.Write(viewAllText);
                writer.Write("</a>");


                if (!leaveOutSpans)
                {
                    writer.RenderEndTag(); //span
                }
                writer.Write(" ");
            }


            //end view all link

            if (renderAsList)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "unavailable");
                writer.RenderEndTag(); //li
            }

            if (_RenderAsTable)
            {
                writer.RenderEndTag();
            }

            if (CurrentIndex > -1)
            {
                if (ShowFirstLast && CurrentIndex != 1)
                {
                    writer.Write(RenderFirst());
                }

                if (CurrentIndex != 1)
                {
                    writer.Write(RenderBack());
                }
            }

            if (CurrentIndex < CompactedPageCount)
            {
                if (CompactedPageCount > PageCount)
                {
                    CompactedPageCount = PageCount;
                }

                for (int i = 1; i < CompactedPageCount + 1; i++)
                {
                    if (i == CurrentIndex)
                    {
                        writer.Write(RenderCurrent());
                    }
                    else
                    {
                        writer.Write(RenderOther(i));
                    }
                }

                RenderSmartShortCutByCriteria(CompactedPageCount, true, writer);
            }
            else if (CurrentIndex >= CompactedPageCount && CurrentIndex < NotCompactedPageCount)
            {
                if (NotCompactedPageCount > PageCount)
                {
                    NotCompactedPageCount = PageCount;
                }

                for (int i = 1; i < NotCompactedPageCount + 1; i++)
                {
                    if (i == CurrentIndex)
                    {
                        writer.Write(RenderCurrent());
                    }
                    else
                    {
                        writer.Write(RenderOther(i));
                    }
                }

                RenderSmartShortCutByCriteria(NotCompactedPageCount, true, writer);
            }
            else if (CurrentIndex >= NotCompactedPageCount)
            {
                int gapValue  = NotCompactedPageCount / 2;
                int leftBand  = CurrentIndex - gapValue;
                int rightBand = CurrentIndex + gapValue;


                RenderSmartShortCutByCriteria(leftBand, false, writer);

                for (int i = leftBand; (i < rightBand + 1) && i < PageCount + 1; i++)
                {
                    if (i == CurrentIndex)
                    {
                        writer.Write(RenderCurrent());
                    }
                    else
                    {
                        writer.Write(RenderOther(i));
                    }
                }

                if (rightBand < this.PageCount)
                {
                    RenderSmartShortCutByCriteria(rightBand, true, writer);
                }
            }

            if (CurrentIndex != PageCount)
            {
                writer.Write(RenderNext());
            }

            if (ShowFirstLast && CurrentIndex != PageCount)
            {
                writer.Write(RenderLast());
            }

            if (_RenderAsTable)
            {
                writer.RenderEndTag();

                writer.RenderEndTag();
            }
            else if (renderAsList)
            {
                writer.RenderEndTag(); //ul
            }

            if (renderNavElement)
            {
                writer.Write("</nav>");
            }

            if (containerElement.Length > 0)
            {
                writer.Write("</" + containerElement + ">");
            }

            base.Render(writer);
            //base.RenderEndTag(writer);
        }
Beispiel #22
0
 private string RenderCurrent()
 {
     return("<span class=\"current\">" + CurrentIndex.ToString() + "</span>");
 }