Example #1
0
        static void RenderClientMenu()
        {
            new
            {
                Child1 = new
                {
                    Child1_1 = 11,
                    Child1_2 = 12
                },
                Child2 = new
                {
                    Child2_1 = 21,
                    Child2_2 = 22
                },
                Enum = Title.Mr,
                Link = SeeRawTypes.Form("Link", (x) => Console.WriteLine("Actionable")),
                ID   = Guid.NewGuid(),
                Time = DateTime.Now,
                Dict = new Dictionary <Guid, string> {
                    { Guid.NewGuid(), "OK" }
                },
                Prog       = progress,
                NestedList = new List <object>
                {
                    null,
                    new List <object>
                    {
                        1, 2, 3
                    },
                    new List <object>
                    {
                        1, 2, 3
                    },
                },
                ByKey = new List <X>
                {
                    new X {
                        Name = "Key 1"
                    },
                    new X {
                        Name = "Key 2"
                    }
                }
            }.Render();

            return;

            // Show a basic hello world
            "Hello World".Render();

            // Show a simple menu
            // a. create a placeholder and keep a reference to the renderTarget so we can update it later
            "Loading Menu...".Render(out var menuTarget);
            "Click on a menu item above".Render(out var contentTarget);

            // b. Create actions/menu items to update the contentTarget depending on whats invoked
            menuTarget.Value = SeeRawTypes.Navigation()
                               .WithAction("Say Hi", () => SayHi(contentTarget))
                               .WithAction("Calculator", () => Calc(contentTarget))
                               .WithAction("Show file copy progress", () => ShowProgress(contentTarget));
        }
Example #2
0
 static void SayHi(RenderTarget contentTarget)
 {
     contentTarget.Value = SeeRawTypes.Action("Please enter your details", (string name, Title title) => contentTarget.Value = $"Hi {title} {name}");
 }
Example #3
0
 static void Calc(RenderTarget contentTarget)
 {
     contentTarget.Value = SeeRawTypes.Action("Add", (int a, int b) => contentTarget.Value = $"Result: {a + b}");
 }
Example #4
0
        public void Navigation()
        {
            root.Render(SeeRawTypes.Navigation().WithAction("Navication Test", () => { }));

            AssertMatches();
        }
Example #5
0
        public void Link()
        {
            root.Render(SeeRawTypes.Form("Link test", c => { }));

            AssertMatches();
        }
Example #6
0
        public void Progress()
        {
            root.Render(SeeRawTypes.Progress());

            AssertMatches();
        }
Example #7
0
        public void Log()
        {
            root.Render(SeeRawTypes.Logger().WithMessage("Logger test").CreateChild("Child 1"));

            AssertMatches();
        }
Example #8
0
        public void Vertical()
        {
            root.Render(SeeRawTypes.VerticalRun("Vertical Test"));

            AssertMatches();
        }
Example #9
0
        public void Horizontal()
        {
            root.Render(SeeRawTypes.HorizontalRun("Horizontal Test"));

            AssertMatches();
        }
Example #10
0
        public void Form()
        {
            root.Render(SeeRawTypes.Form("Form test", c => { }).WithInput("Text input", "default text"));

            AssertMatches();
        }