本文整理汇总了C#中ElementRequest.Get方法的典型用法代码示例。如果您正苦于以下问题:C# ElementRequest.Get方法的具体用法?C# ElementRequest.Get怎么用?C# ElementRequest.Get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ElementRequest
的用法示例。
在下文中一共展示了ElementRequest.Get方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: modify
protected override void modify(ElementRequest request)
{
var rules = request.Get<ValidationGraph>().FieldRulesFor(request.Accessor);
var modifier = request.Get<IFieldValidationModifier>();
rules.Each(x => modifier.ModifyFor(x, request));
}
示例2: Build
public HtmlTag Build(ElementRequest request)
{
if (_url.IsEmpty())
{
_url = request.Get<IUrlRegistry>().UrlFor(_lookupType);
}
request.Get<IAssetRequirements>().Require("fubu.autocomplete.js");
var label = request.Get<IDisplayFormatter>().GetDisplayForValue(request.Accessor, request.RawValue);
var hidden = new HiddenTag()
.Id(request.ElementId)
.Name(request.ElementId)
.AddClass("lookup")
.Attr("value", request.RawValue == null ? string.Empty : request.RawValue.ToString());
var textboxId = "{0}Value".ToFormat(request.ElementId);
var textbox = new TextboxTag(textboxId, label)
.Id(textboxId)
.Data("lookup-url", _url)
.Data("value-for", request.ElementId)
.AddClass("autocomplete");
hidden.After(textbox);
return hidden;
}
示例3: Build
public override HtmlTag Build(ElementRequest request)
{
var entities = request.Get<IRepository>().GetAll(request.Accessor.PropertyType).Cast<Entity>();
var stringifier = request.Get<Stringifier>();
return new SelectTag(tag =>
entities.Each(entity => tag.Option(stringifier.GetString(entity), entity.Id)));
}
示例4: modify
protected override void modify(ElementRequest request)
{
var graph = request.Get<RemoteRuleGraph>();
var rules = graph.RulesFor(request.Accessor);
var data = new RemoteValidationDef
{
rules = rules.Select(x => x.ToHash()).ToArray(),
url = request.Get<IUrlRegistry>().RemoteRule()
};
if (!data.rules.Any())
{
return;
}
request.CurrentTag.Data("remote-rule", data);
}
示例5: Build
public override HtmlTags.HtmlTag Build(ElementRequest request)
{
HtmlTag el = new HtmlTag("ul").AddClass("pizza-type");
IRepository repository = request.Get<IRepository>();
IEnumerable<PizzaType> pizzaTypes = repository.GetAll<PizzaType>().Cast<PizzaType>();
var stringifier = request.Get<Stringifier>();
foreach (PizzaType pt in pizzaTypes)
{
HtmlTag radio = new HtmlTag("input");
radio.Attr("type", "radio").Attr("name", "PizzaType");
radio.Attr("value", pt.Id);
radio.Text(stringifier.GetString(pt));
el.Append(new HtmlTag("li").Append(radio));
}
return el;
}
示例6: Build
public override HtmlTag Build(ElementRequest request)
{
// Add the DatePickerActivator.js into the asset pipeline for this page
request.Get<IAssetRequirements>().Require("DatePickerActivator.js");
string text = null == request.RawValue || DateTime.MinValue.Equals(request.RawValue)
? ""
: request.RawValue.As<DateTime>().ToShortDateString();
return new HtmlTag("input").Text(text).Attr("type", "text").AddClass("datepicker");
}
示例7: GetListElementTitlesOrderedByRank
private static ListElements GetListElementTitlesOrderedByRank(ElementRequest request)
{
var att = request.Accessor.GetAttribute<GbstListValueAttribute>();
var listName = att.GetListName();
var listCache = request.Get<IListCache>();
var gbstList = listCache.GetGbstList(listName);
var elementTitles = gbstList.ActiveElements.OrderBy(e => e.Rank).Select(element => element.Title);
return new ListElements { DefaultElementTitle = gbstList.DefaultElement.Title, ElementTitles = elementTitles };
}
示例8: Build
public HtmlTag Build(ElementRequest request)
{
return new HtmlTag("div").Text(request.Get<FakeService>().Name);
}
示例9: BuildTag
public static HtmlTag BuildTag(ElementRequest request, Type listType)
{
var list = request.Get<IServiceLocator>().GetInstance(listType) as IFieldList;
return BuildTag(request, list);
}