本文整理汇总了C#中IUrlRegistry.UrlFor方法的典型用法代码示例。如果您正苦于以下问题:C# IUrlRegistry.UrlFor方法的具体用法?C# IUrlRegistry.UrlFor怎么用?C# IUrlRegistry.UrlFor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IUrlRegistry
的用法示例。
在下文中一共展示了IUrlRegistry.UrlFor方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RequestLinksTag
public RequestLinksTag(RequestLog log, IUrlRegistry urls)
{
AddHeader("Chain Details");
Add("li").Add("a").Id("chain-summary").Attr("href", "#").Text("View Summary");
Add("li").Add("span/a").Attr("href", urls.UrlFor(new ChainDetailsRequest{Id = log.ChainId})).Text("View Details").AddClass("external").Attr("target", "_blank");
}
示例2: DiagnosticMenuTag
public DiagnosticMenuTag(IDiagnosticContext context, ICurrentHttpRequest currentHttpRequest, IUrlRegistry urls) : base("ul")
{
AddClass("nav");
var group = context.CurrentGroup();
var index = group.Index();
if (index != null)
{
addLink(index, context, currentHttpRequest);
}
else
{
var url = urls.UrlFor(new GroupRequest {Name = group.Name});
var li = Add("li");
li.Add("a").Attr("href", url).Text(group.Name).Attr("title", group.Description);
if (context.CurrentChain() == null)
{
li.AddClass("active");
}
}
group.Links().Each(x => addLink(x, context, currentHttpRequest));
}
示例3: writeLog
private void writeLog(RequestLog log, IUrlRegistry urls)
{
AddBodyRow(row => {
var chainUrl = urls.UrlFor(log);
row.Cell().Add("a").Text(log.LocalTime).Attr("href", chainUrl);
row.Cell(log.Endpoint);
row.Cell(log.HttpMethod);
var statusCell = row.Cell();
statusCell.Add("span").AddClass("http-status-code").Text(log.HttpStatus.Status.ToString());
statusCell.Add("span").AddClass("http-status-description").Text(log.HttpStatus.Description);
row.Cell(log.ContentType);
row.Cell(Math.Ceiling(log.ExecutionTime).ToString()).AddClass("number");
});
}
示例4: BuildDocument
public static HtmlDocument BuildDocument(IUrlRegistry urls, string title, params HtmlTag[] tags)
{
var css = GetResourceText(typeof(BehaviorGraphWriter), "diagnostics.css");
var realTitle = "FubuMVC: " + title;
var document = new HtmlDocument();
document.Title = realTitle;
var mainDiv = new HtmlTag("div").AddClass("main");
mainDiv.Add("h2").Text("FubuMVC Diagnostics").Child(buildVersionTag());
var navBar = mainDiv.Add("div").AddClass("homelink");
navBar.AddChildren(new LinkTag("Home", urls.UrlFor<BehaviorGraphWriter>(w => w.Index())));
navBar.Add("span").Text(" > " + title);
document.Add(mainDiv);
mainDiv.AddChildren(tags);
document.AddStyle(css);
return document;
}
示例5: BuildDocument
public static HtmlDocument BuildDocument(IUrlRegistry urls, string title, params HtmlTag[] tags)
{
string css = GetDiagnosticCss();
var realTitle = "FubuMVC: " + title;
var document = new HtmlDocument();
document.Title = realTitle;
var mainDiv = new HtmlTag("div").AddClass("main");
mainDiv.Add("h2").Text("FubuMVC Diagnostics").Append(buildVersionTag());
var navBar = mainDiv.Add("div").AddClass("homelink");
if (urls != null) navBar.Append(new LinkTag("Home", urls.UrlFor<BehaviorGraphWriter>(w => w.Index(), null)));
navBar.Add("span").Text(" > " + title);
document.Add(mainDiv);
mainDiv.Append(tags);
document.AddStyle(css);
return document;
}
示例6: addJobRow
private void addJobRow(TableRowTag row, JobStatusDTO job, IUrlRegistry urls)
{
row.Cell().Add("a").Text(job.JobKey).Attr("href", urls.UrlFor(new ScheduledJobRequest{Job = job.JobKey}));
row.Cell(job.NextTime.HasValue ? job.NextTime.Value.ToLocalTime().ToString() : "Not scheduled");
row.Cell(job.GetStatusDescription());
row.Cell(job.GetLastExecutionDescription());
var url = urls.UrlFor(new RunJobRequest {Name = job.JobKey});
row.Cell().Add("button").Text("Execute").Attr("data-url", url).AddClass("button").AddClass("executor").Attr("onclick", "if (window.confirm('Ok to run this job?')) window.location='" + url + "'");
}
示例7: addQueueRow
private void addQueueRow(TableRowTag row, IQueueManager queueManager, string queueName, IUrlRegistry urls, string displayForCount = null)
{
var url = urls.UrlFor(new MessagesInputModel {Port = queueManager.Endpoint.Port, QueueName = queueName});
row.Cell().Add("a")
.Attr("href", url)
.Text(queueName);
row.Cell(displayForCount ?? queueManager.GetNumberOfMessages(queueName).ToString(CultureInfo.InvariantCulture));
}
示例8: ForChain
public static RouteReport ForChain(BehaviorChain chain, IUrlRegistry urls)
{
return new RouteReport(chain, urls.UrlFor(new ChainRequest{Id = chain.UniqueId}), urls.UrlFor(new ChainDetailsRequest{Id = chain.UniqueId}));
}