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


C# ShapeTableBuilder.Describe方法代码示例

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


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

示例1: Discover

        public void Discover(ShapeTableBuilder builder)
        {
            builder.Describe("Parts_MenuWidget").OnDisplaying(context =>
            {
                var contentItem = (ContentItem)context.Shape.ContentItem;
                var widgetPart = contentItem.As<WidgetPart>();
                var menuWidgetPart = contentItem.As<MenuWidgetPart>();
                var menuShape = context.Shape.Menu;
                var widgetName = widgetPart.Name.ToSafeName();
                var menu = mMenuService.Value.GetMenu(menuWidgetPart.MenuContentItemId);
                var menuName = menu.As<TitlePart>().Title.ToSafeName();
                var zoneName = widgetPart.Zone;

                if (!String.IsNullOrWhiteSpace(widgetName))
                    context.ShapeMetadata.Alternates.Add($"Parts_MenuWidget__WidgetName__{widgetName}");

                context.ShapeMetadata.Alternates.Add($"Parts_MenuWidget__MenuName__{menuName}");
                context.ShapeMetadata.Alternates.Add($"Parts_MenuWidget__MenuLevel__{menuWidgetPart.StartLevel}");
                context.ShapeMetadata.Alternates.Add($"Parts_MenuWidget__MenuName__{menuName}__MenuLevel{menuWidgetPart.StartLevel}");
                context.ShapeMetadata.Alternates.Add($"Parts_MenuWidget__Zone__{zoneName}");
                context.ShapeMetadata.Alternates.Add($"Parts_MenuWidget__Zone__{zoneName}__MenuName__{menuName}");

                menuShape.MenuWidget = contentItem;
                menuShape.SafeMenuName = menuName;
            });

            builder.Describe("Menu").OnDisplaying(ConfigureMenuShape);
            builder.Describe("Breadcrumb").OnDisplaying(ConfigureMenuShape);
        }
开发者ID:IDeliverable,项目名称:IDeliverable.Bits,代码行数:29,代码来源:MenuWidgetShapeAlternates.cs

示例2: Discover

        public void Discover(ShapeTableBuilder builder)
        {
            builder.Describe("Parts_Comments")
                .OnDisplaying(shapeDisplayingContext =>
                {
                    var settings = this.orchardServices.WorkContext.CurrentSite.As<DisqusSettingsPart>();
                    shapeDisplayingContext.Shape.DisqusSettings = settings;
                    shapeDisplayingContext.Shape.DisqusUniqueId = GetUniqueIdentifier(shapeDisplayingContext.Shape.ContentPart.ContentItem);
                    shapeDisplayingContext.ShapeMetadata.Wrappers.Add("CommentsWrapper");
                });

            builder.Describe("Parts_Comments_Count")
                .OnDisplaying(shapeDisplayingContext =>
                {
                    var settings = this.orchardServices.WorkContext.CurrentSite.As<DisqusSettingsPart>();
                    shapeDisplayingContext.Shape.DisqusSettings = settings;
                    shapeDisplayingContext.Shape.DisqusUniqueId = GetUniqueIdentifier(shapeDisplayingContext.Shape.ContentPart.ContentItem);
                    shapeDisplayingContext.ShapeMetadata.Wrappers.Add("CountWrapper");
                });

            builder.Describe("Parts_Blogs_BlogPost_List")
                .OnDisplaying(shapeDisplayingContext =>
                {
                    var settings = this.orchardServices.WorkContext.CurrentSite.As<DisqusSettingsPart>();
                    shapeDisplayingContext.Shape.DisqusSettings = settings;
                    shapeDisplayingContext.ShapeMetadata.Wrappers.Add("ListWrapper");
                });
        }
开发者ID:ShuanWang,项目名称:devoffice.com-shuanTestRepo,代码行数:28,代码来源:Shapes.cs

示例3: Discover

        public void Discover(ShapeTableBuilder builder) {

            builder.Describe("Menu")
                .OnDisplaying(displaying =>
                {
                    string displayType = displaying.Shape.DisplayType;

                    if (!string.IsNullOrWhiteSpace(displayType))
                    {
                        displaying.Shape.Metadata.Alternates.Add("Menu_" + EncodeAlternateElement(displayType));
                    }
                });

            builder.Describe("MenuItem")
                .OnDisplaying(displaying =>
                {
                    string displayType = displaying.Shape.Menu.DisplayType;

                    if (!string.IsNullOrWhiteSpace(displayType))
                    {
                        displaying.Shape.Metadata.Alternates.Add("MenuItem_" + EncodeAlternateElement(displayType));
                    }
                });

            builder.Describe("MenuItemLink")
                .OnDisplaying(displaying =>
                {
                    string displayType = displaying.Shape.Menu.DisplayType;

                    if (!string.IsNullOrWhiteSpace(displayType))
                    {
                        displaying.Shape.Metadata.Alternates.Add("MenuItemLink_" + EncodeAlternateElement(displayType));
                    }
                });
        }
