Exemplo n.º 1
0
        static DashboardRoutes()
        {
            Routes = new RouteCollection();
            Routes.AddRazorPage("/", x => new HomePage());
            Routes.AddRazorPage("/traces/(?<TraceId>\\d+)", x =>
            {
                using (var connection = TraceStorage.Current.GetConnection())
                {
                    var traceId = int.Parse(x.Groups["TraceId"].Value);
                    var model = connection.GetTraceDetail(traceId);
                    return new TraceDetailsPage { Model = model };
                }
            });

            #region Embedded static content

            Routes.Add("/img/logo", new EmbeddedResourceDispatcher(
                "image/png",
                typeof(DashboardRoutes).Assembly,
                GetContentResourceName("img", "pugtrace.png")));

            Routes.Add("/js", new CombinedResourceDispatcher(
                "application/javascript",
                typeof(DashboardRoutes).Assembly,
                GetContentFolderNamespace("js"),
                Javascripts));

            Routes.Add("/css", new CombinedResourceDispatcher(
                "text/css",
                typeof(DashboardRoutes).Assembly,
                GetContentFolderNamespace("css"),
                Stylesheets));

            Routes.Add("/fonts/glyphicons-halflings-regular/eot", new EmbeddedResourceDispatcher(
                "application/vnd.ms-fontobject",
                typeof(DashboardRoutes).Assembly,
                GetContentResourceName("fonts", "glyphicons-halflings-regular.eot")));

            Routes.Add("/fonts/glyphicons-halflings-regular/svg", new EmbeddedResourceDispatcher(
                "image/svg+xml",
                typeof(DashboardRoutes).Assembly,
                GetContentResourceName("fonts", "glyphicons-halflings-regular.svg")));

            Routes.Add("/fonts/glyphicons-halflings-regular/ttf", new EmbeddedResourceDispatcher(
                "application/octet-stream",
                typeof(DashboardRoutes).Assembly,
                GetContentResourceName("fonts", "glyphicons-halflings-regular.ttf")));

            Routes.Add("/fonts/glyphicons-halflings-regular/woff", new EmbeddedResourceDispatcher(
                "application/font-woff",
                typeof(DashboardRoutes).Assembly,
                GetContentResourceName("fonts", "glyphicons-halflings-regular.woff")));

            Routes.Add("/fonts/glyphicons-halflings-regular/woff2", new EmbeddedResourceDispatcher(
                "application/font-woff2",
                typeof(DashboardRoutes).Assembly,
                GetContentResourceName("fonts", "glyphicons-halflings-regular.woff2")));

            #endregion
        }
Exemplo n.º 2
0
        static DashboardRoutes()
        {
            Routes = new RouteCollection();
            Routes.AddRazorPage("/", x => new HomePage());
            Routes.AddRazorPage("/cleanup", x => new Cleanup());

            #region Embedded static content

            Routes.Add("/img/logo", new EmbeddedResourceDispatcher(
                "image/png",
                typeof(DashboardRoutes).Assembly,
                GetContentResourceName("img", "pugtrace.png")));

            Routes.Add("/js", new CombinedResourceDispatcher(
                "application/javascript",
                typeof(DashboardRoutes).Assembly,
                GetContentFolderNamespace("js"),
                Javascripts));

            Routes.Add("/css", new CombinedResourceDispatcher(
                "text/css",
                typeof(DashboardRoutes).Assembly,
                GetContentFolderNamespace("css"),
                Stylesheets));

            Routes.Add("/fonts/glyphicons-halflings-regular/eot", new EmbeddedResourceDispatcher(
                "application/vnd.ms-fontobject",
                typeof(DashboardRoutes).Assembly,
                GetContentResourceName("fonts", "glyphicons-halflings-regular.eot")));

            Routes.Add("/fonts/glyphicons-halflings-regular/svg", new EmbeddedResourceDispatcher(
                "image/svg+xml",
                typeof(DashboardRoutes).Assembly,
                GetContentResourceName("fonts", "glyphicons-halflings-regular.svg")));

            Routes.Add("/fonts/glyphicons-halflings-regular/ttf", new EmbeddedResourceDispatcher(
                "application/octet-stream",
                typeof(DashboardRoutes).Assembly,
                GetContentResourceName("fonts", "glyphicons-halflings-regular.ttf")));

            Routes.Add("/fonts/glyphicons-halflings-regular/woff", new EmbeddedResourceDispatcher(
                "application/font-woff",
                typeof(DashboardRoutes).Assembly,
                GetContentResourceName("fonts", "glyphicons-halflings-regular.woff")));

            Routes.Add("/fonts/glyphicons-halflings-regular/woff2", new EmbeddedResourceDispatcher(
                "application/font-woff2",
                typeof(DashboardRoutes).Assembly,
                GetContentResourceName("fonts", "glyphicons-halflings-regular.woff2")));

            #endregion
        }