Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            var master = new MasterViewComponentModel(
                new List <ViewComponentContainer>()
            {
                new ViewComponentContainer(
                    nameof(MemberOrderItemList),
                    new List <ViewComponentContainer>()
                {
                    new ViewComponentContainer(
                        nameof(MemberOrderItemRedeemedConditional),
                        new List <ViewComponentContainer>()
                    {
                        new ViewComponentContainer(
                            nameof(MemberOrderItemDetails),
                            null,
                            new MemberOrderItemDetailsOptions("a-class", "background-color:red;", false, false, new ElementWidths(1, 2, 3), nameof(MemberOrderItemModel.ProductName))),
                        new ViewComponentContainer(
                            nameof(MemberOrderItemDetails),
                            null,
                            new MemberOrderItemDetailsOptions("a-class", "background-color:white;", false, false, new ElementWidths(1, 2, 3), nameof(MemberOrderItemModel.GameNumber))),
                        new ViewComponentContainer(
                            nameof(MemberOrderItemExpirationCountdown),
                            null,
                            new MemberOrderItemExpirationCountdownOptions("a-class", "background-color:red;", false, false, new ElementWidths(1, 2, 3), significant: 4)),
                        new ViewComponentContainer(
                            nameof(HtmlElement),
                            new List <ViewComponentContainer>()
                        {
                            new ViewComponentContainer(
                                nameof(MemberOrderItemDetails),
                                null,
                                new MemberOrderItemDetailsOptions("z-class", "background-color:orange;", false, false, new ElementWidths(1, 2, 3), nameof(MemberOrderItemModel.GameNumber))),
                        },
                            new HtmlElementOptions("my-div-class", "padding:20px;", false, false, new ElementWidths(1, 2, 3), "div"))
                    },
                        new MemberOrderItemRedeemedConditionalOptions("redeemed-class", "padding:2px", false, false, new ElementWidths(6, 10, 12), true))
                },
                    new MemberOrderItemListOptions("b-class", "background-color:blue;", false, false, new ElementWidths(3, 5, 9), false, false, 1, 1))
            },
                new List <JavascriptBundle>()
            {
                JavascriptBundle.JQuery, JavascriptBundle.JQueryPlugin, JavascriptBundle.Custom, JavascriptBundle.JQueryCountdown, JavascriptBundle.FortressMemberOrderCountdown
            },
                new List <CssBundle>()
            {
                CssBundle.Bootstrap
            });

            var json   = JsonSerlializer.SerializePageJson(master);
            var result = JsonSerlializer.DeserializePageJson(json);

            Console.ReadLine();
        }
Ejemplo n.º 2
0
 public async Task <IViewComponentResult> InvokeAsync()
 {
     return(View(JsonSerlializer.DeserializePageJson(@"{""ViewComponents"":[{""ChildViewComponents"":[{""ChildViewComponents"":[{""ChildViewComponents"":[],""ViewComponentName"":""MemberOrderItemDetails"",""Options"":{""$type"":""ViewComponentsTest.Models.ViewComponents.Options.MemberOrderItemDetailsOptions, ViewComponentsTest"",""SelectedProperty"":""ProductName"",""DateFormat"":null,""Style"":""background-color:red;"",""Class"":""a-class"",""IsHidden"":false,""RemoveDiv"":false,""ElementWidths"":{""Small"":1,""Medium"":2,""Large"":3}}},{""ChildViewComponents"":[],""ViewComponentName"":""MemberOrderItemDetails"",""Options"":{""$type"":""ViewComponentsTest.Models.ViewComponents.Options.MemberOrderItemDetailsOptions, ViewComponentsTest"",""SelectedProperty"":""GameNumber"",""DateFormat"":null,""Style"":""background-color:white;"",""Class"":""a-class"",""IsHidden"":false,""RemoveDiv"":false,""ElementWidths"":{""Small"":1,""Medium"":2,""Large"":3}}},{""ChildViewComponents"":[],""ViewComponentName"":""MemberOrderItemExpirationCountdown"",""Options"":{""$type"":""ViewComponentsTest.Models.ViewComponents.Options.MemberOrderItemExpirationCountdownOptions, ViewComponentsTest"",""Layout"":""{o<} {on} {ol} {o>} {w<} {wn} {wl} {w>} {d<} {dn} {dl} {d>} {h<} {hn} {hl} {h>} {m<} {mn} {ml} {m>} {s<} {sn} {sl} {s>}"",""Significant"":4,""Format"":""dhms"",""Style"":""background-color:red;"",""Class"":""a-class"",""IsHidden"":false,""RemoveDiv"":false,""ElementWidths"":{""Small"":1,""Medium"":2,""Large"":3}}},{""ChildViewComponents"":[{""ChildViewComponents"":[],""ViewComponentName"":""MemberOrderItemDetails"",""Options"":{""$type"":""ViewComponentsTest.Models.ViewComponents.Options.MemberOrderItemDetailsOptions, ViewComponentsTest"",""SelectedProperty"":""GameNumber"",""DateFormat"":null,""Style"":""background-color:orange;"",""Class"":""z-class"",""IsHidden"":false,""RemoveDiv"":false,""ElementWidths"":{""Small"":1,""Medium"":2,""Large"":3}}}],""ViewComponentName"":""HtmlElement"",""Options"":{""$type"":""ViewComponentsTest.Models.ViewComponents.Options.HtmlElementOptions, ViewComponentsTest"",""HtmlElement"":""div"",""Style"":""padding:20px;"",""Class"":""my-div-class"",""IsHidden"":false,""RemoveDiv"":false,""ElementWidths"":{""Small"":1,""Medium"":2,""Large"":3}}}],""ViewComponentName"":""MemberOrderItemRedeemedConditional"",""Options"":{""$type"":""ViewComponentsTest.Models.ViewComponents.Options.MemberOrderItemRedeemedConditionalOptions, ViewComponentsTest"",""Not"":true,""Style"":""padding:2px"",""Class"":""redeemed-class"",""IsHidden"":false,""RemoveDiv"":false,""ElementWidths"":{""Small"":6,""Medium"":10,""Large"":12}}}],""ViewComponentName"":""MemberOrderItemList"",""Options"":{""$type"":""ViewComponentsTest.Models.ViewComponents.Options.MemberOrderItemListOptions, ViewComponentsTest"",""OnlyShowRedeemed"":false,""OnlyShowUnredeemed"":false,""Skip"":1,""Take"":1,""HideExpiredItems"":true,""Style"":""background-color:blue;"",""Class"":""b-class"",""IsHidden"":false,""RemoveDiv"":false,""ElementWidths"":{""Small"":3,""Medium"":5,""Large"":9}}}],""JavascriptBundles"":[1,6,3,4,5],""CssBundles"":[1]}")));
 }