开发者ID:MainBit,项目名称:MainBit.Layouts,代码行数:35,代码来源:ElementAlternatesShapes.cs

示例4: Discover

        public void Discover(ShapeTableBuilder builder) {
            builder.Describe("Post_Body_Editor")
                .OnDisplaying(displaying => {
                    string flavor = displaying.Shape.EditorFlavor;
                    displaying.ShapeMetadata.Alternates.Add("Post_Body_Editor__" + flavor);
                });

            // We support multiple forum types, but need to be able to skin forum admin shapes, so add alternates for any content type that has a ForumPart.
            builder.Describe("Content").OnDisplaying(displaying => {
                var content = (ContentItem) displaying.Shape.ContentItem;

                if (content.Parts.All(x => x.PartDefinition.Name != typeof (ForumPart).Name))
                    return;

                var displayType = !String.IsNullOrWhiteSpace(displaying.ShapeMetadata.DisplayType) ? displaying.ShapeMetadata.DisplayType : "Detail";
                var alternates = new[] {
                    string.Format("Content__{0}", content.ContentType),
                    string.Format("Content__{0}_{1}", content.ContentType, displayType),

                };

                foreach (var alternate in alternates.Where(alternate => !displaying.ShapeMetadata.Alternates.Contains(alternate))) {
                    displaying.ShapeMetadata.Alternates.Add(alternate);
                }
            });
        }
开发者ID:six006,项目名称:NGM.Forum,代码行数:26,代码来源:Shapes.cs

示例5: Discover

        public void Discover(ShapeTableBuilder builder) {


            builder.Describe("LogOn")
                   .OnDisplaying(displaying => {
                       var clientsData = _openAuthAuthenticationClients
                .Select(client => _orchardOpenAuthClientProvider.GetClientData(client.ProviderName))
                .Where(x => x != null)
                .ToList();
                        var shape = displaying.Shape;
                        var metadata = displaying.ShapeMetadata;

                        shape.ClientsData = clientsData;

                        metadata.Type = "OpenAuthLogOn";
                    });

            builder.Describe("Register")
                   .OnDisplaying(displaying => {
                       var clientsData = _openAuthAuthenticationClients
                           .Select(client => _orchardOpenAuthClientProvider.GetClientData(client.ProviderName))
                           .Where(x => x != null)
                           .ToList();

                       var shape = displaying.Shape;
                       var metadata = displaying.ShapeMetadata;

                       shape.ClientsData = clientsData;

                       metadata.Type = "OpenAuthRegister";
                   });
        }
开发者ID:WoB-OSS,项目名称:NGM.OpenAuthentication,代码行数:32,代码来源:Shapes.cs

示例6: Discover

 public void Discover(ShapeTableBuilder builder) {
     // hack: This is important when using the Input shape directly, but it doesn't come into play
     // when using a 'master' shape yet.
     builder.Describe("Input").Configure(descriptor => descriptor.Wrappers.Add("InputWrapper"));
     builder.Describe("SelectList").Configure(descriptor => descriptor.Wrappers.Add("InputWrapper"));
     builder.Describe("Textarea").Configure(descriptor => descriptor.Wrappers.Add("InputWrapper"));
     builder.Describe("Form").OnCreating(ctx => ctx.Behaviors.Add(new PropertiesAreItems()));
     builder.Describe("Fieldset").OnCreating(ctx => ctx.Behaviors.Add(new PropertiesAreItems()));
 }
开发者ID:kerrjon,项目名称:MNFathers,代码行数:9,代码来源:EditorShapes.cs

示例7: Discover

 public void Discover(ShapeTableBuilder builder) {
     builder.Describe("Table")
         .OnCreating(creating => {
             creating.Behaviors.Add(new RowHoldingBehavior(()=>creating.New.Row()));
         });
     builder.Describe("Row")
         .OnCreating(creating => {
             creating.Behaviors.Add(new CellHoldingBehavior(() => creating.New.Cell()));
         });
 }
开发者ID:akhurst,项目名称:ricealumni,代码行数:10,代码来源:TableShapeProvider.cs

