当前位置: 首页>>代码示例>>C#>>正文


C# IRenderContext.ParsePath方法代码示例

本文整理汇总了C#中IRenderContext.ParsePath方法的典型用法代码示例。如果您正苦于以下问题:C# IRenderContext.ParsePath方法的具体用法?C# IRenderContext.ParsePath怎么用?C# IRenderContext.ParsePath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IRenderContext的用法示例。


在下文中一共展示了IRenderContext.ParsePath方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CurrentRequestSessions

        /// <summary>
        /// Generates some script tags that you insert into your view.
        /// You should probably call this from a helper depending on your view engine.
        /// </summary>
        /// <param name="renderContext">The current Nancy Render Context</param>
        /// <returns></returns>
        public static string CurrentRequestSessions(IRenderContext renderContext)
        {
            var rootUrl = renderContext.ParsePath("~" + ModulePath) + "/";
            var sessionIdList = GetCurrentSessionIdList(renderContext.Context);

            return CurrentRequestSessions(rootUrl, sessionIdList);
        }
开发者ID:thefringeninja,项目名称:randy,代码行数:13,代码来源:RavenProfiler.cs

示例2: GetStreamLinksHtml

        public static IHtmlString GetStreamLinksHtml(int malAnimeId, GetRecsViewModel model, IRenderContext renderContext)
        {
            List<string> streamLinks = new List<string>();
            if (model.StreamsByAnime.ContainsKey(malAnimeId))
            {
                foreach (streaming_service_anime_map serviceMap in model.StreamsByAnime[malAnimeId]
                    .OrderBy(map => map.streaming_service_id))
                {
                    StreamingService service = (StreamingService)serviceMap.streaming_service_id;
                    string imagePath;
                    string altText;
                    string titleText;
                    switch (service)
                    {
                        case StreamingService.Crunchyroll:
                            imagePath = renderContext.ParsePath("~/Content/crunchyroll_icon.png");
                            altText = "Crunchyroll";
                            titleText = "Watch on Crunchyroll";
                            break;
                        case StreamingService.Funimation:
                            imagePath = renderContext.ParsePath("~/Content/funimation_icon.png");
                            altText = "Funimation";
                            titleText = "Watch on Funimation";
                            break;
                        case StreamingService.Viz:
                            imagePath = renderContext.ParsePath("~/Content/viz_icon.png");
                            altText = "Viz";
                            titleText = "Watch on Viz";
                            break;
                        case StreamingService.Hulu:
                            imagePath = renderContext.ParsePath("~/Content/hulu_icon.png");
                            altText = "Hulu";
                            titleText = "Watch on Hulu";
                            break;
                        default:
                            continue;
                    }

                    string imgHtml = string.Format(@"<img src={0} title={1} alt={2} />",
                        AttributeString(imagePath), AttributeString(titleText), AttributeString(altText));

                    string linkHtml = string.Format(@"<a href={0}>{1}</a>", AttributeString(serviceMap.streaming_url), imgHtml);
                    streamLinks.Add(linkHtml);
                }
            }

            string linksHtml = string.Join(" ", streamLinks);
            return new NonEncodedHtmlString(linksHtml);
        }
开发者ID:mageomageos,项目名称:animerecs,代码行数:49,代码来源:HtmlHelpers.cs


注:本文中的IRenderContext.ParsePath方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。