Пример #1
0
        /// <summary>
        /// Icons the legend load.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        private void IconLegendLoad([NotNull] object sender, [NotNull] EventArgs e)
        {
            string[] themeImageTags =
                {
                    "TOPIC_NEW", "TOPIC", "TOPIC_HOT_NEW", "TOPIC_HOT", "TOPIC_NEW_LOCKED", "TOPIC_LOCKED",
                    "TOPIC_ANNOUNCEMENT_NEW", "TOPIC_ANNOUNCEMENT", "TOPIC_STICKY_NEW", "TOPIC_STICKY",
                    "TOPIC_POLL_NEW", "TOPIC_POLL", "TOPIC_MOVED"
                };

            string[] localizedTags =
                {
                    "NEW_POSTS", "NO_NEW_POSTS", "HOT_NEW_POSTS", "HOT_NO_NEW_POSTS", "NEW_POSTS_LOCKED",
                    "NO_NEW_POSTS_LOCKED", "ANNOUNCEMENT_NEW", "ANNOUNCEMENT", "STICKY_NEW", "STICKY", "POLL_NEW",
                    "POLL", "MOVED"
                };

            HtmlGenericControl tr = null;

            // add a table control
            var table = new HtmlGenericControl("div");

            // table.Attributes.Add(HtmlTextWriterAttribute.Class.ToString(), "container");
            this.Controls.Add(table);

            for (var i = 0; i < themeImageTags.Length; i++)
            {
                if (i % 2 == 0 || tr == null)
                {
                    // add <tr>
                    tr = new HtmlGenericControl("div");
                    tr.Attributes.Add(HtmlTextWriterAttribute.Class.ToString(), "row");
                    table.Controls.Add(tr);
                }

                // add this to the tr...
                var td = new HtmlGenericControl("div");
                td.Attributes.Add(HtmlTextWriterAttribute.Class.ToString(), "col");
                tr.Controls.Add(td);

                // add the themed icons
                var icon = new Literal
                               {
                                   Text = $"<span class=\"fa-stack\">{GetTopicIcon(localizedTags[i])}</span>"
                               };
                td.Controls.Add(icon);

                // space
                var space = new Literal { Text = " " };
                td.Controls.Add(space);

                // localized text describing the image
                var localLabel = new LocalizedLabel { LocalizedTag = localizedTags[i] };
                td.Controls.Add(localLabel);
            }
        }
Пример #2
0
        /// <summary>
        /// Icons the legend load.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        private void IconLegendLoad([NotNull] object sender, [NotNull] EventArgs e)
        {
            string[] themeImageTags =
            {
                "TOPIC_NEW",              "TOPIC",              "TOPIC_HOT_NEW",    "TOPIC_HOT",    "TOPIC_NEW_LOCKED", "TOPIC_LOCKED",
                "TOPIC_ANNOUNCEMENT_NEW", "TOPIC_ANNOUNCEMENT", "TOPIC_STICKY_NEW", "TOPIC_STICKY",
                "TOPIC_POLL_NEW",         "TOPIC_POLL",         "TOPIC_MOVED"
            };

            string[] localizedTags =
            {
                "NEW_POSTS",           "NO_NEW_POSTS",     "HOT_NEW_POSTS", "HOT_NO_NEW_POSTS", "NEW_POSTS_LOCKED",
                "NO_NEW_POSTS_LOCKED", "ANNOUNCEMENT_NEW", "ANNOUNCEMENT",  "STICKY_NEW",       "STICKY",          "POLL_NEW",
                "POLL",                "MOVED"
            };

            HtmlGenericControl row = null;

            // add a table control
            var table = new HtmlGenericControl("div");

            // table.Attributes.Add(HtmlTextWriterAttribute.Class.ToString(), "container");
            this.Controls.Add(table);

            for (var i = 0; i < themeImageTags.Length; i++)
            {
                if (i % 2 == 0 || row == null)
                {
                    // add row
                    row = new HtmlGenericControl("div");
                    row.Attributes.Add(HtmlTextWriterAttribute.Class.ToString(), "row");
                    table.Controls.Add(row);
                }

                // add column
                var col = new HtmlGenericControl("div");
                col.Attributes.Add(HtmlTextWriterAttribute.Class.ToString(), "col");
                row.Controls.Add(col);

                // add the themed icons
                var icon = new Label
                {
                    Text     = GetTopicIcon(localizedTags[i]),
                    CssClass = "fa-stack pr-1"
                };
                col.Controls.Add(icon);

                // localized text describing the image
                var localLabel = new LocalizedLabel {
                    LocalizedTag = localizedTags[i]
                };
                col.Controls.Add(localLabel);
            }
        }