示例8: Discover

        public void Discover(ShapeTableBuilder builder)
        {
            builder.Describe("Parts_Comments")
                .OnDisplaying(shapeDisplayingContext =>
                    AddShapeWrapper(shapeDisplayingContext, "Parts_Comments_Wrapper"));

            builder.Describe("Parts_Comments_Count")
                .OnDisplaying(shapeDisplayingContext =>
                    AddShapeWrapper(shapeDisplayingContext, "Parts_Comments_Count_Wrapper"));

            builder.Describe("Parts_Blogs_BlogPost_List")
                .OnDisplaying(shapeDisplayingContext =>
                    AddShapeWrapper(shapeDisplayingContext, "Parts_BlogPost_List_Wrapper", includeUniqueIndentifier: false));
        }
开发者ID:fengweijp,项目名称:Orchard.Disqus,代码行数:14,代码来源:Shapes.cs

示例9: Discover

        public void Discover(ShapeTableBuilder builder)
        {
            builder.Describe("Menu")
                .OnDisplaying(displaying =>
                {
                    var menu = displaying.Shape;
                    string menuId = menu.ItemId;
                    if (menuId == null) return;

                    menu.Id = "menu-" + menuId.ToLowerInvariant();
                    menu.Metadata.Alternates.Add("Menu__" + menuId);
                });

            builder.Describe("Breadcrumbs")
                .OnDisplaying(displaying =>
                {
                    dynamic bc = displaying.Shape;
                    bc.Classes.Add("breadcrumbs");
                    var item = (IContent) bc.ContentItem;
                    if (item == null) return;

                    bc.Classes.Add("breadcrumbs-" + item.ContentItem.ContentType.HtmlClassify());
                    bc.Id = "breadcrumbs-" + item.ContentItem.Id;
                    bc.Metadata.Alternates.Add("Breadcrumbs__" + item.ContentItem.ContentType);
                    bc.Metadata.Alternates.Add("Breadcrumbs__" + item.ContentItem.Id);

                    if(item.Is<BreadcrumbsPart>()) {
                        var part = item.As<BreadcrumbsPart>();
                        bc.Metadata.Alternates.Add("Breadcrumbs__" + part.MenuName);
                    }
                });

            builder.Describe("Counter")
                .OnDisplaying(displaying =>
                {
                    dynamic counter = displaying.Shape;
                    counter.Classes.Add("counter");
                    counter.Classes.Add("counter-" + Enum.GetName(typeof(VisitCounterType),counter.Type).HtmlClassify());
                    counter.Metadata.Alternates.Add("Counter__" + counter.Type);

                    var item = (IContent) counter.ContentItem;
                    if (item != null) {
                        counter.Classes.Add("counter-" + item.ContentItem.ContentType.HtmlClassify());
                        counter.Id = "counter-" + item.ContentItem.Id;
                        counter.Metadata.Alternates.Add("Counter__" + item.ContentItem.ContentType);
                        counter.Metadata.Alternates.Add("Counter__" + item.ContentItem.Id);
                    }  
                });
        }
开发者ID:juaqaai,项目名称:CompanyGroup,代码行数:49,代码来源:Shapes.cs

示例10: Discover

        public void Discover(ShapeTableBuilder builder) {
            builder.Describe("Content")
                .OnCreated(created => {
                    var content = created.Shape;
                    content.Child.Add(created.New.PlaceChildContent(Source: content));
                })
                .OnDisplaying(displaying => {
                    ContentItem contentItem = displaying.Shape.ContentItem;
                    if (contentItem != null) {
                        // Alternates in order of specificity. 
                        // Display type > content type > specific content > display type for a content type > display type for specific content

                        // Content__[DisplayType] e.g. Content.Summary
                        displaying.ShapeMetadata.Alternates.Add("Content_" + displaying.ShapeMetadata.DisplayType);

                        // Content__[ContentType] e.g. Content-BlogPost
                        displaying.ShapeMetadata.Alternates.Add("Content__" + contentItem.ContentType);

                        // Content__[Id] e.g. Content-42
                        displaying.ShapeMetadata.Alternates.Add("Content__" + contentItem.Id);

                        // Content_[DisplayType]__[ContentType] e.g. Content-BlogPost.Summary
                        displaying.ShapeMetadata.Alternates.Add("Content_" + displaying.ShapeMetadata.DisplayType + "__" + contentItem.ContentType);

                        // Content_[DisplayType]__[Id] e.g. Content-42.Summary
                        displaying.ShapeMetadata.Alternates.Add("Content_" +  displaying.ShapeMetadata.DisplayType + "__" + contentItem.Id);

                        if ( !displaying.ShapeMetadata.DisplayType.Contains("Admin") )
                            displaying.ShapeMetadata.Wrappers.Add("Content_ControlWrapper");
                    }
                });
        }
开发者ID:juaqaai,项目名称:CompanyGroup,代码行数:32,代码来源:Shapes.cs

