當前位置: 首頁>>代碼示例>>C#>>正文


C# Cloud.HTML方法代碼示例

本文整理匯總了C#中Cloud.HTML方法的典型用法代碼示例。如果您正苦於以下問題:C# Cloud.HTML方法的具體用法?C# Cloud.HTML怎麽用?C# Cloud.HTML使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Cloud的用法示例。


在下文中一共展示了Cloud.HTML方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: LoadTagCloud

        private void LoadTagCloud()
        {
            const string cacheName = "ArticleTagCloud";
            string htmlCloud;

            if (HttpRuntime.Cache[cacheName] == null)
            {
                var cloud1 = new Cloud
                {
                    DataIDField = "keyword_id",
                    DataKeywordField = "keyword_value",
                    DataCountField = "keyword_count",
                    DataURLField = "keyword_url"
                };

                DataSet theDs = Contents.GetContentTagsAll();

                cloud1.DataSource = theDs;
                cloud1.MinFontSize = 14;
                cloud1.MaxFontSize = 30;
                cloud1.FontUnit = @"px";

                htmlCloud = cloud1.HTML();

                HttpRuntime.Cache.AddObjToCache(htmlCloud, cacheName);
            }
            else
            {
                htmlCloud = (string) HttpRuntime.Cache[cacheName];
            }

            ViewBag.CloudTags = htmlCloud;
        }
開發者ID:dasklub,項目名稱:kommunity,代碼行數:33,代碼來源:NewsController.cs

示例2: Filter

        public ActionResult Filter(string firstLetter)
        {
            _chosen = Convert.ToChar(firstLetter);

            ViewBag.FirstLetter = firstLetter.ToUpper();

            var cloud1 = new Cloud
            {
                DataIDField = @"keyword_id",
                DataKeywordField = "keyword_value",
                DataCountField = "keyword_count",
                DataURLField = "keyword_url"
            };

            DataSet theDs = firstLetter == "0"
                ? Artists.GetArtistCloudByNonLetter()
                : Artists.GetArtistCloudByLetter(firstLetter);
            cloud1.DataSource = theDs;

            cloud1.MinFontSize = 14;
            cloud1.MaxFontSize = 30;
            cloud1.FontUnit = "px";

            foreach (char chl in _letters.Where(chl => chl == Convert.ToChar(firstLetter)))
            {
                _chosen = chl;
            }

            var sb = new StringBuilder();

            sb.Append(@"<div class=""letter_group""><ul>");

            foreach (char ch2 in _letters)
            {
                sb.Append("<li>");

                if (Convert.ToChar(ch2.ToString(CultureInfo.InvariantCulture).ToLower()) ==
                    Convert.ToChar(_chosen.ToString(CultureInfo.InvariantCulture).ToLower()))
                {
                    sb.Append("<b>");
                    sb.Append(ch2);
                    sb.Append("</b>");
                }
                else
                {
                    sb.AppendFormat(@"<a href=""{0}"">{1}</a>", VirtualPathUtility.ToAbsolute(
                        string.Format("~/video/bands/{0}",
                            Convert.ToChar(ch2.ToString(CultureInfo.InvariantCulture).ToLower()))),
                        Convert.ToChar(ch2.ToString(CultureInfo.InvariantCulture)));
                }

                sb.Append("</li>");
            }

            sb.Append("</ul></div>");

            ViewBag.LetterOfBands = sb.ToString();

            ViewBag.CloudBands = cloud1.HTML();

            return View();
        }
開發者ID:dasklub,項目名稱:kommunity,代碼行數:62,代碼來源:VideoController.cs


注:本文中的Cloud.HTML方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。