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


C# ElementRequest.Get方法代码示例

本文整理汇总了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));
        }
开发者ID:joemcbride,项目名称:fubuvalidation,代码行数:7,代码来源:FieldValidationElementModifier.cs

示例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;
        }
开发者ID:DarthFubuMVC,项目名称:FubuMVC.AutoComplete,代码行数:27,代码来源:AutoCompleteTagBuilder.cs

示例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)));
        }
开发者ID:randrews,项目名称:dovetail,代码行数:8,代码来源:EntityListBuilder.cs

示例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);
        }
开发者ID:RyanHauert,项目名称:fubumvc,代码行数:17,代码来源:RemoteValidationElementModifier.cs

示例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;
        }
开发者ID:randrews,项目名称:dovetail,代码行数:19,代码来源:PizzaTypeEditorConvention.cs

示例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");
        }
开发者ID:NeilSorensen,项目名称:FubuMVC.DatePicker,代码行数:11,代码来源:DatePickerBuilder.cs

示例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 };
        }
开发者ID:KevM,项目名称:dovetail-bootstrap,代码行数:12,代码来源:GbstListValueDropdownBuilder.cs

示例8: Build

 public HtmlTag Build(ElementRequest request)
 {
     return new HtmlTag("div").Text(request.Get<FakeService>().Name);
 }
开发者ID:joemcbride,项目名称:fubumvc,代码行数:4,代码来源:HtmlElementScenarioTester.cs

示例9: BuildTag

 public static HtmlTag BuildTag(ElementRequest request, Type listType)
 {
     var list = request.Get<IServiceLocator>().GetInstance(listType) as IFieldList;
     return BuildTag(request, list);
 }
开发者ID:wenyanw,项目名称:SystemStateExample,代码行数:5,代码来源:ListValueElementPolicy.cs


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