示例11: Discover

 public void Discover(ShapeTableBuilder builder)
 {
     builder.Describe("Price")
         .OnDisplaying(displaying => {
             displaying.ShapeMetadata.Alternates.Add("Price__Vat");
             displaying.ShapeMetadata.Alternates.Add("Price_" + displaying.ShapeMetadata.DisplayType + "__Vat");
         });
     builder.Describe("ShoppingCart_CartItems")
         .OnDisplaying(displaying => {
             displaying.ShapeMetadata.Alternates.Add("ShoppingCart_CartItems__Vat");
         });
     builder.Describe("ShoppingCart_Widget")
         .OnDisplaying(displaying => {
             displaying.ShapeMetadata.Alternates.Add("ShoppingCart_Widget__Vat");
         });
 }
开发者ID:rtpHarry,项目名称:OShop,代码行数:16,代码来源:VatShapeProvider.cs

示例12: Discover

        public void Discover(ShapeTableBuilder builder) {
            builder.Describe("Media")
                .OnDisplaying(displaying => {
                    ContentItem contentItem = displaying.Shape.ContentItem;
                    if (contentItem != null) {
                        // Alternates in order of specificity. 
                        // Display type > content type > specific content > display type for a content type > display type for specific content
                        // BasicShapeTemplateHarvester.Adjust will then adjust the template name

                        // Media__[DisplayType] e.g. Media-Summary
                        displaying.ShapeMetadata.Alternates.Add("Media_" + EncodeAlternateElement(displaying.ShapeMetadata.DisplayType));

                        // Media__[ContentType] e.g. Media-BlogPost,
                        displaying.ShapeMetadata.Alternates.Add("Media__" + EncodeAlternateElement(contentItem.ContentType));

                        // Media__[Id] e.g. Media-42,
                        displaying.ShapeMetadata.Alternates.Add("Media__" + contentItem.Id);

                        // Media_[DisplayType]__[ContentType] e.g. Media-Image.Summary
                        displaying.ShapeMetadata.Alternates.Add("Media_" + displaying.ShapeMetadata.DisplayType + "__" + EncodeAlternateElement(contentItem.ContentType));

                        // Media_[DisplayType]__[Id] e.g. Media-42.Summary
                        displaying.ShapeMetadata.Alternates.Add("Media_" + displaying.ShapeMetadata.DisplayType + "__" + contentItem.Id);
                    }
                });
        }
开发者ID:wezmag,项目名称:Coevery,代码行数:26,代码来源:Shapes.cs

示例13: Discover

 public void Discover(ShapeTableBuilder builder) {
     builder.Describe("Content_Edit")
         .OnDisplaying(displaying => {
             var shape = displaying.Shape;
             shape.Metadata.Alternates.Add("Content_Edit__Default");
         });
 }
开发者ID:wezmag,项目名称:Coevery,代码行数:7,代码来源:ListViewShape.cs

示例14: Discover

 public void Discover(ShapeTableBuilder builder) {
     builder.Describe("Content").OnDisplaying(displaying => {
         if (!displaying.ShapeMetadata.DisplayType.Contains("Admin")) {
             displaying.ShapeMetadata.Wrappers.Add("Content_ControlWrapper");
         }
     });
 }
开发者ID:RasterImage,项目名称:Orchard,代码行数:7,代码来源:ControlWrapper.cs

示例15: Discover

        public void Discover(ShapeTableBuilder builder) {
            builder.Describe("Widget")
                .Configure(descriptor => {
                    // todo: have "alternates" for chrome
                    descriptor.Wrappers.Add("Widget_Wrapper");
                    descriptor.Wrappers.Add("Widget_ControlWrapper");
                })
                .OnCreated(created => {
                    var widget = created.Shape;
                    widget.Child.Add(created.New.PlaceChildContent(Source: widget));
                })
                .OnDisplaying(displaying => {
                    var widget = displaying.Shape;
                    widget.Classes.Add("widget");

                    ContentItem contentItem = displaying.Shape.ContentItem;
                    if (contentItem != null) {
                        widget.Classes.Add("widget-" + contentItem.ContentType.HtmlClassify());

                        var zoneName = contentItem.As<WidgetPart>().Zone;

                        // Widget__[ZoneName] e.g. Widget-SideBar
                        displaying.ShapeMetadata.Alternates.Add("Widget__" + zoneName);

                        // Widget__[ContentType] e.g. Widget-BlogArchive
                        displaying.ShapeMetadata.Alternates.Add("Widget__" + contentItem.ContentType);
                    }
                });
        }
开发者ID:rupertwhitlock,项目名称:IncreasinglyAbsorbing,代码行数:29,代码来源:Shapes.cs


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